开发者

Lucene distinct result

Please, help me get distinct result by certain field. I tried go by the many way, googled... But can't get ti.

I tried add to HashSet, tried DuplicateFilter. Think about Collector without success. But any result. I use Java, lucene-2.9.3.

Example:

some_id   description
1         bbb aaa 
1         aaa ccc
2         aaa ddd
2         fff aaa 

And if I search by开发者_开发百科 description in result I must get distinct some_id (1,2).

Maybe somebody have solution or have code example.

Thanks to advance.


The very-new (still only a patch) grouping module on https://issues.apache.org/jira/browse/LUCENE-1421 might be relevant here. It enables you to group all hits according to a certain field. For example, if you group by "author" then all documents having the same author are in the same group.


As far as I know, there is no "native distinct" support in lucene. So you have to write your own logic in java to consolidate the results.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜