Re: Custom distributed SearchHandler: where do I store information in the ResponseBuilder from handleResponses->finishStage
Chris Hostetter <hossman_lucene <at> fucit.org>
2012-06-25 21:28:21 GMT
: Subject: Custom distributed SearchHandler: where do I store information in the
: ResponseBuilder from handleResponses->finishStage
: Facets stores its data in a field in ResponseBuilder:
: public FacetComponent.FacetInfo _facetInfo;
: I could add my own field, but it feels strange to have to edit solr code
: to create a new SearchHandler plugin.
The API for writing SearchComponents was primarily designed to make it
straightforward to refactor a lot of stuff that use to be hardcoded in the
old StandardRequestHandler so that it could be in components, and that new
third-party components could be written -- but (in my opinon) the
SearchComponent/ResponseBuilder APIs arent very good or freindly to
writing third-party components .... but i've never had much luck thinking
of anything better.
The only way i know of for a third-party custom SearchComponent (that
isn't replacing/overriding built in component) to keep track of arbitrary
data using ResponseBuilder is to leverage the
SolrQueryRequest's getContext(). You can put anything you wnat in there
during the various stages of a distributed request, and then
when you are all finished and have the final computed vlaues you want to
return, add it to the SolrQueryResponse.