Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class AnalyzerWrapper

    Extension to Analyzer suitable for Analyzers which wrap other Analyzers.

    GetWrappedAnalyzer(String) allows the Analyzer to wrap multiple Analyzers which are selected on a per field basis.

    WrapComponents(String, TokenStreamComponents) allows the TokenStreamComponents of the wrapped Analyzer to then be wrapped (such as adding a new TokenFilter to form new TokenStreamComponents).

    Inheritance
    System.Object
    Analyzer
    AnalyzerWrapper
    Implements
    System.IDisposable
    Inherited Members
    Analyzer.NewAnonymous(Func<String, TextReader, TokenStreamComponents>)
    Analyzer.NewAnonymous(Func<String, TextReader, TokenStreamComponents>, ReuseStrategy)
    Analyzer.NewAnonymous(Func<String, TextReader, TokenStreamComponents>, Func<String, TextReader, TextReader>)
    Analyzer.NewAnonymous(Func<String, TextReader, TokenStreamComponents>, Func<String, TextReader, TextReader>, ReuseStrategy)
    Analyzer.GetTokenStream(String, TextReader)
    Analyzer.GetTokenStream(String, String)
    Analyzer.Strategy
    Analyzer.Dispose()
    Analyzer.Dispose(Boolean)
    Analyzer.GLOBAL_REUSE_STRATEGY
    Analyzer.PER_FIELD_REUSE_STRATEGY
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Lucene.Net.Analysis
    Assembly: Lucene.Net.dll
    Syntax
    public abstract class AnalyzerWrapper : Analyzer, IDisposable

    Constructors

    | Improve this Doc View Source

    AnalyzerWrapper()

    Creates a new AnalyzerWrapper. Since the ReuseStrategy of the wrapped Analyzers are unknown, PER_FIELD_REUSE_STRATEGY is assumed.

    Declaration
    [Obsolete("Use AnalyzerWrapper(Analyzer.ReuseStrategy) and specify a valid Analyzer.ReuseStrategy, probably retrieved from the wrapped analyzer using Analyzer.Strategy.")]
    protected AnalyzerWrapper()
    | Improve this Doc View Source

    AnalyzerWrapper(ReuseStrategy)

    Creates a new AnalyzerWrapper with the given reuse strategy.

    If you want to wrap a single delegate Analyzer you can probably reuse its strategy when instantiating this subclass: base(innerAnalyzer.Strategy).

    If you choose different analyzers per field, use PER_FIELD_REUSE_STRATEGY.

    Declaration
    protected AnalyzerWrapper(ReuseStrategy reuseStrategy)
    Parameters
    Type Name Description
    ReuseStrategy reuseStrategy
    See Also
    Strategy

    Methods

    | Improve this Doc View Source

    CreateComponents(String, TextReader)

    Declaration
    protected sealed override TokenStreamComponents CreateComponents(string fieldName, TextReader aReader)
    Parameters
    Type Name Description
    System.String fieldName
    System.IO.TextReader aReader
    Returns
    Type Description
    TokenStreamComponents
    Overrides
    Analyzer.CreateComponents(String, TextReader)
    | Improve this Doc View Source

    GetOffsetGap(String)

    Declaration
    public override int GetOffsetGap(string fieldName)
    Parameters
    Type Name Description
    System.String fieldName
    Returns
    Type Description
    System.Int32
    Overrides
    Analyzer.GetOffsetGap(String)
    | Improve this Doc View Source

    GetPositionIncrementGap(String)

    Declaration
    public override int GetPositionIncrementGap(string fieldName)
    Parameters
    Type Name Description
    System.String fieldName
    Returns
    Type Description
    System.Int32
    Overrides
    Analyzer.GetPositionIncrementGap(String)
    | Improve this Doc View Source

    GetWrappedAnalyzer(String)

    Retrieves the wrapped Analyzer appropriate for analyzing the field with the given name

    Declaration
    protected abstract Analyzer GetWrappedAnalyzer(string fieldName)
    Parameters
    Type Name Description
    System.String fieldName

    Name of the field which is to be analyzed

    Returns
    Type Description
    Analyzer

    Analyzer for the field with the given name. Assumed to be non-null

    | Improve this Doc View Source

    InitReader(String, TextReader)

    Declaration
    protected override TextReader InitReader(string fieldName, TextReader reader)
    Parameters
    Type Name Description
    System.String fieldName
    System.IO.TextReader reader
    Returns
    Type Description
    System.IO.TextReader
    Overrides
    Analyzer.InitReader(String, TextReader)
    | Improve this Doc View Source

    WrapComponents(String, TokenStreamComponents)

    Wraps / alters the given TokenStreamComponents, taken from the wrapped Analyzer, to form new components. It is through this method that new TokenFilters can be added by AnalyzerWrappers. By default, the given components are returned.

    Declaration
    protected virtual TokenStreamComponents WrapComponents(string fieldName, TokenStreamComponents components)
    Parameters
    Type Name Description
    System.String fieldName

    Name of the field which is to be analyzed

    TokenStreamComponents components TokenStreamComponents taken from the wrapped Analyzer
    Returns
    Type Description
    TokenStreamComponents

    Wrapped / altered TokenStreamComponents.

    | Improve this Doc View Source

    WrapReader(String, TextReader)

    Wraps / alters the given System.IO.TextReader. Through this method AnalyzerWrappers can implement InitReader(String, TextReader). By default, the given reader is returned.

    Declaration
    protected virtual TextReader WrapReader(string fieldName, TextReader reader)
    Parameters
    Type Name Description
    System.String fieldName

    name of the field which is to be analyzed

    System.IO.TextReader reader

    the reader to wrap

    Returns
    Type Description
    System.IO.TextReader

    the wrapped reader

    Implements

    System.IDisposable
    • Improve this Doc
    • View Source
    Back to top Copyright © 2021 The Apache Software Foundation, Licensed under the Apache License, Version 2.0
    Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation.
    All other marks mentioned may be trademarks or registered trademarks of their respective owners.