Hi guys,
I have problem with grouping in Solr 4.0 using Solrj api. I need this:
search some documents limited with solr query, group them by one field
and return total count of groups.
There is param 'group.ngroups' for adding groups count into group
response. Sounds easy, so I wrote something like this:
SolrQuery query = new SolrQuery().setQuery(queryString);
query.addField("score");
query.setParam(GroupParams.GROUP, true);
query.setParam(GroupParams.GROUP_MAIN, true);
query.setParam(GroupParams.GROUP_FIELD, "group_field");
query.setParam(GroupParams.GROUP_LIMIT, "1");
query.setParam(GroupParams.GROUP_TOTAL_COUNT, true);
QueryResponse response =
solrServer.query(query); // contains found docs
GroupResponse groupResponse = response.getGroupResponse(); // null
Search result is ok, QueryResponse contains docs I searched for. But
group response is always null. Did I miss something, some magic
parameter for enabling group response?
Thanks for any advice
Roman