Hi Arturas,

The Schema API only understands commands in JSON.  I looked through the ref 
guide page, and I’m surprised that this isn’t stated directly; I’ll try to fix 
that.

--
Steve
www.lucidworks.com

> On Apr 18, 2018, at 4:12 AM, Arturas Mazeika <maze...@gmail.com> wrote:
> 
> Hi solr-users,
> 
> is it possible to modify the managed schema using schema api and submit the
> commands in XML format? I am able to add a data type using:
> 
> curl -X POST -H 'Content-type:application/json' --data-binary '{
>  "add-field-type": {
>  "name":"text_de_ph",
>  "class":"solr.TextField",
>  "positionIncrementGap":"100",
>  "analyzer": {
>    "tokenizer": {"class":"solr.StandardTokenizerFactory"},
>    "filters": [
>      {"class":"solr.LowerCaseFilterFactory"},
>      {"class":"solr.StopFilterFactory", "format":"snowball",
> "words":"lang/stopwords_de.txt", "ignoreCase":true},
>      {"class":"solr.GermanNormalizationFilterFactory"},
>      {"class":"solr.GermanLightStemFilterFactory"},
>      {"class":"solr.PhoneticFilterFactory", "encoder":"DoubleMetaphone"}
>  ]}}
> }' http://localhost:8983/solr/tph/schema
> 
> so I thought I could submit something like:
> 
> curl -X POST -H 'Content-Type: text/xml' --data-binary '
> <add-field-type name="text_de_ph" class="solr.TextField"
> positionIncrementGap="100">
>   <analyzer>
>      <tokenizer class="solr.StandardTokenizerFactory"/>
>      <filter class="solr.LowerCaseFilterFactory"/>
>      <filter class="solr.StopFilterFactory" format="snowball"
> words="lang/stopwords_de.txt" ignoreCase="true"/>
>      <filter class="solr.GermanNormalizationFilterFactory"/>
>      <filter class="solr.GermanLightStemFilterFactory"/>
>      <filter class="solr.PhoneticFilterFactory" encoder="DoubleMetaphone"/>
>    </analyzer>
> </add-field-type>
> ' http://localhost:8983/solr/tph/schema
> 
> This however failed with the error:
> 
> {
>  "responseHeader":{
>    "status":500,
>    "QTime":1},
>  "error":{
>    "msg":"JSON Parse Error: char=<,position=1 AFTER=' ...
> 
> The examples in the documentation (I am using solr 7.2) are all in JSON
> format, but does not say explicitly, that one needs to send the updates in
> json format only..
> 
> https://lucene.apache.org/solr/guide/7_2/schema-api.html#schema-api
> 
> Comments?
> 
> Cheers,
> Arturas

Reply via email to