Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class LimitTokenCountAnalyzer

    This Lucene.Net.Analysis.Analyzer limits the number of tokens while indexing. It is a replacement for the maximum field length setting inside Lucene.Net.Index.IndexWriter.

    Inheritance
    object
    Analyzer
    AnalyzerWrapper
    LimitTokenCountAnalyzer
    Implements
    IDisposable
    Inherited Members
    AnalyzerWrapper.GetPositionIncrementGap(string)
    AnalyzerWrapper.GetOffsetGap(string)
    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.GLOBAL_REUSE_STRATEGY
    Analyzer.PER_FIELD_REUSE_STRATEGY
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Lucene.Net.Analysis.Miscellaneous
    Assembly: Lucene.Net.Analysis.Common.dll
    Syntax
    public sealed class LimitTokenCountAnalyzer : AnalyzerWrapper, IDisposable

    Constructors

    LimitTokenCountAnalyzer(Analyzer, int)

    Build an analyzer that limits the maximum number of tokens per field. This analyzer will not consume any tokens beyond the maxTokenCount limit

    Declaration
    public LimitTokenCountAnalyzer(Analyzer @delegate, int maxTokenCount)
    Parameters
    Type Name Description
    Analyzer delegate
    int maxTokenCount
    See Also
    LimitTokenCountAnalyzer(Analyzer, int, bool)

    LimitTokenCountAnalyzer(Analyzer, int, bool)

    Build an analyzer that limits the maximum number of tokens per field.

    Declaration
    public LimitTokenCountAnalyzer(Analyzer @delegate, int maxTokenCount, bool consumeAllTokens)
    Parameters
    Type Name Description
    Analyzer delegate

    the analyzer to wrap

    int maxTokenCount

    max number of tokens to produce

    bool consumeAllTokens

    whether all tokens from the delegate should be consumed even if maxTokenCount is reached.

    See Also
    LimitTokenCountFilter

    Methods

    GetWrappedAnalyzer(string)

    Retrieves the wrapped Lucene.Net.Analysis.Analyzer appropriate for analyzing the field with the given name

    Declaration
    protected override Analyzer GetWrappedAnalyzer(string fieldName)
    Parameters
    Type Name Description
    string fieldName

    Name of the field which is to be analyzed

    Returns
    Type Description
    Analyzer

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

    Overrides
    AnalyzerWrapper.GetWrappedAnalyzer(string)
    See Also
    LimitTokenCountFilter

    ToString()

    Returns a string that represents the current object.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    A string that represents the current object.

    Overrides
    object.ToString()
    See Also
    LimitTokenCountFilter

    WrapComponents(string, TokenStreamComponents)

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

    Declaration
    protected override TokenStreamComponents WrapComponents(string fieldName, TokenStreamComponents components)
    Parameters
    Type Name Description
    string fieldName

    Name of the field which is to be analyzed

    TokenStreamComponents components

    Lucene.Net.Analysis.TokenStreamComponents taken from the wrapped Lucene.Net.Analysis.Analyzer

    Returns
    Type Description
    TokenStreamComponents

    Wrapped / altered Lucene.Net.Analysis.TokenStreamComponents.

    Overrides
    AnalyzerWrapper.WrapComponents(string, TokenStreamComponents)
    See Also
    LimitTokenCountFilter

    Implements

    IDisposable

    See Also

    LimitTokenCountFilter
    Back to top Copyright © 2024 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.