The Token type exposes the following members.
Constructors
Name | Description | |
---|---|---|
Token()()()() | Constructs a Token will null text. | |
Token(Int32, Int32) | Constructs a Token with null text and start & end
offsets.
| |
Token(Int32, Int32, Int32) | Constructs a Token with null text and start & end
offsets plus flags. NOTE: flags is EXPERIMENTAL.
| |
Token(Int32, Int32, String) | Constructs a Token with null text and start & end
offsets plus the Token type.
| |
Token(String, Int32, Int32) | Constructs a Token with the given term text, and start
& end offsets. The type defaults to "word."
NOTE: for better indexing speed you should
instead use the char[] termBuffer methods to set the
term text.
| |
Token(String, Int32, Int32, Int32) | Constructs a Token with the given text, start and end
offsets, & type. NOTE: for better indexing
speed you should instead use the char[] termBuffer
methods to set the term text.
| |
Token(String, Int32, Int32, String) | Constructs a Token with the given text, start and end
offsets, & type. NOTE: for better indexing
speed you should instead use the char[] termBuffer
methods to set the term text.
| |
Token(array<Char>[]()[][], Int32, Int32, Int32, Int32) | Constructs a Token with the given term buffer (offset
& length), start and end
offsets
|
Methods
Name | Description | |
---|---|---|
Clear | Resets the term text, payload, flags, and positionIncrement,
startOffset, endOffset and token type to default.
(Overrides AttributeImpl..::..Clear()()()().) | |
Clone()()()() | (Overrides AttributeImpl..::..Clone()()()().) | |
Clone(array<Char>[]()[][], Int32, Int32, Int32, Int32) | Makes a clone, but replaces the term buffer &
start/end offset in the process. This is more
efficient than doing a full clone (and then calling
setTermBuffer) because it saves a wasted copy of the old
termBuffer.
| |
CopyTo | (Overrides AttributeImpl..::..CopyTo(AttributeImpl).) | |
EndOffset | Returns this Token's ending offset, one greater than the position of the
last character corresponding to this token in the source text. The length
of the token in the source text is (endOffset - startOffset).
| |
Equals | (Overrides AttributeImpl..::..Equals(Object).) | |
Finalize | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) | |
GetFlags | EXPERIMENTAL: While we think this is here to stay, we may want to change it to be a long.
Get the bitset for any bits that have been set. This is completely distinct from {@link #Type()}, although they do share similar purposes.
The flags can be used to encode information about the token for use by other {@link Lucene.Net.Analysis.TokenFilter}s.
| |
GetHashCode | (Overrides AttributeImpl..::..GetHashCode()()()().) | |
GetPayload | Returns this Token's payload. | |
GetPositionIncrement | Returns the position increment of this Token. | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
Reinit(Token) | Copy the prototype token's fields into this one. Note: Payloads are shared. | |
Reinit(Token, String) | Copy the prototype token's fields into this one, with a different term. Note: Payloads are shared. | |
Reinit(String, Int32, Int32) | Shorthand for calling {@link #clear},
{@link #SetTermBuffer(String)},
{@link #setStartOffset},
{@link #setEndOffset}
{@link #setType} on Token.DEFAULT_TYPE
| |
Reinit(String, Int32, Int32, String) | Shorthand for calling {@link #clear},
{@link #SetTermBuffer(String)},
{@link #setStartOffset},
{@link #setEndOffset}
{@link #setType}
| |
Reinit(Token, array<Char>[]()[][], Int32, Int32) | Copy the prototype token's fields into this one, with a different term. Note: Payloads are shared. | |
Reinit(array<Char>[]()[][], Int32, Int32, Int32, Int32) | Shorthand for calling {@link #clear},
{@link #SetTermBuffer(char[], int, int)},
{@link #setStartOffset},
{@link #setEndOffset}
{@link #setType} on Token.DEFAULT_TYPE
| |
Reinit(String, Int32, Int32, Int32, Int32) | Shorthand for calling {@link #clear},
{@link #SetTermBuffer(String, int, int)},
{@link #setStartOffset},
{@link #setEndOffset}
{@link #setType} on Token.DEFAULT_TYPE
| |
Reinit(array<Char>[]()[][], Int32, Int32, Int32, Int32, String) | Shorthand for calling {@link #clear},
{@link #SetTermBuffer(char[], int, int)},
{@link #setStartOffset},
{@link #setEndOffset},
{@link #setType}
| |
Reinit(String, Int32, Int32, Int32, Int32, String) | Shorthand for calling {@link #clear},
{@link #SetTermBuffer(String, int, int)},
{@link #setStartOffset},
{@link #setEndOffset}
{@link #setType}
| |
ResizeTermBuffer | Grows the termBuffer to at least size newSize, preserving the
existing content. Note: If the next operation is to change
the contents of the term buffer use
{@link #SetTermBuffer(char[], int, int)},
{@link #SetTermBuffer(String)}, or
{@link #SetTermBuffer(String, int, int)}
to optimally combine the resize with the setting of the termBuffer.
| |
SetEndOffset | Set the ending offset. | |
SetFlags | ||
SetOffset | Set the starting and ending offset.
See StartOffset() and EndOffset()
| |
SetPayload | Sets this Token's payload. | |
SetPositionIncrement | Set the position increment. This determines the position of this token
relative to the previous Token in a {@link TokenStream}, used in phrase
searching.
The default value is one.
Some common uses for this are:
| |
SetStartOffset | Set the starting offset. | |
SetTermBuffer(String) | Copies the contents of buffer into the termBuffer array. | |
SetTermBuffer(array<Char>[]()[][], Int32, Int32) | Copies the contents of buffer, starting at offset for
length characters, into the termBuffer array.
| |
SetTermBuffer(String, Int32, Int32) | Copies the contents of buffer, starting at offset and continuing
for length characters, into the termBuffer array.
| |
SetTermLength | 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 {@link #ResizeTermBuffer(int)} first.
| |
SetTermText | Obsolete. Sets the Token's term text. NOTE: for better
indexing speed you should instead use the char[]
termBuffer methods to set the term text.
| |
SetType | Set the lexical type. | |
StartOffset | Returns this Token's starting offset, the position of the first character
corresponding to this token in the source text.
Note that the difference between endOffset() and startOffset() may not be
equal to termText.length(), as the term text may have been altered by a
stemmer or some other filter.
| |
Term | Returns the Token's term text.
This method has a performance penalty
because the text is stored internally in a char[]. If
possible, use {@link #TermBuffer()} and {@link
#TermLength()} directly instead. If you really need a
String, use this method, which is nothing more than
a convenience call to new String(token.termBuffer(), 0, token.termLength()) | |
TermBuffer | Returns the internal termBuffer character array which
you can then directly alter. If the array is too
small for your token, use {@link
#ResizeTermBuffer(int)} to increase it. After
altering the buffer be sure to call {@link
#setTermLength} to record the number of valid
characters that were placed into the termBuffer.
| |
TermLength | Return number of valid characters (length of the term)
in the termBuffer array.
| |
TermText | Returns the Token's term text.
| |
ToString | (Overrides AttributeImpl..::..ToString()()()().) | |
Type | Returns this Token's lexical type. Defaults to "word". |
Fields
Name | Description | |
---|---|---|
DEFAULT_TYPE |