lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roman SlavĂ­k <slaav...@gmail.com>
Subject [Solrj 4.0] No group response
Date Fri, 30 Nov 2012 13:17:18 GMT
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

Mime
View raw message