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
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 |
---|---|---|
LuceneVersion | version | the Lucene match version |
TokenStream | in | the TokenStream to consume |
FilteringTokenFilter(LuceneVersion, Boolean, TokenStream)
Create a new FilteringTokenFilter.
Declaration
public FilteringTokenFilter(LuceneVersion version, bool enablePositionIncrements, TokenStream input)
Parameters
Type | Name | Description |
---|---|---|
LuceneVersion | version | |
System.Boolean | enablePositionIncrements | whether to increment position increments when filtering out terms |
TokenStream | input | the input to consume |
Fields
| Improve this Doc View Sourcem_version
Declaration
protected readonly LuceneVersion m_version
Field Value
Type | Description |
---|---|
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
| Improve this Doc View SourceIncrementToken()
Declaration
public override sealed bool IncrementToken()
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
| Improve this Doc View SourceReset()
Declaration
public override void Reset()
Overrides
| Improve this Doc View SourceSetEnablePositionIncrements(Boolean)
If true
, this 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
public virtual void SetEnablePositionIncrements(bool enable)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | enable |