You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Dmitry Kan <so...@gmail.com> on 2015/01/15 12:14:30 UTC

groups inside groups

Hi solr users & developers,

Is it possible to group inside the group? First level is a group query, the
second level is a single value field of each document inside the first
level group with counts.

I.e. the trick is, that the second level should contain facet counts on
values of that single value field.

To illustrate:

First level: query:

Field1:[* TO *] AND Field2:[* TO *]

group.field = UserId

Result:
'grouped'=>{
    'UserId'=>{
      'matches'=>22154,
      'groups'=>[]},
    'Field1:[* TO *] AND Field2:[* TO *]'=>{
      'matches'=>22154,
      'doclist'=>{'numFound'=>1282,'start'=>0,'docs'=>[
          {
            'UserId'=>255},
          {
            'UserId'=>3042},
          {
            'UserId'=>3428},
          {
            'UserId'=>255},
          {
            'UserId'=>3042},
          {
            'UserId'=>3042},
          {
            'UserId'=>68},
          {
            'UserId'=>68},
          {
            'UserId'=>68},
          {
            'UserId'=>68}]
 }}}


Desired output:

'grouped'=>{
    'UserId'=>{
      'matches'=>22154,
      'groups'=>[]},
    'Field1:[* TO *] AND Field2:[* TO *]'=>{
      'matches'=>22154,
      'doclist'=>{'numFound'=>1282,'start'=>0,'docs'=>[
          {
            '255'=>2},
          {
            '3042'=>3},
          {
            '3428'=>1},
          {
            '68'=>4}]
 }}}



-- 
Dmitry Kan
Luke Toolbox: http://github.com/DmitryKey/luke
Blog: http://dmitrykan.blogspot.com
Twitter: http://twitter.com/dmitrykan
SemanticAnalyzer: www.semanticanalyzer.info