Fork me on GitHub
  • API

    Class CharTermAttributeExtensions

    Extension methods on ICharTermAttribute.

    Inheritance
    object
    CharTermAttributeExtensions
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Lucene.Net.Analysis.TokenAttributes.Extensions
    Assembly: Lucene.Net.dll
    Syntax
    public static class CharTermAttributeExtensions

    Methods

    SetEmpty<T>(T)

    Sets the length of the termBuffer to zero. Use this method before appending contents.

    NOTE: This is exactly the same operation as calling Clear(), the primary difference is that this method returns a reference to the current object so it can be chained.
    obj.SetEmpty().Append("hey you");
    Declaration
    public static T SetEmpty<T>(this T termAttr) where T : ICharTermAttribute
    Parameters
    Type Name Description
    T termAttr
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T

    SetLength<T>(T, int)

    Set number of valid characters (length of the term) in the termBuffer array. Use this to truncate the termBuffer or to synchronize with external manipulation of the termBuffer. Note: to grow the size of the array, use ResizeBuffer(int) first.

    NOTE: This is exactly the same operation as calling the Length setter, the primary difference is that this method returns a reference to the current object so it can be chained.
    obj.SetLength(30).Append("hey you");
    Declaration
    public static T SetLength<T>(this T termAttr, int length) where T : ICharTermAttribute
    Parameters
    Type Name Description
    T termAttr
    int length

    The truncated length

    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T
    Back to top Copyright © 2025 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.