You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by Andrew Hankinson <an...@rism.digital> on 2021/08/16 12:56:03 UTC
JSON Request API and request handlers defaults
Hello!
I am seeing a disconnect between the Solr JSON Request API and the `defaults` section in the request handlers, specifically around the handling of 'fields' and 'fl' parameters.
To demonstrate, I have a request handler that looks like this:
<requestHandler name="/select" class="solr.SearchHandler">
<lst name="defaults">
<str name="echoParams">all</str>
<int name="rows">20</int>
<arr name="fl">
<str>field1</str>
<str>field2</str>
<str>field3</str>
</arr>
</lst>
</requestHandler>
I then send a JSON Request API request that overrides it, but uses the 'fields' key in a JSON Request.
{ "query": "foo",
"fields": ["field4", "field5", "field6"]
}
What I would expect is to see the returned documents with fields 4, 5, and 6 present, but instead they are returned with fields 1, 2, and 3 (the defaults).
I can work around this issue by using the 'params' key in the request:
{ "query": "foo",
"params": {"fl": ["field4", "field5", "field6"]}
}
In this case I see fields 4, 5, and 6 in the result, but this means that I cannot use the "fields" parameter in the JSON Request API.
I have also tried changing the request handler to:
<arr name="fields">
<str>field1</str>
<str>field2</str>
<str>field3</str>
</arr>
but this does not work.
Is this a known bug?
Many thanks,
-Andrew Hankinson