You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Dylan Etkin (JIRA)" <ji...@apache.org> on 2011/06/01 20:23:47 UTC
[jira] [Commented] (SOLR-1901) bug using distributed search,
highlighting and q.alt
[ https://issues.apache.org/jira/browse/SOLR-1901?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13042341#comment-13042341 ]
Dylan Etkin commented on SOLR-1901:
-----------------------------------
I am using solr 3.1.0 and the linked issue SOLR-2121 still exists.
I can confirm that applying the patch from the linked issue causes the NPE to go away.
Perhaps this issue is fixed but the linked issue is not really a duplicate.
> bug using distributed search, highlighting and q.alt
> ----------------------------------------------------
>
> Key: SOLR-1901
> URL: https://issues.apache.org/jira/browse/SOLR-1901
> Project: Solr
> Issue Type: Bug
> Components: SearchComponents - other
> Affects Versions: 1.5
> Reporter: Marc Sturlese
> Priority: Minor
> Fix For: 3.1
>
>
> 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)));
> }
> }
> }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org