Class FilteringTokenFilter
Abstract base class for TokenFilters that may remove tokens. You have to implement Accept() and return a boolean if the current token should be preserved. IncrementToken() uses this method to decide if a token should be passed to the caller.
As of Lucene 4.4, an System.ArgumentException is thrown when trying to disable position increments when filtering terms.
Inheritance
Implements
Inherited Members
Namespace: Lucene.Net.Analysis.Util
Assembly: Lucene.Net.Analysis.Common.dll
Syntax
public abstract class FilteringTokenFilter : TokenFilter, IDisposable
Constructors
| Improve this Doc View SourceFilteringTokenFilter(LuceneVersion, TokenStream)
Create a new FilteringTokenFilter.
Declaration
public FilteringTokenFilter(LuceneVersion version, TokenStream in)
Parameters
Type | Name | Description |
---|---|---|
Lucene.Net.Util.LuceneVersion | version | the Lucene match version |
Lucene.Net.Analysis.TokenStream | in | the Lucene.Net.Analysis.TokenStream to consume |
FilteringTokenFilter(LuceneVersion, Boolean, TokenStream)
Create a new FilteringTokenFilter.
Declaration
[Obsolete("enablePositionIncrements=false is not supported anymore as of Lucene 4.4")]
public FilteringTokenFilter(LuceneVersion version, bool enablePositionIncrements, TokenStream input)
Parameters
Type | Name | Description |
---|---|---|
Lucene.Net.Util.LuceneVersion | version | |
System.Boolean | enablePositionIncrements | whether to increment position increments when filtering out terms |
Lucene.Net.Analysis.TokenStream | input | the input to consume |
Fields
| Improve this Doc View Sourcem_version
Declaration
protected readonly LuceneVersion m_version
Field Value
Type | Description |
---|---|
Lucene.Net.Util.LuceneVersion |
Properties
| Improve this Doc View SourceEnablePositionIncrements
Declaration
public virtual bool EnablePositionIncrements { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
| Improve this Doc View SourceAccept()
Override this method and return if the current input token should be returned by IncrementToken().
Declaration
protected abstract bool Accept()
Returns
Type | Description |
---|---|
System.Boolean |
End()
Declaration
public override void End()
Overrides
IncrementToken()
Declaration
public sealed override bool IncrementToken()
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
Reset()
Declaration
public override void Reset()
Overrides
SetEnablePositionIncrements(Boolean)
If true
, this Lucene.Net.Analysis.TokenFilter will preserve
positions of the incoming tokens (ie, accumulate and
set position increments of the removed tokens).
Generally, true
is best as it does not
lose information (positions of the original tokens)
during indexing.
When set, when a token is stopped (omitted), the position increment of the following token is incremented.
Declaration
[Obsolete("enablePositionIncrements=false is not supported anymore as of Lucene 4.4")]
public virtual void SetEnablePositionIncrements(bool enable)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | enable |