Show / Hide Table of Contents

    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 is thrown when trying to disable position increments when filtering terms.

    Inheritance
    System.Object
    AttributeSource
    TokenStream
    TokenFilter
    FilteringTokenFilter
    StopFilter
    TypeTokenFilter
    CodepointCountFilter
    KeepWordFilter
    LengthFilter
    Implements
    IDisposable
    Inherited Members
    TokenFilter.m_input
    TokenFilter.Dispose(Boolean)
    TokenStream.Dispose()
    AttributeSource.GetAttributeFactory()
    AttributeSource.GetAttributeClassesEnumerator()
    AttributeSource.GetAttributeImplsEnumerator()
    AttributeSource.AddAttributeImpl(Attribute)
    AttributeSource.AddAttribute<T>()
    AttributeSource.HasAttributes
    AttributeSource.HasAttribute<T>()
    AttributeSource.GetAttribute<T>()
    AttributeSource.ClearAttributes()
    AttributeSource.CaptureState()
    AttributeSource.RestoreState(AttributeSource.State)
    AttributeSource.GetHashCode()
    AttributeSource.Equals(Object)
    AttributeSource.ReflectAsString(Boolean)
    AttributeSource.ReflectWith(IAttributeReflector)
    AttributeSource.CloneAttributes()
    AttributeSource.CopyTo(AttributeSource)
    AttributeSource.ToString()
    Namespace: Lucene.Net.Analysis.Util
    Assembly: Lucene.Net.Analysis.Common.dll
    Syntax
    public abstract class FilteringTokenFilter : TokenFilter, IDisposable

    Constructors

    | Improve this Doc View Source

    FilteringTokenFilter(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

    | Improve this Doc View Source

    FilteringTokenFilter(LuceneVersion, Boolean, TokenStream)

    Create a new FilteringTokenFilter.

    Declaration
    public FilteringTokenFilter(LuceneVersion version, bool enablePositionIncrements, TokenStream input)
    Parameters
    Type Name Description
    LuceneVersion version

    the Lucene match version

    System.Boolean enablePositionIncrements

    whether to increment position increments when filtering out terms

    TokenStream input

    the input to consume

    Fields

    | Improve this Doc View Source

    m_version

    Declaration
    protected readonly LuceneVersion m_version
    Field Value
    Type Description
    LuceneVersion

    Properties

    | Improve this Doc View Source

    EnablePositionIncrements

    Declaration
    public virtual bool EnablePositionIncrements { get; }
    Property Value
    Type Description
    System.Boolean

    Methods

    | Improve this Doc View Source

    Accept()

    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
    | Improve this Doc View Source

    End()

    Declaration
    public override void End()
    Overrides
    TokenFilter.End()
    | Improve this Doc View Source

    IncrementToken()

    Declaration
    public override sealed bool IncrementToken()
    Returns
    Type Description
    System.Boolean
    Overrides
    TokenStream.IncrementToken()
    | Improve this Doc View Source

    Reset()

    Declaration
    public override void Reset()
    Overrides
    TokenFilter.Reset()
    | Improve this Doc View Source

    SetEnablePositionIncrements(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

    Implements

    IDisposable
    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)