[ 
https://issues.apache.org/jira/browse/SOLR-7046?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jim Musil updated SOLR-7046:
----------------------------
    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:

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

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.


  was:
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:

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

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.



> NullPointerException when group.function uses query() function
> --------------------------------------------------------------
>
>                 Key: SOLR-7046
>                 URL: https://issues.apache.org/jira/browse/SOLR-7046
>             Project: Solr
>          Issue Type: Bug
>          Components: search
>    Affects Versions: 4.10.3
>            Reporter: Jim Musil
>
> 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:
> {code:title=Grouping.java}
>     protected void prepare() throws IOException {
>       Map context = ValueSource.newContext(searcher);
>       groupBy.createWeight(context, searcher);
>       actualGroupsToFind = getMax(offset, numGroups, maxDoc);
>     }
> {code}
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to