Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-7046

NullPointerException when group.function uses query() function

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.10.3
    • 5.1, 6.0
    • search
    • None

    Description

      When you attempt to group by function using the query() function, it results in an NullPointerException.

      Using the example webapp loaded with the hd.xml file in exampledocs, you can recreate by issuing the following query:

      http://localhost:8983/solr/select/?q=*:*&group=true&group.func=ceil(query(

      {!type=edismax%20v=$q}

      ))

      This appears to be due to a small bug in the following file:

      Grouping.java
          protected void prepare() throws IOException {
            Map context = ValueSource.newContext(searcher);
            groupBy.createWeight(context, searcher);
            actualGroupsToFind = getMax(offset, numGroups, maxDoc);
          }
      

      The variable context is always null because it's scope is local to this function, but it gets passed on to another function later.

      The patch is simply removing the Map qualifier from the instantiation.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            erickerickson Erick Erickson
            jimtronic Jim Musil
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment