Show / Hide Table of Contents

    Class CommonGramsQueryFilter

    Wrap a CommonGramsFilter optimizing phrase queries by only returning single words when they are not a member of a bigram.

    Example:

    • query input to CommonGramsFilter: "the rain in spain falls mainly"
    • output of CommomGramsFilter/input to CommonGramsQueryFilter: |"the, "the-rain"|"rain" "rain-in"|"in, "in-spain"|"spain"|"falls"|"mainly"
    • output of CommonGramsQueryFilter:"the-rain", "rain-in" ,"in-spain", "falls", "mainly"

    Inheritance
    System.Object
    AttributeSource
    TokenStream
    TokenFilter
    CommonGramsQueryFilter
    Implements
    IDisposable
    Inherited Members
    TokenFilter.m_input
    TokenFilter.End()
    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.CommonGrams
    Assembly: Lucene.Net.Analysis.Common.dll
    Syntax
    public sealed class CommonGramsQueryFilter : TokenFilter, IDisposable
    Remarks

    See:http://hudson.zones.apache.org/hudson/job/Lucene-trunk/javadoc//all/org/apache/lucene/analysis/TokenStream.html and http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/java/org/apache/lucene/analysis/package.html?revision=718798

    Constructors

    | Improve this Doc View Source

    CommonGramsQueryFilter(CommonGramsFilter)

    Constructs a new CommonGramsQueryFilter based on the provided CommomGramsFilter

    Declaration
    public CommonGramsQueryFilter(CommonGramsFilter input)
    Parameters
    Type Name Description
    CommonGramsFilter input

    CommonGramsFilter the QueryFilter will use

    Properties

    | Improve this Doc View Source

    IsGramType

    Convenience method to check if the current type is a gram type

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

    true if the current type is a gram type, false otherwise

    Methods

    | Improve this Doc View Source

    IncrementToken()

    Output bigrams whenever possible to optimize queries. Only output unigrams when they are not a member of a bigram. Example:

    • input: "the rain in spain falls mainly"
    • output:"the-rain", "rain-in" ,"in-spain", "falls", "mainly"

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

    Reset()

    This method is called by a consumer before it begins consumption using IncrementToken().

    Resets this stream to a clean state. Stateful implementations must implement this method so that they can be reused, just as if they had been created fresh.

    If you override this method, always call base.Reset(), otherwise some internal state will not be correctly reset (e.g., Tokenizer will throw on further usage).

    Declaration
    public override void Reset()
    Overrides
    TokenFilter.Reset()
    Remarks

    NOTE: The default implementation chains the call to the input TokenStream, so be sure to call base.Reset() when overriding this method.

    Implements

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