Solr
  1. Solr
  2. SOLR-1901

bug using distributed search, highlighting and q.alt

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.5
    • Fix Version/s: 3.1
    • Labels:
      None

      Description

      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))); }

      }
      }

        Activity

        Hide
        Dylan Etkin added a comment -

        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.

        Show
        Dylan Etkin added a comment - 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.
        Hide
        Marc Sturlese added a comment - - edited

        Thanks Koji, this properly fix my problem. I'm going to close this issue

        Show
        Marc Sturlese added a comment - - edited Thanks Koji, this properly fix my problem. I'm going to close this issue
        Hide
        Koji Sekiguchi added a comment -

        Marc, I recently committed SOLR-2148. I'm not sure it fixes your problem, but can you try the latest 3x or trunk to see if it solves your problem?

        Show
        Koji Sekiguchi added a comment - Marc, I recently committed SOLR-2148 . I'm not sure it fixes your problem, but can you try the latest 3x or trunk to see if it solves your problem?
        Hide
        Hoss Man added a comment -

        Bulk updating 240 Solr issues to set the Fix Version to "next" per the process outlined in this email...

        http://mail-archives.apache.org/mod_mbox/lucene-dev/201005.mbox/%3Calpine.DEB.1.10.1005251052040.24672@radix.cryptio.net%3E

        Selection criteria was "Unresolved" with a Fix Version of 1.5, 1.6, 3.1, or 4.0. email notifications were suppressed.

        A unique token for finding these 240 issues in the future: hossversioncleanup20100527

        Show
        Hoss Man added a comment - Bulk updating 240 Solr issues to set the Fix Version to "next" per the process outlined in this email... http://mail-archives.apache.org/mod_mbox/lucene-dev/201005.mbox/%3Calpine.DEB.1.10.1005251052040.24672@radix.cryptio.net%3E Selection criteria was "Unresolved" with a Fix Version of 1.5, 1.6, 3.1, or 4.0. email notifications were suppressed. A unique token for finding these 240 issues in the future: hossversioncleanup20100527

          People

          • Assignee:
            Unassigned
            Reporter:
            Marc Sturlese
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development