Hello all,
I am making multiple queries in a single url and trying to
boost the value of a field in the 2nd based on the results of the 1st. To
achieve this, my function query should be able to have access to the
response of the first query. However, QParser and QParserPlugin only
accepts req parameter and does not have any idea about the response.
In a nutshell, all I am trying to do is that, during a serial execution of
chain of queries represented by a single url(
https://issues.apache.org/jira/browse/SOLR-1093), I am trying to influence
the results of the second query with the results of the first query. To
make the function queries ResponseAware, there are two options:
*Option 1: Make all the QueryParsers ResponseAware*
For this the following changes seem to be inevitable
1. Change/overload the createParser definition of QParserPlugin to
include SolrQueryResponse
createParser(string qstr, SolrParams localParams,
SolrParams params, SolrQueryResponse rsp) -> createParser(string qstr,
SolrParams localParams, SolrParams params, SolrQueryRequest
req, SolrQueryResponse rsp)
2. Make similar changes to the getParser function in QPareser
*Option 2: Make FunctionQueryParser alone ResponseAware*
For this, following changes need to be made
1. Overload the FunctionQueryParserPlugin's create method with the
following signature
createParser(string qstr, SolrParams localParams,
SolrParams params, SolrQueryRequest req, SolrQueryResponse rsp)
2. Overload the getParser methong in QParser to permit the extra
SolrResponse parameter and invoke this call wherever necessary.
Once the parser is response aware, its easy for the components to grab the
response and use them.
This change to interface would mandate changes across the various
components of SOLR that use all the different kind of parsers but I think
this would be a useful feature as it has been requested by different people
at various times. I would appreciate any kind of
suggestions/feedback. Also, I would be more than happy to discuss if there
are anyother way of doing the same.