lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marc Sturlese (JIRA)" <>
Subject [jira] Created: (SOLR-1901) bug using distributed search, highlighting and q.alt
Date Mon, 03 May 2010 15:50:56 GMT
bug using distributed search, highlighting and q.alt

                 Key: SOLR-1901
             Project: Solr
          Issue Type: Bug
          Components: SearchComponents - other
    Affects Versions: 1.5
            Reporter: Marc Sturlese
            Priority: Minor
             Fix For: 1.5

I have noticed when using q.alt even if hl=true highlights are not returned.
When using distributed search, q.alt and hl,
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:

  public void finishStage(ResponseBuilder rb) {
    boolean hasHighlighting = true ;
    if (rb.doHighlights && rb.stage == ResponseBuilder.STAGE_GET_FIELDS) {

      Map.Entry<String, Object>[] arr = new

      // TODO: make a generic routine to do automatic merging of id keyed
      for (ShardRequest sreq : rb.finished) {
        if ((sreq.purpose & ShardRequest.PURPOSE_GET_HIGHLIGHTS) == 0)
        for (ShardResponse srsp : sreq.responses) {
          NamedList hl =
          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,
          } 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.
You can reply to this email to add a comment to the issue online.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message