I didn't see any open Jira issues for this, so i created one...

https://issues.apache.org/jira/browse/SOLR-2121

: Date: Tue, 7 Sep 2010 01:35:39 -0700 (PDT)
: From: Marc Sturlese <marc.sturl...@gmail.com>
: Reply-To: solr-user@lucene.apache.org
: To: solr-user@lucene.apache.org
: Subject: Re: Null pointer exception when mixing highlighter & shards & q.alt
: 
: 
: I noticed that long ago.
: Fixed it doing in HighlightComponent finishStage:
:   @Override
:   public void finishStage(ResponseBuilder rb) {
:     boolean hasHighlighting = true ;
:     if (rb.doHighlights && rb.stage == ResponseBuilder.STAGE_GET_FIELDS) {
: 
:       Map.Entry<String, Object>[] arr = new
: NamedList.NamedListEntry[rb.resultIds.size()];
: 
:       // TODO: make a generic routine to do automatic merging of id keyed
: data
:       for (ShardRequest sreq : rb.finished) {
:         if ((sreq.purpose & ShardRequest.PURPOSE_GET_HIGHLIGHTS) == 0)
: continue;
:         for (ShardResponse srsp : sreq.responses) {
:           NamedList hl =
: (NamedList)srsp.getSolrResponse().getResponse().get("highlighting");
:           //patch bug
:           if(hl != null) {
:             for (int i=0; i<hl.size(); i++) {
:              String id = hl.getName(i);
:              ShardDoc sdoc = rb.resultIds.get(id);
:              int idx = sdoc.positionInResponse;
:              arr[idx] = new NamedList.NamedListEntry(id, hl.getVal(i));
:             }
:           } else {
:             hasHighlighting = false;
:           }
:         }
:       }
: 
:       // remove nulls in case not all docs were able to be retrieved
:       //patch bug
:       if(hasHighlighting) {
:         rb.rsp.add("highlighting", removeNulls(new SimpleOrderedMap(arr)));
:       }
:     }
:   }
: -- 
: View this message in context: 
http://lucene.472066.n3.nabble.com/Null-pointer-exception-when-mixing-highlighter-shards-q-alt-tp1430353p1431253.html
: Sent from the Solr - User mailing list archive at Nabble.com.
: 

-Hoss

--
http://lucenerevolution.org/  ...  October 7-8, Boston
http://bit.ly/stump-hoss      ...  Stump The Chump!

Reply via email to