Hi,

I'm using solr 4.8.1and with following scenario I got a null pointer exception:


1.       I'm trying to search over multi-cores and group search.

2.       SearchHandler is called and when executing
        for(SearchComponent c : components) {
                         c.finishStage(rb);
        }


3.       With QueryComponent.finishStage, this code is called:

    if (rb.grouping()) {
      groupedFinishStage(rb);
    } else {
      regularFinishStage(rb);
    }

4.       And then -

  private void groupedFinishStage(final ResponseBuilder rb) {

    // To have same response as non-distributed request.

    GroupingSpecification groupSpec = rb.getGroupingSpec();

    if (rb.mergedTopGroups.isEmpty()) {

      for (String field : groupSpec.getFields()) {

        rb.mergedTopGroups.put(field, new TopGroups(null, null, 0, 0, new 
GroupDocs[]{}, Float.NaN));

      }

      rb.resultIds = new HashMap<>();

    }


5.       As you can see the marked line is initializing resultsIds.

6.       And then when get to HighlightComponent.finishStage in and trying to 
execute:

            ShardDoc sdoc = rb.resultIds.get(id);

            int idx = sdoc.positionInResponse;

            arr[idx] = new NamedList.NamedListEntry<>(id, hl.getVal(i));

7.       resultsIds is empty and then sdoc.positionInResponse get a null 
pointer exception.

Hope that my description is clear.

Thanks,
Shay.

Reply via email to