【问题标题】:solr: group by multi valued fieldsolr:按多值字段分组
【发布时间】:2016-01-28 14:48:59
【问题描述】:

我有一个 solr 文档结构

   [
     {
       category:{mobiles},
       name: iphone,
       store: chroma,
       discount: 10%
     },
    {
       category:{mobiles,laptops},
       name: Apple,
       store: Reliance Digitals,
       discount: 12%
     },{
       category:{electornics},
       name: Boss,
       store: chroma,
       discount: 5%
     },{
       category:{headphones,mobiles},
       name: Samsung,
       store: Universal,
       discount: 8%
     },{
       category:{headphones},
       name: HTC,
       store: Chroma,
       discount: 50%
     },
    ]

我需要一个带有响应的 solr 查询

{
  headphones: 2
  mobiles: 3
  laptops: 1
  electornics: 1
}

简单地说,我需要一个多值字段的组计数。

请帮帮我。

谢谢。

【问题讨论】:

    标签: solr group-by faceted-search multivalue


    【解决方案1】:

    试试这个:

    ?q=*:*&facet=true&facet.field=category
    

    确保多值字段已编入索引。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-11-28
      • 1970-01-01
      • 2014-05-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多