Class AbstractSecondPassGroupingCollector<TGroupValue>
SecondPassGroupingCollector is the second of two passes necessary to collect grouped docs. This pass gathers the top N documents per top group computed from the first pass. Concrete subclasses define what a group is and how it is internally collected.
See org.apache.lucene.search.grouping for more details including a full code example.
Note
This API is experimental and might change in incompatible ways in the next release.
Inheritance
Inherited Members
Namespace: Lucene.Net.Search.Grouping
Assembly: Lucene.Net.Grouping.dll
Syntax
public abstract class AbstractSecondPassGroupingCollector<TGroupValue> : IAbstractSecondPassGroupingCollector<TGroupValue>, ICollector
Type Parameters
Name | Description |
---|---|
TGroupValue |
Constructors
AbstractSecondPassGroupingCollector(IEnumerable<ISearchGroup<TGroupValue>>, Sort, Sort, int, bool, bool, bool)
SecondPassGroupingCollector is the second of two passes necessary to collect grouped docs. This pass gathers the top N documents per top group computed from the first pass. Concrete subclasses define what a group is and how it is internally collected.
See org.apache.lucene.search.grouping for more details including a full code example.
Note
This API is experimental and might change in incompatible ways in the next release.
Declaration
protected AbstractSecondPassGroupingCollector(IEnumerable<ISearchGroup<TGroupValue>> groups, Sort groupSort, Sort withinGroupSort, int maxDocsPerGroup, bool getScores, bool getMaxScores, bool fillSortFields)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<ISearchGroup<TGroupValue>> | groups | |
Sort | groupSort | |
Sort | withinGroupSort | |
int | maxDocsPerGroup | |
bool | getScores | |
bool | getMaxScores | |
bool | fillSortFields |
Fields
m_groupDocs
SecondPassGroupingCollector is the second of two passes necessary to collect grouped docs. This pass gathers the top N documents per top group computed from the first pass. Concrete subclasses define what a group is and how it is internally collected.
See org.apache.lucene.search.grouping for more details including a full code example.
Note
This API is experimental and might change in incompatible ways in the next release.
Declaration
protected AbstractSecondPassGroupingCollector.SearchGroupDocs<TGroupValue>[] m_groupDocs
Field Value
Type | Description |
---|---|
SearchGroupDocs<TGroupValue>[] |
m_groupMap
SecondPassGroupingCollector is the second of two passes necessary to collect grouped docs. This pass gathers the top N documents per top group computed from the first pass. Concrete subclasses define what a group is and how it is internally collected.
See org.apache.lucene.search.grouping for more details including a full code example.
Note
This API is experimental and might change in incompatible ways in the next release.
Declaration
protected readonly IDictionary<TGroupValue, AbstractSecondPassGroupingCollector.SearchGroupDocs<TGroupValue>> m_groupMap
Field Value
Type | Description |
---|---|
IDictionary<TGroupValue, AbstractSecondPassGroupingCollector.SearchGroupDocs<TGroupValue>> |
Properties
AcceptsDocsOutOfOrder
Return true
if this collector does not
require the matching docIDs to be delivered in int sort
order (smallest to largest) to Collect(int).
Most Lucene Query implementations will visit matching docIDs in order. However, some queries (currently limited to certain cases of Lucene.Net.Search.BooleanQuery) can achieve faster searching if the Lucene.Net.Search.ICollector allows them to deliver the docIDs out of order.
Many collectors don't mind getting docIDs out of
order, so it's important to return true
here.
Declaration
public virtual bool AcceptsDocsOutOfOrder { get; }
Property Value
Type | Description |
---|---|
bool |
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 virtual void Collect(int doc)
Parameters
Type | Name | Description |
---|---|---|
int | doc |
GetTopGroups(int)
SecondPassGroupingCollector is the second of two passes necessary to collect grouped docs. This pass gathers the top N documents per top group computed from the first pass. Concrete subclasses define what a group is and how it is internally collected.
See org.apache.lucene.search.grouping for more details including a full code example.
Note
This API is experimental and might change in incompatible ways in the next release.
Declaration
public virtual ITopGroups<TGroupValue> GetTopGroups(int withinGroupOffset)
Parameters
Type | Name | Description |
---|---|---|
int | withinGroupOffset |
Returns
Type | Description |
---|---|
ITopGroups<TGroupValue> |
RetrieveGroup(int)
Returns the group the specified doc belongs to or null
if no group could be retrieved.
Declaration
protected abstract AbstractSecondPassGroupingCollector.SearchGroupDocs<TGroupValue> RetrieveGroup(int doc)
Parameters
Type | Name | Description |
---|---|---|
int | doc | The specified doc |
Returns
Type | Description |
---|---|
AbstractSecondPassGroupingCollector.SearchGroupDocs<TGroupValue> | the group the specified doc belongs to or |
Exceptions
Type | Condition |
---|---|
IOException | If an I/O related error occurred |
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 virtual void SetNextReader(AtomicReaderContext context)
Parameters
Type | Name | Description |
---|---|---|
AtomicReaderContext | context | next atomic reader context |
SetScorer(Scorer)
Called before successive calls to Collect(int). Implementations
that need the score of the current document (passed-in to
Collect(int)), should save the passed-in Lucene.Net.Search.Scorer and call
scorer.GetScore()
when needed.
Declaration
public virtual void SetScorer(Scorer scorer)
Parameters
Type | Name | Description |
---|---|---|
Scorer | scorer |