Show / Hide Table of Contents

    Class Collector

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

    Inheritance
    System.Object
    Collector
    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
    Assembly: Lucene.Net.dll
    Syntax
    public static class Collector

    Methods

    | Improve this Doc View Source

    NewAnonymous(Action<Scorer>, Action<Int32>, Action<AtomicReaderContext>, Func<Boolean>)

    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(Int32) 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
    System.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.

    System.Action<System.Int32> collect

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

    System.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.

    System.Func<System.Boolean> acceptsDocsOutOfOrder

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

    Returns
    Type Description
    ICollector

    A new Lucene.Net.Search.Collector.AnonymousCollector instance.

    • Improve this Doc
    • View Source
    Back to top Copyright © 2019 Licensed to the Apache Software Foundation (ASF)