When creating a group by query using the documentation example for springboot data-solr and SolrTemplate, I receive results but there is no grouping information. When looking at the sample code:
Field field = new SimpleField("popularity");
Function func = ExistsFunction.exists("description");
Query query = new SimpleQuery("inStock:true");
SimpleQuery groupQuery = new SimpleQuery(new SimpleStringCriteria("*:*"));
GroupOptions groupOptions = new GroupOptions()
.addGroupByField(field)
.addGroupByFunction(func)
.addGroupByQuery(query);
groupQuery.setGroupOptions(groupOptions);
GroupPage<Product> page = solrTemplate.queryForGroupPage("collection-1", query, Product.class);
GroupResult<Product> fieldGroup = page.getGroupResult(field);
GroupResult<Product> funcGroup = page.getGroupResult(func);
GroupResult<Product> queryGroup = page.getGroupResult(query);
It appears that a group query is created however the call to queryForGroupPage does not use it which would explain why I do not receive any grouping information. If I instead pass in the groupQuery object to the call then i receive a "Page Must Not Be Null" error.
I have tested other query types and have not had this error so it seems it is just affecting this one function for me. I have tried using an older springboot version and an older Solr version, matching the two, and the same issue happens.
I have not had any other Solr issues with the setup so do not think i am missing anything in my config.
The following is a snippet of the stacktrace for the error.
11:15:14,323 ERROR [stderr] (default task-1) java.lang.IllegalArgumentException: Pageable must not be null! 11:15:14,325 ERROR [stderr] (default task-1) at org.springframework.util.Assert.notNull(Assert.java:198) 11:15:14,326 ERROR [stderr] (default task-1) at org.springframework.data.domain.Chunk.(Chunk.java:54) 11:15:14,327 ERROR [stderr] (default task-1) at org.springframework.data.domain.PageImpl.(PageImpl.java:46) 11:15:14,328 ERROR [stderr] (default task-1) at org.springframework.data.solr.core.ResultHelper.convertGroupQueryResponseToGroupResultMap(ResultHelper.java:306) 11:15:14,329 ERROR [stderr] (default task-1) at org.springframework.data.solr.core.SolrTemplate.createSolrResultPage(SolrTemplate.java:448) 11:15:14,330 ERROR [stderr] (default task-1) at org.springframework.data.solr.core.SolrTemplate.doQueryForPage(SolrTemplate.java:305) 11:15:14,330 ERROR [stderr] (default task-1) at org.springframework.data.solr.core.SolrTemplate.queryForGroupPage(SolrTemplate.java:357) 11:15:14,331 ERROR [stderr] (default task-1) at org.springframework.data.solr.core.SolrTemplate.queryForGroupPage(SolrTemplate.java:346) ...
Has anyone seen a working example of the group by functionality? I have also searched for anything and can't find a reference outside of the sample code from the official documentation.
Thanks,enter code here