• API

    Show / Hide Table of Contents

    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 AddDocuments(IEnumerable<IEnumerable<IIndexableField>>, Analyzer) or UpdateDocuments(Term, IEnumerable<IEnumerable<IIndexableField>>, Analyzer) API.

    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 TermAllGroupsCollector. However, this collector does not fill in the groupValue of each group; this field will always be null.

    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.

    This is a Lucene.NET EXPERIMENTAL API, use at your own risk
    Inheritance
    System.Object
    BlockGroupingCollector
    Implements
    Lucene.Net.Search.ICollector
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Lucene.Net.Search.Grouping
    Assembly: Lucene.Net.Grouping.dll
    Syntax
    public class BlockGroupingCollector : ICollector

    Constructors

    | Improve this Doc View Source

    BlockGroupingCollector(Sort, Int32, Boolean, Filter)

    Create the single pass collector.

    Declaration
    public BlockGroupingCollector(Sort groupSort, int topNGroups, bool needsScores, Filter lastDocPerGroup)
    Parameters
    Type Name Description
    Lucene.Net.Search.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 RELEVANCE.

    System.Int32 topNGroups

    How many top groups to keep.

    System.Boolean 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 GetTopGroups(Sort, Int32, Int32, Int32, Boolean)

    Lucene.Net.Search.Filter lastDocPerGroup

    a Lucene.Net.Search.Filter that marks the last document in each group.

    Properties

    | Improve this Doc View Source

    AcceptsDocsOutOfOrder

    Declaration
    public virtual bool AcceptsDocsOutOfOrder { get; }
    Property Value
    Type Description
    System.Boolean

    Methods

    | Improve this Doc View Source

    Collect(Int32)

    Declaration
    public virtual void Collect(int doc)
    Parameters
    Type Name Description
    System.Int32 doc
    | Improve this Doc View Source

    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
    Lucene.Net.Search.Sort withinGroupSort

    The Lucene.Net.Search.Sort used to sort documents within each group. Passing null is allowed, to sort by relevance.

    System.Int32 groupOffset

    Which group to start from

    System.Int32 withinGroupOffset

    Which document to start from within each group

    System.Int32 maxDocsPerGroup

    How many top documents to keep within each group.

    System.Boolean fillSortFields

    If true then the Comparable values for the sort fields will be set

    Returns
    Type Description
    ITopGroups<System.Object>
    | Improve this Doc View Source

    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
    Lucene.Net.Search.Sort withinGroupSort

    The Lucene.Net.Search.Sort used to sort documents within each group. Passing null is allowed, to sort by relevance.

    System.Int32 groupOffset

    Which group to start from

    System.Int32 withinGroupOffset

    Which document to start from within each group

    System.Int32 maxDocsPerGroup

    How many top documents to keep within each group.

    System.Boolean fillSortFields

    If true then the Comparable values for the sort fields will be set

    Returns
    Type Description
    ITopGroups<TGroupValue>
    Type Parameters
    Name Description
    TGroupValue

    The expected return type for group value

    | Improve this Doc View Source

    SetNextReader(AtomicReaderContext)

    Declaration
    public virtual void SetNextReader(AtomicReaderContext context)
    Parameters
    Type Name Description
    Lucene.Net.Index.AtomicReaderContext context
    | Improve this Doc View Source

    SetScorer(Scorer)

    Declaration
    public virtual void SetScorer(Scorer scorer)
    Parameters
    Type Name Description
    Lucene.Net.Search.Scorer scorer

    Implements

    Lucene.Net.Search.ICollector
    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)