Class TermAllGroupsCollector
A collector that collects all groups that match the query. Only the group value is collected, and the order is undefined. This collector does not determine the most relevant document of a group.
Implementation detail: an int hash set (SentinelIntSet) is used to detect if a group is already added to the total count. For each segment the int set is cleared and filled with previous counted groups that occur in the new segment.
Note
This API is experimental and might change in incompatible ways in the next release.
Inherited Members
Namespace: Lucene.Net.Search.Grouping.Terms
Assembly: Lucene.Net.Grouping.dll
Syntax
public class TermAllGroupsCollector : AbstractAllGroupsCollector<BytesRef>, IAbstractAllGroupsCollector<BytesRef>, ICollector
Constructors
TermAllGroupsCollector(string)
Constructs a AbstractAllGroupsCollector<TGroupValue>. This sets the initial allocation size for the internal int set and group list to 128.
Declaration
public TermAllGroupsCollector(string groupField)
Parameters
Type | Name | Description |
---|---|---|
string | groupField | The field to group by |
TermAllGroupsCollector(string, int)
Expert: Constructs a AbstractAllGroupsCollector<TGroupValue>
Declaration
public TermAllGroupsCollector(string groupField, int initialSize)
Parameters
Type | Name | Description |
---|---|---|
string | groupField | The field to group by |
int | initialSize | The initial allocation size of the internal int set and group list which should roughly match the total number of expected unique groups. Be aware that the heap usage is 4 bytes * initialSize. |
Properties
Groups
Returns the group values
This is an unordered collections of group values. For each group that matched the query there is a Lucene.Net.Util.BytesRef representing a group value.
Declaration
public override IEnumerable<BytesRef> Groups { get; }
Property Value
Type | Description |
---|---|
IEnumerable<BytesRef> | the group values |
Overrides
Methods
Collect(int)
Called once for every document matching a query, with the unbased document number.
Note: The collection of the current segment can be terminated by throwing a Lucene.Net.Search.CollectionTerminatedException. In this case, the last docs of the current Lucene.Net.Index.AtomicReaderContext will be skipped and Lucene.Net.Search.IndexSearcher will swallow the exception and continue collection with the next leaf. Note: this is called in an inner search loop. For good search performance, implementations of this method should not call Doc(int) or Document(int) on every hit. Doing so can slow searches by an order of magnitude or more.Declaration
public override void Collect(int doc)
Parameters
Type | Name | Description |
---|---|---|
int | doc |
Overrides
SetNextReader(AtomicReaderContext)
Called before collecting from each Lucene.Net.Index.AtomicReaderContext. All doc ids in Collect(int) will correspond to Lucene.Net.Index.IndexReaderContext.Reader.
Add Lucene.Net.Index.AtomicReaderContext.DocBase to the current Lucene.Net.Index.IndexReaderContext.Reader's internal document id to re-base ids in Collect(int).
Declaration
public override void SetNextReader(AtomicReaderContext context)
Parameters
Type | Name | Description |
---|---|---|
AtomicReaderContext | context | next atomic reader context |