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 Jamie Johnson <je...@gmail.com> on 2011/09/01 21:24:09 UTC

Custom response header from Solr

Is there a way to add arbitrary values into the response header?  I
have a need to insert a boolean into the header and doing something
like

SolrQueryResponse rsp = rb.rsp;
rsp.getResponseHeader().add("testValue", Boolean.TRUE);

Works so long as the query is not distributed.  When the query is
distributed what the individual shards add to the header seem to be
thrown away.  Is there a mechanism for the shard to influence the
header?

Re: Custom response header from Solr

Posted by Chris Hostetter <ho...@fucit.org>.
Merging of data from the response is up to the individual components -- if 
you write a MyCustomComponent that you want to work in distributed mode, 
then it not only needs to add data to the response when it's run on each 
shard, but it also needs to decide how to "merge" that data in the final 
response.

wether the data is in the "body" of the response of the "header" or the 
response really makes no difference.  the response header is really just 
the first item in the body.


: Is there a way to add arbitrary values into the response header?  I
: have a need to insert a boolean into the header and doing something
: like
: 
: SolrQueryResponse rsp = rb.rsp;
: rsp.getResponseHeader().add("testValue", Boolean.TRUE);
: 
: Works so long as the query is not distributed.  When the query is
: distributed what the individual shards add to the header seem to be
: thrown away.  Is there a mechanism for the shard to influence the
: header?
: 

-Hoss