lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrey Strizhkin (JIRA)" <j...@apache.org>
Subject [jira] Commented: (SOLR-2121) distributed highlighting using q.alt=*:* causes NPE in finishStages
Date Wed, 06 Oct 2010 20:07:30 GMT

    [ https://issues.apache.org/jira/browse/SOLR-2121?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12918650#action_12918650
] 

Andrey Strizhkin commented on SOLR-2121:
----------------------------------------

This fix only avoid NPE but highlighting doesn't work. 

Improved fix that works for me:
{code}
public void finishStage(ResponseBuilder rb) {
    boolean hasHighlighting = false;
    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) {
            hasHighlighting = true;
            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));
            }
          } 
        }
      }

      // remove nulls in case not all docs were able to be retrieved
      //patch bug
      if(hasHighlighting) {
        rb.rsp.add("highlighting", removeNulls(new SimpleOrderedMap(arr)));
      }
    }
  }
{code}

> distributed highlighting using q.alt=*:* causes NPE in finishStages
> -------------------------------------------------------------------
>
>                 Key: SOLR-2121
>                 URL: https://issues.apache.org/jira/browse/SOLR-2121
>             Project: Solr
>          Issue Type: Bug
>            Reporter: Hoss Man
>
> As noted on the mailing list by Ron Mayer,  using the example configs and example data
on trunk, this query works...
> http://localhost:8983/solr/select?q.alt=*:*&hl=on&defType=edismax
> ...but this query causes and NullPointerException...
> http://localhost:8983/solr/select?q.alt=*:*&hl=on&defType=edismax&shards=localhost:8983/solr
> Stack Trace...
> {noformat}
> java.lang.NullPointerException
> 	at org.apache.solr.handler.component.HighlightComponent.finishStage(HighlightComponent.java:158)
> 	at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:310)
> 	at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:131)
> 	at org.apache.solr.core.SolrCore.execute(SolrCore.java:1324)
> 	at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:337)
> 	at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:240)
> 	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
> {noformat}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


Mime
View raw message