Solr: How to pass a multivalued request parameter as a “local parameter” in a nested query?

StackOverflow https://stackoverflow.com/questions/12369179

  •  01-07-2021
  •  | 
  •  

Question

I am constructing a nested Solr DisMax query of the format: _query_:"{!edismax qf=...}.... Now I need to add several boosting queries (bq-parameter), but simply writing _query_:"{!edismax qf=... bq=foo bq=bar} doesn't seem to work as only one of the bq-keys is processed and the rest are ignored. Is it possible to pass multivalued parameters as LocalParams?

Was it helpful?

Solution

Multivalued local parameters turned out to be not implemented at the moment. Here's a CR for that - https://issues.apache.org/jira/browse/SOLR-2798

OTHER TIPS

Instead of using localparams and complicating the query try using a new request handler.
The multiple bq parameters can be specified easily and should work fine and should be easier to understand.

<requestHandler name="edismax" class="solr.SearchHandler" >
    <lst name="defaults">
        <str name="defType">edismax</str>
        <str name="qf">
            title
        </str>
        <str name="bq">
            foo bar
        </str>
        <str name="fl">
            *,score
        </str>
        <int name="ps">100</int>
        <str name="q.alt">*:*</str>
    </lst>   
</requestHandler>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top