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 Max Bridgewater <ma...@gmail.com> on 2017/04/11 16:17:35 UTC
Invoking a SerachHandler inside Solr Plugin
I am looking for best practices when a search component in one handler,
needs to invoke another handler, say /basic. So far, I got this working
prototype:
public void process(ResponseBuilder rb) throws IOException {
SolrQueryResponse response = new SolrQueryResponse();
ModifiableSolrParams params=new ModifiableSolrParams();
params.add("defType",
"lucene").add("fl","product_id").add("wt","json").
add("df","competitor_product_titles").add("echoParams","explicit").add("q",rb.req.getParams().get("q"));
SolrQueryRequest request= new
LocalSolrQueryRequest(rb.req.getCore(),params );
SolrRequestHandler hdlr =
rb.req.getCore().getRequestHandler("/basic");
rb.req.getCore().execute(hdlr, request, response);
DocList
docList=((ResultContext)response.getValues().get("response")).docs;
//Do some crazy stuff with the result
}
My concerns:
1) What is a clean way to read the /basic handler's default parameters
from solrconfig.xml and use them in LocalSolrQueryRequest().
2) Is there a better way to accomplish this task overall?
Thanks,
Max.