Class BlockGroupingCollector
BlockGroupingCollector performs grouping with a
single pass collector, as long as you are grouping by a
doc block field, ie all documents sharing a given group
value were indexed as a doc block using the atomic
This results in faster performance (~25% faster QPS)
than the two-pass grouping collectors, with the tradeoff
being that the documents in each group must always be
indexed as a block. This collector also fills in
TopGroups.totalGroupCount without requiring the separate
Term
NOTE
: this collector makes no effort to verify
the docs were in fact indexed as a block, so it's up to
you to ensure this was the case.
See org.apache.lucene.search.grouping for more details including a full code example.
Inheritance
Implements
Namespace: Lucene.Net.Search.Grouping
Assembly: Lucene.Net.Grouping.dll
Syntax
public class BlockGroupingCollector : object, ICollector
Constructors
| Improve this Doc View SourceBlockGroupingCollector(Sort, Int32, Boolean, Filter)
Create the single pass collector.
Declaration
public BlockGroupingCollector(Sort groupSort, int topNGroups, bool needsScores, Filter lastDocPerGroup)
Parameters
Type | Name | Description |
---|---|---|
Sort | groupSort | The 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 RELEVANCE. |
System. |
topNGroups | How many top groups to keep. |
System. |
needsScores | true if the collected documents
require scores, either because relevance is included
in the withinGroupSort or because you plan to pass true
for either GetScores or GetMaxScores to Get |
Filter | lastDocPerGroup | a Filter that marks the last document in each group. |
Properties
| Improve this Doc View SourceAcceptsDocsOutOfOrder
Declaration
public virtual bool AcceptsDocsOutOfOrder { get; }
Property Value
Type | Description |
---|---|
System. |
Methods
| Improve this Doc View SourceCollect(Int32)
Declaration
public virtual void Collect(int doc)
Parameters
Type | Name | Description |
---|---|---|
System. |
doc |
GetTopGroups(Sort, Int32, Int32, Int32, Boolean)
Returns the grouped results. Returns null if the number of groups collected is <= groupOffset.
NOTE: This collector is unable to compute the groupValue per group so it will always be null. This is normally not a problem, as you can obtain the value just like you obtain other values for each matching document (eg, via stored fields, via FieldCache, etc.)
Declaration
public virtual ITopGroups<object> GetTopGroups(Sort withinGroupSort, int groupOffset, int withinGroupOffset, int maxDocsPerGroup, bool fillSortFields)
Parameters
Type | Name | Description |
---|---|---|
Sort | withinGroupSort | The Sort used to sort documents within each group. Passing null is allowed, to sort by relevance. |
System. |
groupOffset | Which group to start from |
System. |
withinGroupOffset | Which document to start from within each group |
System. |
maxDocsPerGroup | How many top documents to keep within each group. |
System. |
fillSortFields | If true then the Comparable values for the sort fields will be set |
Returns
Type | Description |
---|---|
ITop |
GetTopGroups<TGroupValue>(Sort, Int32, Int32, Int32, Boolean)
Returns the grouped results. Returns null if the number of groups collected is <= groupOffset.
NOTE: This collector is unable to compute the groupValue per group so it will always be null. This is normally not a problem, as you can obtain the value just like you obtain other values for each matching document (eg, via stored fields, via FieldCache, etc.)
Declaration
public virtual ITopGroups<TGroupValue> GetTopGroups<TGroupValue>(Sort withinGroupSort, int groupOffset, int withinGroupOffset, int maxDocsPerGroup, bool fillSortFields)
Parameters
Type | Name | Description |
---|---|---|
Sort | withinGroupSort | The Sort used to sort documents within each group. Passing null is allowed, to sort by relevance. |
System. |
groupOffset | Which group to start from |
System. |
withinGroupOffset | Which document to start from within each group |
System. |
maxDocsPerGroup | How many top documents to keep within each group. |
System. |
fillSortFields | If true then the Comparable values for the sort fields will be set |
Returns
Type | Description |
---|---|
ITop |
Type Parameters
Name | Description |
---|---|
TGroupValue | The expected return type for group value |
SetNextReader(AtomicReaderContext)
Declaration
public virtual void SetNextReader(AtomicReaderContext context)
Parameters
Type | Name | Description |
---|---|---|
Atomic |
context |
SetScorer(Scorer)
Declaration
public virtual void SetScorer(Scorer scorer)
Parameters
Type | Name | Description |
---|---|---|
Scorer | scorer |