Class Collector
LUCENENET specific class used to hold the NewAnonymous(Action<Scorer>, Action<Int32>, Action<AtomicReaderContext>, Func<Boolean>) static method.
Inheritance
Namespace: Lucene.Net.Search
Assembly: Lucene.Net.dll
Syntax
public static class Collector : object
Methods
| Improve this Doc View SourceNewAnonymous(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 |
---|---|---|
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<System.Int32> | collect | A delegate method that represents (is called by) the Collect(Int32)
method. It accepts an |
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<System.Boolean> | acceptsDocsOutOfOrder | A delegate method that represents (is called by) the AcceptsDocsOutOfOrder
property. It returns a |
Returns
Type | Description |
---|---|
ICollector | A new Lucene.Net.Search.Collector.AnonymousCollector instance. |