Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class AbstractAllGroupsCollector<TGroupValue>

    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.

    This is an abstract version. Concrete implementations define what a group actually is and how it is internally collected.

    Note

    This API is experimental and might change in incompatible ways in the next release.

    Inheritance
    object
    AbstractAllGroupsCollector<TGroupValue>
    FunctionAllGroupsCollector<TMutableValue>
    TermAllGroupsCollector
    Implements
    IAbstractAllGroupsCollector<TGroupValue>
    ICollector
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Lucene.Net.Search.Grouping
    Assembly: Lucene.Net.Grouping.dll
    Syntax
    public abstract class AbstractAllGroupsCollector<TGroupValue> : IAbstractAllGroupsCollector<TGroupValue>, ICollector
    Type Parameters
    Name Description
    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

    GroupCount

    Returns the total number of groups for the executed search. This is a convenience method. The following code snippet has the same effect:

    GetGroups().Count
    Declaration
    public virtual int GroupCount { get; }
    Property Value
    Type Description
    int

    The total number of groups for the executed search

    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 abstract IEnumerable<TGroupValue> Groups { get; }
    Property Value
    Type Description
    IEnumerable<TGroupValue>

    the group values

    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 abstract void Collect(int doc)
    Parameters
    Type Name Description
    int doc

    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 abstract 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

    Implements

    IAbstractAllGroupsCollector<TGroupValue>
    Lucene.Net.Search.ICollector
    Back to top Copyright © 2024 The Apache Software Foundation, Licensed under the Apache License, Version 2.0
    Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation.
    All other marks mentioned may be trademarks or registered trademarks of their respective owners.