You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Jason Gerlowski <ge...@gmail.com> on 2018/10/28 15:21:22 UTC

JSON Query DSL Param Dropping/Overwriting

Hi all,

Had a question about how parameters are combined/overlaid in the JSON
Query DSL.  Ran into some behavior that struck me as odd/maybe-buggy.

The query DSL allows params to be provided a few different ways:
1. As query-params in the URI (e.g. "/select?fq=inStock:true")
2. In the JSON request proper (e.g. "json={'filter': 'inStock:true'}"
3. In a special "params" block in the JSON (e.g. "json={ params:
{'fq': 'inStock:true'}}")

When the same parameter (e.g. fq/filter) is provided in more than one
syntax, Solr generally respects each of them, adding all filters to
the request.  But when a filter is present in the JSON "params" block,
it gets ignored or overwritten. (This is reflected in the results, but
it's also easy to tell from the "parsed_filter_queries" block when
requests are run with debug=true)  Does anyone know if this is
expected or a mistake?  It seems like a bug, but maybe I'm just not
seeing the use-case.

I've got a more detailed script showing the difference here for anyone
interested: https://pastebin.com/u1pdMvrq

Best,

Jason