Class TermFirstPassGroupingCollector
Concrete implementation of AbstractFirstPassGroupingCollector<TGroupValue> that groups based on field values and more specifically uses Lucene.Net.Index.SortedDocValues to collect groups.
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 TermFirstPassGroupingCollector : AbstractFirstPassGroupingCollector<BytesRef>, IAbstractFirstPassGroupingCollector<BytesRef>, ICollector
Constructors
TermFirstPassGroupingCollector(string, Sort, int)
Create the first pass collector.
Declaration
public TermFirstPassGroupingCollector(string groupField, Sort groupSort, int topNGroups)
Parameters
Type | Name | Description |
---|---|---|
string | groupField | The field used to group documents. This field must be single-valued and indexed (Lucene.Net.Search.FieldCache is used to access its value per-document). |
Sort | groupSort | The Lucene.Net.Search.Sort used to sort the groups. The top sorted document within each group according to groupSort, determines how that group sorts against other groups. This must be non-null, ie, if you want to groupSort by relevance use Lucene.Net.Search.Sort.RELEVANCE. |
int | topNGroups | How many top groups to keep. |
Exceptions
Type | Condition |
---|---|
IOException | When I/O related errors occur |
Methods
CopyDocGroupValue(BytesRef, BytesRef)
Returns a copy of the specified group value by creating a new instance and copying the value from the specified groupValue in the new instance. Or optionally the reuse argument can be used to copy the group value in.
Declaration
protected override BytesRef CopyDocGroupValue(BytesRef groupValue, BytesRef reuse)
Parameters
Type | Name | Description |
---|---|---|
BytesRef | groupValue | The group value to copy |
BytesRef | reuse | Optionally a reuse instance to prevent a new instance creation |
Returns
Type | Description |
---|---|
BytesRef | a copy of the specified group value |
Overrides
GetDocGroupValue(int)
Returns the group value for the specified doc.
Declaration
protected override BytesRef GetDocGroupValue(int doc)
Parameters
Type | Name | Description |
---|---|---|
int | doc | The specified doc |
Returns
Type | Description |
---|---|
BytesRef | the group value for the specified 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 |