Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class Collector

    LUCENENET specific class used to hold the NewAnonymous(Action<Scorer>, Action<int>, Action<AtomicReaderContext>, Func<bool>) static method.

    Inheritance
    object
    Collector
    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 static class Collector

    Methods

    NewAnonymous(Action<Scorer>, Action<int>, Action<AtomicReaderContext>, Func<bool>)

    Creates a new instance with the ability to specify the body of the SetScorer(Scorer) method through the setScorer parameter, the body of the Collect(int) method through the collect parameter, the body of the SetNextReader(AtomicReaderContext) method through the setNextReader parameter, and the body of the AcceptsDocsOutOfOrder property through the acceptsDocsOutOfOrder parameter. Simple example:

    IndexSearcher searcher = new IndexSearcher(indexReader);
    OpenBitSet bits = new OpenBitSet(indexReader.MaxDoc);
    int docBase;
    searcher.Search(query, 
        Collector.NewAnonymous(setScorer: (scorer) =>
        {
            // ignore scorer
        }, collect: (doc) =>
        {
            bits.Set(doc + docBase);
        }, setNextReader: (context) =>
        {
            docBase = context.DocBase;
        }, acceptsDocsOutOfOrder: () =>
        {
            return true;
        })
    );
    Declaration
    public static ICollector NewAnonymous(Action<Scorer> setScorer, Action<int> collect, Action<AtomicReaderContext> setNextReader, Func<bool> acceptsDocsOutOfOrder)
    Parameters
    Type Name Description
    Action<Scorer> setScorer

    A delegate method that represents (is called by) the SetScorer(Scorer) method. It accepts a Scorer scorer and has no return value.

    Action<int> collect

    A delegate method that represents (is called by) the Collect(int) method. It accepts an int doc and has no return value.

    Action<AtomicReaderContext> setNextReader

    A delegate method that represents (is called by) the SetNextReader(AtomicReaderContext) method. It accepts a AtomicReaderContext context and has no return value.

    Func<bool> acceptsDocsOutOfOrder

    A delegate method that represents (is called by) the AcceptsDocsOutOfOrder property. It returns a bool value.

    Returns
    Type Description
    ICollector

    A new Collector.AnonymousCollector instance.

    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.