Class Collector
LUCENENET specific class used to hold the NewAnonymous(Action<Scorer>, Action<int>, Action<AtomicReaderContext>, Func<bool>) static method.
Inherited Members
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. |