lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Rowe <sar...@gmail.com>
Subject Re: schema-api: modifying schema in xml format
Date Wed, 18 Apr 2018 13:27:32 GMT
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 <mazeika@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


Mime
View raw message