1. 程式人生 > >Solr --- Group查詢與Facet區別

Solr --- Group查詢與Facet區別

簡介

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查詢舉例

查詢結果是根據主查詢條件得出的。facet是聚類後的資訊,跟查詢條件是分開的,查詢結果跟facet沒關係。

查詢結果:

Group查詢舉例

查詢條件跟group相關的,返回的查詢結果跟group也是相關的,group中有相關文件的詳細資訊。

查詢結果:
這裡寫圖片描述