简体   繁体   English

SOLR:如何获取分组结果的所有值

[英]SOLR: how to get all values of grouped results

I'm using SOLR 4.7.x. 我正在使用SOLR4.7.x。 I need help with this simple task. 我需要这个简单任务的帮助。 Here's my data: 这是我的数据:

=======================
| Id | Code | Faculty |
=======================
| 1  | UK   | A |
| 2  | UK   | B |
...
| 10 | CVUT | K |
| 11 | CVUT | L |
| 12 | CVUT | M |
...

and when I'm grouping by code , the result is correct, but I need to get the list (for example concatenated with '|') like: 当我按code分组时,结果是正确的,但是我需要获取列表(例如,与“ |”连接):

groups : [
    {
        doclist: {
            numFound: 2,
            docs: [
                {
                    id: 1,
                    code: UK,
                    faculty: A,
                    groupConcatenated: A|B,
                }
            ]
        }
    },
    {
        doclist: {
            numFound: 3,
            docs: [
                {
                    id: 10,
                    code: CVUT,
                    faculty: K,
                    groupConcatenated: K|L|M,
                }
            ]
        }
    }
]

Simply I need to see what is grouped... 我只需要查看分组的内容...

In PostgreSQL it's as simple as: array_to_string(array_agg(faculty), ',') as groupConcatenated 在PostgreSQL中,它很简单: array_to_string(array_agg(faculty), ',') as groupConcatenated

您可能正在寻找Pivot Faceting ,它将允许您获取层次结构中每个步骤的每个唯一值的计数。

&facet=true&facet.pivot=code,Faculty

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM