Hi Carlo,
This is an interesting catch, this is the case with all field type parameters.
I believe the reason for that is that the schema uses XML as its default format
where everything is treated as a string. There are some exceptions though like
the default field properties, which are always defined as booleans:
<lst>
<str name="name">pdouble</str>
<str name="class">solr.DoublePointField</str>
<bool name="docValues">true</bool>
</lst>
Other than that, most attributes are defined as strings:
<lst>
<str name="name">rpt</str>
<str name="class">solr.SpatialRecursivePrefixTreeFieldType</str>
<str name="geo">true</str>
<str name="maxDistErr">0.001</str>
<str name="distErrPct">0.025</str>
<str name="distanceUnits">kilometers</str>
</lst>
Another example:
<lst>
<str name="name">text_general</str>
<str name="class">solr.TextField</str>
<lst name="indexAnalyzer">
<arr name="charFilters">
<lst>
<str name="class">solr.PatternReplaceCharFilterFactory</str>
<str name="pattern">\s+$</str>
<str name="replacement"/>
</lst>
</arr>
<lst name="tokenizer">
<str name="class">solr.StandardTokenizerFactory</str>
</lst>
<arr name="filters">
<lst>
<str name="class">solr.TrimFilterFactory</str>
</lst>
<lst>
<str name="words">stopwords.txt</str>
<str name="name">stop</str>
<str name="ignoreCase">true</str>
</lst>
<lst>
<str name="name">lowercase</str>
</lst>
</arr>
</lst>
Thank you,
Patryk
On 2024/10/30 15:37:02 Carlo Ascani wrote:
> Hi all,
>
> in solr 8.11, I am trying to post booleans using the Schema API,
> but it looks like I always get strings back.
>
> Request 1:
>
> curl -X POST -H 'Content-type:application/json' --data-binary '{
> "replace-field-type":{
> "name":"rpt",
> "class": "solr.SpatialRecursivePrefixTreeFieldType",
> "spatialContextFactory": "JTS",
> "geo": true,
> "format": "WKT",
> "distErrPct": "0.025",
> "allowMultiOverlap": true,
> "validationRule": "none"
> }
> }' http://localhost:8983/solr/exp/schema
>
> Response 1:
>
> {
> "responseHeader":{
> "status":0,
> "QTime":288}}
>
> Then, if I try to query the field type:
>
> curl -H 'Content-type:application/json'
> http://localhost:8983/solr/exp/schema/fieldtypes/rpt
> {
> "responseHeader":{
> "status":0,
> "QTime":1},
> "fieldType":{
> "name":"rpt",
> "class":"solr.SpatialRecursivePrefixTreeFieldType",
> "geo":"true",
> "omitNorms":true,
> "omitTermFreqAndPositions":true,
> "allowMultiOverlap":"true",
> "spatialContextFactory":"JTS",
> "termOffsets":false,
> "validationRule":"none",
> "distErrPct":"0.025",
> "format":"WKT",
> "termPositions":false,
> "omitPositions":true}}
>
> Please note "geo" and "allowMultiOverlap" keys, they are strings.
>
> Any idea why this is happening?
>
> Cheers
>