You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Young, Cody" <Co...@move.com> on 2012/06/22 02:32:17 UTC

Custom distributed SearchHandler: where do I store information in the ResponseBuilder from handleResponses->finishStage

Okay, so I'm making a custom distributed SearchComponent. It does something similar to facet_queries for the distributed portion.

Modifies purpose_get_top_ids to modify the shard queries, handleResponses to aggregate information and then adds it to the response output in the 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.

Thanks,
Cody

Re: Custom distributed SearchHandler: where do I store information in the ResponseBuilder from handleResponses->finishStage

Posted by Chris Hostetter <ho...@fucit.org>.
: 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.

Agreed.  

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.

	



-Hoss

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org