陋室铭
永远也不要停下学习的脚步(大道至简至易)

简介

facet的查询结果主要是分组信息:有什么分组,每个分组包括多少记录;但是分组中有哪些数据是不可知道的,只有进一步搜索。
group则类似于关系数据库的group by,可以用于一个或者几个字段去重、显示一个group的前几条记录等。

来自solr ref guide的解释:
Result Grouping groups documents with a common field value into groups and returns the top documents for
each group.
Result Grouping is separate from Faceting. Though it is conceptually similar, faceting returns all relevant results
and allows the user to refine the results based on the facet category. For example, if you search for “shoes” on a
footwear retailer’s e-commerce site, Solr would return all results for that query term, along with selectable facets
such as “size,” “color,” “brand,” and so on.

Facet查询举例

查询语法:
http://localhost:8080/solr/JobsOtherWeb0/select?q=jobsName%3A%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%BB%B4%E6%8A%A4&facet=true&facet.field=salary&facet.field=publishDate&facet.field=educateBackground&facet.field=jobExperience&facet.field=companytype&facet.field=jobsType&facet.limit=10&facet.missing=false&facet.mincount=1

查询结果是根据主查询条件得出的。facet是聚类后的信息,跟查询条件是分开的,查询结果跟facet没关系。

查询结果:

Group查询举例

查询语法:
http://localhost:8080/solr/JobsOtherWeb0/select?q=jobsName%3A%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%BB%B4%E6%8A%A4&group=true&group.field=salary&group.limit=1&rows=10

查询条件跟group相关的,返回的查询结果跟group也是相关的,group中有相关文档的详细信息。

查询结果:
这里写图片描述

posted on 2018-07-31 14:04  宏宇  阅读(705)  评论(0编辑  收藏  举报