Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class MultiCollector

    A ICollector which allows running a search with several ICollectors. It offers a static Wrap(params ICollector[]) method which accepts a list of collectors and wraps them with MultiCollector, while filtering out the null ones.

    Inheritance
    object
    MultiCollector
    Implements
    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
    Assembly: Lucene.Net.dll
    Syntax
    public class MultiCollector : ICollector

    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 BooleanQuery) can achieve faster searching if the 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 CollectionTerminatedException. In this case, the last docs of the current AtomicReaderContext will be skipped and 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

    SetNextReader(AtomicReaderContext)

    Called before collecting from each AtomicReaderContext. All doc ids in Collect(int) will correspond to Reader.

    Add DocBase to the current 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 Scorer and call scorer.GetScore() when needed.

    Declaration
    public virtual void SetScorer(Scorer scorer)
    Parameters
    Type Name Description
    Scorer scorer

    Wrap(params ICollector[])

    Wraps a list of ICollectors with a MultiCollector. This method works as follows:

    • Filters out the null collectors, so they are not used during search time.
    • If the input contains 1 real collector (i.e. non-null ), it is returned.
    • Otherwise the method returns a MultiCollector which wraps the non-
      null
      ones.
    Declaration
    public static ICollector Wrap(params ICollector[] collectors)
    Parameters
    Type Name Description
    ICollector[] collectors
    Returns
    Type Description
    ICollector
    Exceptions
    Type Condition
    ArgumentException

    if either 0 collectors were input, or all collectors are null.

    Implements

    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.