lucenenet-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julian Ohrt <>
Subject TermDistinctValuesCollector
Date Tue, 08 Nov 2016 07:43:19 GMT

I am trying to use the class TermDistinctValuesCollector from Core namespace Lucene.Net.Search.Grouping.
I found a short explanation for the three parameters of the constructor:

groupField - The field to group by
countField - The field to count distinct values for
groups - The top N groups, collected during the first phase search

I am still not sure what the group is (is it the field for which the content is counted?),
why a lucene field is needed for counting, and what the "first phase search" is.
I tried something like this:

Collection<GroupCount> groups = new Collection<GroupCount>();
TermDistinctValuesCollector collector = new TermDistinctValuesCollector("groupField", "countField",
mIndexSearcher.Search(query, null, collector);

Of course to no avail. Groups is empty. It did give me any result at all.

Is there any documentation I missed? I did not even find any second hit for "TermDistinctValuesCollector"
in the lucenenet repository except for TermDistinctValuesCollector.cs itself. Not even a unit

A short example how to use it would be awesome. But I'd also like to understand how it works
(should work) internally. What are member variables ordSet, groupFieldTermIndex, etc. used
for? Not knowing the internals of lucene I just don't understand the source code.

Thanks a lot!

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message