Interface ICharTermAttribute
The term text of a Token.
Inherited Members
Namespace: Lucene.Net.Analysis.TokenAttributes
Assembly: Lucene.Net.dll
Syntax
public interface ICharTermAttribute : IAttribute, ICharSequence
Properties
| Improve this Doc View SourceBuffer
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[] |
Item[Int32]
Declaration
char this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
Property Value
Type | Description |
---|---|
System.Char |
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 SourceAppend(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
, then the four
characters "null"
are appended.
Declaration
ICharTermAttribute Append(ICharTermAttribute termAtt)
Parameters
Type | Name | Description |
---|---|---|
ICharTermAttribute | termAtt |
Returns
Type | Description |
---|---|
ICharTermAttribute |
Append(ICharSequence)
Appends the contents of the ICharSequence to this character sequence.
The characters of the ICharSequence argument are appended, in order, increasing the length of
this sequence by the length of the argument. If argument is null
, then the four
characters "null"
are appended.
Declaration
ICharTermAttribute Append(ICharSequence csq)
Parameters
Type | Name | Description |
---|---|---|
ICharSequence | csq |
Returns
Type | Description |
---|---|
ICharTermAttribute |
Append(ICharSequence, Int32, Int32)
Appends the contents of the ICharSequence to this character sequence, beginning and ending at the specified indices.
The characters of the ICharSequence argument are appended, in order, increasing the length of
this sequence by the length of the argument. If argument is null
, then the four
characters "null"
are appended.
Declaration
ICharTermAttribute Append(ICharSequence csq, int start, int end)
Parameters
Type | Name | Description |
---|---|---|
ICharSequence | csq | The index of the first character in the subsequence. |
System.Int32 | start | The start index of the ICharSequence to begin copying characters. |
System.Int32 | end | The index of the character following the last character in the subsequence. |
Returns
Type | Description |
---|---|
ICharTermAttribute |
Append(Char)
Appends the supplied System.Char to this character sequence.
Declaration
ICharTermAttribute Append(char c)
Parameters
Type | Name | Description |
---|---|---|
System.Char | c | The System.Char to append. |
Returns
Type | Description |
---|---|
ICharTermAttribute |
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 argument. If argument is null
, then the four
characters "null"
are appended.
Declaration
ICharTermAttribute Append(char[] csq)
Parameters
Type | Name | Description |
---|---|---|
System.Char[] | csq | The char[] array to append. |
Returns
Type | Description |
---|---|
ICharTermAttribute |
Remarks
LUCENENET specific method, added to simulate using the CharBuffer class in Java.
Append(Char[], Int32, Int32)
Appends the contents of the char[] array to this character sequence, beginning and ending at the specified indices.
The characters of the char[] argument are appended, in order, increasing the length of
this sequence by the length of the argument. If argument is null
, then the four
characters "null"
are appended.
Declaration
ICharTermAttribute Append(char[] csq, int start, int end)
Parameters
Type | Name | Description |
---|---|---|
System.Char[] | csq | The char[] array to append. |
System.Int32 | start | The start index of the char[] to begin copying characters. |
System.Int32 | end | The index of the character following the last character in the subsequence. |
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, except for the last argument of this method is an index of the array rather than the length of characters to copy.
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
, then the four
characters "null"
are appended.
Declaration
ICharTermAttribute Append(string s)
Parameters
Type | Name | Description |
---|---|---|
System.String | s |
Returns
Type | Description |
---|---|
ICharTermAttribute |
Remarks
LUCENENET specific method, added because the .NET System.String data type doesn't implement ICharSequence.
Append(String, Int32, Int32)
Appends the contents of the System.String to this character sequence, beginning and ending at the specified indices.
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
, then the four
characters "null"
are appended.
Declaration
ICharTermAttribute Append(string csq, int start, int end)
Parameters
Type | Name | Description |
---|---|---|
System.String | csq | The index of the first character in the subsequence. |
System.Int32 | start | The start index of the System.String to begin copying characters. |
System.Int32 | end | The index of the character following the last character in the subsequence. |
Returns
Type | Description |
---|---|
ICharTermAttribute |
Remarks
LUCENENET specific method, added because the .NET System.String data type doesn't implement ICharSequence.
Append(StringBuilder)
Appends 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
, then the four
characters "null"
are appended.
Declaration
ICharTermAttribute Append(StringBuilder sb)
Parameters
Type | Name | Description |
---|---|---|
System.Text.StringBuilder | sb |
Returns
Type | Description |
---|---|
ICharTermAttribute |
Append(StringBuilder, Int32, Int32)
Appends 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
, then the four
characters "null"
are appended.
Declaration
ICharTermAttribute Append(StringBuilder s, int start, int end)
Parameters
Type | Name | Description |
---|---|---|
System.Text.StringBuilder | s | |
System.Int32 | start | |
System.Int32 | end |
Returns
Type | Description |
---|---|
ICharTermAttribute |
Remarks
LUCENENET specific method, added because the .NET System.Text.StringBuilder data type doesn't implement ICharSequence.
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 |
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 |
SetEmpty()
Sets the length of the termBuffer to zero. Use this method before appending contents.
Declaration
ICharTermAttribute SetEmpty()
Returns
Type | Description |
---|---|
ICharTermAttribute |
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 |