如何在Lucene搜索结果中进行分组? [英] How to do grouping in Lucene search results?
本文介绍了如何在Lucene搜索结果中进行分组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将Lucene返回的搜索结果按字段分组(类似于SQL Server)?
How do I group search results returned by Lucene by fields (similar to SQL Server's)?
推荐答案
Lucene 3.4现在支持多面搜索.在编制索引时,您可以指定一些补充内容;在搜索时,您可以按查询和按组进行搜索.
Lucene 3.4 now supports faceted search. At indexing you specify something supplementary and at search time you search by query and by groups.
对于接下来的3个文档,您将这些组编入索引
for next 3 docs, that you index with these groups
doc1: monday, 1pm, 3min
doc2: monday, 1pm, 4min
doc3: monday, 2pm, 3min
您只能搜索第一个参数:星期一,并获得值:3, 或者,您可以向下钻取并搜索星期一/1pm并获得价值:2 或设置搜索深度3并获得
you can search only for the first param: monday, and get value:3, or you can drill down and search for monday/1pm and get value:2 or set depth of search 3 and get
monday :3
monday/1pm :2
monday/1pm/3min :1
monday/1pm/4min :1
monday/2pm :1
monday/2pm/3min :1
But most of all readfaceted search
这篇关于如何在Lucene搜索结果中进行分组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文