Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Interface ICharTermAttribute

    The term text of a Token.

    Inherited Members
    IAttribute.CopyTo(IAttribute)
    J2N.Text.ICharSequence.Subsequence(System.Int32, System.Int32)
    J2N.Text.ICharSequence.ToString()
    J2N.Text.ICharSequence.HasValue
    Namespace: Lucene.Net.Analysis.TokenAttributes
    Assembly: Lucene.Net.dll
    Syntax
    public interface ICharTermAttribute : IAttribute, ICharSequence, IAppendable

    Properties

    | Improve this Doc View Source

    Buffer

    Returns the internal termBuffer character array which you can then directly alter. If the array is too small for your token, use ResizeBuffer(Int32) to increase it. After altering the buffer be sure to call SetLength(Int32) to record the number of valid characters that were placed into the termBuffer.

    NOTE: The returned buffer may be larger than the valid Length.

    Declaration
    char[] Buffer { get; }
    Property Value
    Type Description
    System.Char[]
    | Improve this Doc View Source

    Item[Int32]

    Declaration
    char this[int index] { get; set; }
    Parameters
    Type Name Description
    System.Int32 index
    Property Value
    Type Description
    System.Char
    | Improve this Doc View Source

    Length

    Gets or Sets the number of valid characters (in the termBuffer array. SetLength(Int32)

    Declaration
    int Length { get; set; }
    Property Value
    Type Description
    System.Int32

    Methods

    | Improve this Doc View Source

    Append(ICharSequence)

    Appends the contents of the J2N.Text.ICharSequence to this character sequence.

    The characters of the J2N.Text.ICharSequence argument are appended, in order, increasing the length of this sequence by the length of the argument. If value is null, this method is a no-op.

    IMPORTANT: This method uses .NET semantics. In Lucene, a null value would append the string "null" to the instance, but in Lucene.NET a null value will be ignored.

    Declaration
    ICharTermAttribute Append(ICharSequence value)
    Parameters
    Type Name Description
    J2N.Text.ICharSequence value
    Returns
    Type Description
    ICharTermAttribute
    | Improve this Doc View Source

    Append(ICharSequence, Int32, Int32)

    Appends the a string representation of the specified J2N.Text.ICharSequence to this instance.

    The characters of the J2N.Text.ICharSequence argument are appended, in order, increasing the length of this sequence by the length of count. If value is null and startIndex and count are not 0, an System.ArgumentNullException is thrown.

    Declaration
    ICharTermAttribute Append(ICharSequence value, int startIndex, int count)
    Parameters
    Type Name Description
    J2N.Text.ICharSequence value

    The sequence of characters to append.

    System.Int32 startIndex

    The start index of the J2N.Text.ICharSequence to begin copying characters.

    System.Int32 count

    The number of characters to append.

    Returns
    Type Description
    ICharTermAttribute
    Exceptions
    Type Condition
    System.ArgumentNullException

    value is null, and startIndex and count are not zero.

    System.ArgumentOutOfRangeException

    count is less than zero.

    -or-

    startIndex is less than zero.

    -or-

    startIndex + count is greater than the length of value.

    | Improve this Doc View Source

    Append(ICharTermAttribute)

    Appends the contents of the other ICharTermAttribute to this character sequence.

    The characters of the ICharTermAttribute argument are appended, in order, increasing the length of this sequence by the length of the argument. If argument is null, this method is a no-op.

    This method uses .NET semantics. In Lucene, a null value would append the string "null" to the instance, but in Lucene.NET a null value will be safely ignored.

    Declaration
    ICharTermAttribute Append(ICharTermAttribute value)
    Parameters
    Type Name Description
    ICharTermAttribute value

    The sequence of characters to append.

    Returns
    Type Description
    ICharTermAttribute
    | Improve this Doc View Source

    Append(Char)

    Appends the supplied System.Char to this character sequence.

    Declaration
    ICharTermAttribute Append(char value)
    Parameters
    Type Name Description
    System.Char value

    The System.Char to append.

    Returns
    Type Description
    ICharTermAttribute
    | Improve this Doc View Source

    Append(Char[])

    Appends the contents of the char[] array to this character sequence.

    The characters of the char[] argument are appended, in order, increasing the length of this sequence by the length of the value. If value is null, this method is a no-op.

    This method uses .NET semantics. In Lucene, a null value would append the string "null" to the instance, but in Lucene.NET a null value will be safely ignored.

    Declaration
    ICharTermAttribute Append(char[] value)
    Parameters
    Type Name Description
    System.Char[] value

    The char[] array to append.

    Returns
    Type Description
    ICharTermAttribute
    Remarks

    LUCENENET specific method, added to simulate using the CharBuffer class in Java.

    | Improve this Doc View Source

    Append(Char[], Int32, Int32)

    Appends the string representation of the char[] array to this instance.

    The characters of the char[] argument are appended, in order, increasing the length of this sequence by the length of the value. If value is null and startIndex and count are not 0, an System.ArgumentNullException is thrown.

    Declaration
    ICharTermAttribute Append(char[] value, int startIndex, int count)
    Parameters
    Type Name Description
    System.Char[] value

    The sequence of characters to append.

    System.Int32 startIndex

    The start index of the char[] to begin copying characters.

    System.Int32 count

    The number of characters to append.

    Returns
    Type Description
    ICharTermAttribute
    Remarks

    LUCENENET specific method, added to simulate using the CharBuffer class in Java. Note that the CopyBuffer(Char[], Int32, Int32) method provides similar functionality.

    Exceptions
    Type Condition
    System.ArgumentNullException

    value is null, and startIndex and count are not zero.

    System.ArgumentOutOfRangeException

    count is less than zero.

    -or-

    startIndex is less than zero.

    -or-

    startIndex + count is greater than the length of value.

    | Improve this Doc View Source

    Append(String)

    Appends the specified System.String to this character sequence.

    The characters of the System.String argument are appended, in order, increasing the length of this sequence by the length of the argument. If argument is null, this method is a no-op.

    This method uses .NET semantics. In Lucene, a null value would append the string "null" to the instance, but in Lucene.NET a null value will be safely ignored.

    Declaration
    ICharTermAttribute Append(string value)
    Parameters
    Type Name Description
    System.String value

    The sequence of characters to append.

    Returns
    Type Description
    ICharTermAttribute
    Remarks

    LUCENENET specific method, added because the .NET System.String data type doesn't implement J2N.Text.ICharSequence.

    | Improve this Doc View Source

    Append(String, Int32, Int32)

    Appends the contents of the System.String to this character sequence.

    The characters of the System.String argument are appended, in order, increasing the length of this sequence by the length of value. If value is null and startIndex and count are not 0, an System.ArgumentNullException is thrown.

    Declaration
    ICharTermAttribute Append(string value, int startIndex, int count)
    Parameters
    Type Name Description
    System.String value

    The sequence of characters to append.

    System.Int32 startIndex

    The start index of the System.String to begin copying characters.

    System.Int32 count

    The number of characters to append.

    Returns
    Type Description
    ICharTermAttribute
    Remarks

    LUCENENET specific method, added because the .NET System.String data type doesn't implement J2N.Text.ICharSequence.

    Exceptions
    Type Condition
    System.ArgumentNullException

    value is null, and startIndex and count are not zero.

    System.ArgumentOutOfRangeException

    count is less than zero.

    -or-

    startIndex is less than zero.

    -or-

    startIndex + count is greater than the length of value.

    | Improve this Doc View Source

    Append(StringBuilder)

    Appends a string representation of the specified System.Text.StringBuilder to this character sequence.

    The characters of the System.Text.StringBuilder argument are appended, in order, increasing the length of this sequence by the length of the argument. If argument is null, this method is a no-op.

    This method uses .NET semantics. In Lucene, a null value would append the string "null" to the instance, but in Lucene.NET a null value will be safely ignored.

    Declaration
    ICharTermAttribute Append(StringBuilder value)
    Parameters
    Type Name Description
    System.Text.StringBuilder value
    Returns
    Type Description
    ICharTermAttribute
    | Improve this Doc View Source

    Append(StringBuilder, Int32, Int32)

    Appends a string representation of the specified System.Text.StringBuilder to this character sequence.

    The characters of the System.Text.StringBuilder argument are appended, in order, increasing the length of this sequence by the length of the argument. If value is null and startIndex and count are not 0, an System.ArgumentNullException is thrown.

    Declaration
    ICharTermAttribute Append(StringBuilder value, int startIndex, int count)
    Parameters
    Type Name Description
    System.Text.StringBuilder value

    The sequence of characters to append.

    System.Int32 startIndex

    The start index of the System.Text.StringBuilder to begin copying characters.

    System.Int32 count

    The number of characters to append.

    Returns
    Type Description
    ICharTermAttribute
    Remarks

    LUCENENET specific method, added because the .NET System.Text.StringBuilder data type doesn't implement J2N.Text.ICharSequence.

    Exceptions
    Type Condition
    System.ArgumentNullException

    value is null, and startIndex and count are not zero.

    System.ArgumentOutOfRangeException

    count is less than zero.

    -or-

    startIndex is less than zero.

    -or-

    startIndex + count is greater than the length of value.

    | Improve this Doc View Source

    CopyBuffer(Char[], Int32, Int32)

    Copies the contents of buffer, starting at offset for length characters, into the termBuffer array.

    Declaration
    void CopyBuffer(char[] buffer, int offset, int length)
    Parameters
    Type Name Description
    System.Char[] buffer

    the buffer to copy

    System.Int32 offset

    the index in the buffer of the first character to copy

    System.Int32 length

    the number of characters to copy

    | Improve this Doc View Source

    ResizeBuffer(Int32)

    Grows the termBuffer to at least size newSize, preserving the existing content.

    Declaration
    char[] ResizeBuffer(int newSize)
    Parameters
    Type Name Description
    System.Int32 newSize

    minimum size of the new termBuffer

    Returns
    Type Description
    System.Char[]

    newly created termBuffer with length >= newSize

    | Improve this Doc View Source

    SetEmpty()

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

    Declaration
    ICharTermAttribute SetEmpty()
    Returns
    Type Description
    ICharTermAttribute
    | Improve this Doc View Source

    SetLength(Int32)

    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(Int32) 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
    ICharTermAttribute SetLength(int length)
    Parameters
    Type Name Description
    System.Int32 length

    the truncated length

    Returns
    Type Description
    ICharTermAttribute
    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 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.