By the way: if you only need to count documents (count groups) HitCollector is a good choice. If you only count you don't need to sort anything.
ninaS wrote: > > Hello, > > yes I tried HitCollector but I am not satisfied with it because you can > not use sorting with HitCollector unless you implement a way to use > TopFieldTocCollector. I did not manage to do that in a performant way. > > It is easier to first do a normal search und "group by" afterwards: > > Iterate through the result documents and take one of each group. Each > document has a groupingKey. I remember which groupingKey is already used > and don't take another document of this group into the result list. > > Regards, > Nina > -- View this message in context: http://www.nabble.com/Group-by-in-Lucene---tp13581760p21702742.html Sent from the Lucene - Java Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org