Method NewAnonymous
NewAnonymous(Func<AtomicReaderContext, IBits, DocIdSet>)
Creates a new instance with the ability to specify the body of the GetDocIdSet(AtomicReaderContext, IBits)
method through the getDocIdSet
parameter.
Simple example:
var filter = Filter.NewAnonymous(getDocIdSet: (context, acceptDocs) =>
{
if (acceptDocs == null) acceptDocs = new Bits.MatchAllBits(5);
OpenBitSet bitset = new OpenBitSet(5);
if (acceptDocs.Get(1)) bitset.Set(1);
if (acceptDocs.Get(3)) bitset.Set(3);
return new DocIdBitSet(bitset);
});
LUCENENET specific
Declaration
public static Filter NewAnonymous(Func<AtomicReaderContext, IBits, DocIdSet> getDocIdSet)
Parameters
Type | Name | Description |
---|---|---|
Func<AtomicReaderContext, IBits, DocIdSet> | getDocIdSet | A delegate method that represents (is called by) the GetDocIdSet(AtomicReaderContext, IBits) method. It accepts a AtomicReaderContext context and a IBits acceptDocs and returns the DocIdSet for this filter. |
Returns
Type | Description |
---|---|
Filter |