Marc - Mind creating a ticket in JIRA and attaching our patch? Otis ---- Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch Hadoop ecosystem search :: http://search-hadoop.com/
----- Original Message ---- > From: Marc Sturlese <marc.sturl...@gmail.com> > To: solr-user@lucene.apache.org > Sent: Thu, April 15, 2010 1:30:22 PM > Subject: bug using distributed search, highlighting and q.alt > > I have noticed when using q.alt even if hl=true highlights are not > returned. When using distributed search, q.alt and hl, > HighlightComponent.java finishStage expects the highlighting NamedList of > each shard (if hl=true) but it will never be returned. It will end up with a > NullPointerExcepion. I have temporally solved it checking that highlight > NamedList is always returned for each shard. If it's not the case, highlights > are not added to the response: @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"); > 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 > if(hasHighlighting) { > rb.rsp.add("highlighting", removeNulls(new SimpleOrderedMap(arr))); > } } } -- View this message in > context: > href="http://n3.nabble.com/bug-using-distributed-search-highlighting-and-q-alt-tp721797p721797.html" > > target=_blank > >http://n3.nabble.com/bug-using-distributed-search-highlighting-and-q-alt-tp721797p721797.html Sent > from the Solr - User mailing list archive at Nabble.com.