Class Filter
Abstract base class for restricting which documents may be returned during searching.
Inheritance
Namespace: Lucene.Net.Search
Assembly: Lucene.Net.dll
Syntax
public abstract class Filter : object
Methods
| Improve this Doc View SourceGetDocIdSet(AtomicReaderContext, IBits)
Creates a Docnull
can be
returned if no documents are accepted by this Filter.
Note: this method will be called once per segment in
the index during searching. The returned Doc
Declaration
public abstract DocIdSet GetDocIdSet(AtomicReaderContext context, IBits acceptDocs)
Parameters
Type | Name | Description |
---|---|---|
Atomic |
context | a Atomic |
IBits | acceptDocs | IBits that represent the allowable docs to match (typically deleted docs but possibly filtering other documents) |
Returns
Type | Description |
---|---|
Doc |
A Doc |
NewAnonymous(Func<AtomicReaderContext, IBits, DocIdSet>)
Creates a new instance with the ability to specify the body of the GetgetDocIdSet
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<Atomic |
getDocIdSet | A delegate method that represents (is called by) the Get |
Returns
Type | Description |
---|---|
Filter |