Show / Hide Table of Contents

    Class PerFieldAnalyzerWrapper

    This analyzer is used to facilitate scenarios where different fields Require different analysis techniques. Use the Map argument in PerFieldAnalyzerWrapper(Analyzer, IDictionary<String, Analyzer>) to add non-default analyzers for fields.

    Example usage:

    IDictionary<string, Analyzer> analyzerPerField = new Dictionary<string, Analyzer>();
    analyzerPerField["firstname"] = new KeywordAnalyzer();
    analyzerPerField["lastname"] = new KeywordAnalyzer();
    
    PerFieldAnalyzerWrapper aWrapper =
      new PerFieldAnalyzerWrapper(new StandardAnalyzer(version), analyzerPerField);

    In this example, StandardAnalyzer will be used for all fields except "firstname" and "lastname", for which KeywordAnalyzer will be used.

    A PerFieldAnalyzerWrapper can be used like any other analyzer, for both indexing and query parsing.

    Inheritance
    System.Object
    Analyzer
    AnalyzerWrapper
    PerFieldAnalyzerWrapper
    Inherited Members
    AnalyzerWrapper.WrapComponents(String, TokenStreamComponents)
    AnalyzerWrapper.WrapReader(String, TextReader)
    AnalyzerWrapper.CreateComponents(String, TextReader)
    AnalyzerWrapper.GetPositionIncrementGap(String)
    AnalyzerWrapper.GetOffsetGap(String)
    AnalyzerWrapper.InitReader(String, TextReader)
    Lucene.Net.Analysis.Analyzer.NewAnonymous(Func<, , >)
    Lucene.Net.Analysis.Analyzer.NewAnonymous(Func<, , >, Lucene.Net.Analysis.ReuseStrategy)
    Lucene.Net.Analysis.Analyzer.NewAnonymous(Func<, , >, Func<, , >)
    Lucene.Net.Analysis.Analyzer.NewAnonymous(Func<, , >, Func<, , >, Lucene.Net.Analysis.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
    Namespace: Lucene.Net.Analysis.Miscellaneous
    Assembly: Lucene.Net.Analysis.Common.dll
    Syntax
    public sealed class PerFieldAnalyzerWrapper : AnalyzerWrapper

    Constructors

    | Improve this Doc View Source

    PerFieldAnalyzerWrapper(Analyzer)

    Constructs with default analyzer.

    Declaration
    public PerFieldAnalyzerWrapper(Analyzer defaultAnalyzer)
    Parameters
    Type Name Description
    Analyzer defaultAnalyzer

    Any fields not specifically defined to use a different analyzer will use the one provided here.

    | Improve this Doc View Source

    PerFieldAnalyzerWrapper(Analyzer, IDictionary<String, Analyzer>)

    Constructs with default analyzer and a map of analyzers to use for specific fields.

    The type of supplied will determine the type of behavior.

    General use. null keys are not supported.
    Use when sorted keys are required. null keys are not supported.
    HashMap<TKey, TValue>Similar behavior as . null keys are supported.
    TreeDictionary<TKey, TValue>Use when sorted keys are required. null keys are supported.
    LinkedHashMap<TKey, TValue>Use when insertion order must be preserved ( preserves insertion order only until items are removed). null keys are supported.
    Or, use a 3rd party or custom if other behavior is desired.

    Declaration
    public PerFieldAnalyzerWrapper(Analyzer defaultAnalyzer, IDictionary<string, Analyzer> fieldAnalyzers)
    Parameters
    Type Name Description
    Analyzer defaultAnalyzer

    Any fields not specifically defined to use a different analyzer will use the one provided here.

    IDictionary<System.String, Analyzer> fieldAnalyzers

    A (String field name to the Analyzer) to be used for those fields.

    Methods

    | Improve this Doc View Source

    GetWrappedAnalyzer(String)

    Declaration
    protected override Analyzer GetWrappedAnalyzer(string fieldName)
    Parameters
    Type Name Description
    System.String fieldName
    Returns
    Type Description
    Analyzer
    | Improve this Doc View Source

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String
    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)