Class NumericTokenStream
Expert: This class provides a Token
Note that for simple usage, Numeric
See Numeric
Here's an example usage, for an int
field:
Field field = new Field(name, new NumericTokenStream(precisionStep).setIntValue(value));
field.setOmitNorms(true);
field.setOmitTermFreqAndPositions(true);
document.add(field);
For optimal performance, re-use the TokenStream and Field instance for more than one document:
NumericTokenStream stream = new NumericTokenStream(precisionStep);
Field field = new Field(name, stream);
field.setOmitNorms(true);
field.setOmitTermFreqAndPositions(true);
Document document = new Document();
document.add(field);
for(all documents) {
stream.setIntValue(value)
writer.addDocument(document);
}
This stream is not intended to be used in analyzers; it's more for iterating the different precisions during indexing a specific numeric value.
NOTE: as token streams are only consumed once
the document is added to the index, if you index more
than one numeric field, use a separate NumericTokenStream
instance for each.
See NumericRangeQuery<T> for more details on the
precisionStep
parameter as well as how numeric fields work under the hood.
NOTE: This API is experimental and might change in incompatible ways in the next release. Since 2.9
Namespace:
Assembly: Lucene.Net.NetCore.dll
Syntax
public sealed class NumericTokenStream : TokenStream, IDisposable
Constructors
Name | Description |
---|---|
Numeric |
Creates a token stream for numeric values using the default |
Numeric |
Expert: Creates a token stream for numeric values with the specified
|
Numeric |
Expert: Creates a token stream for numeric values with the specified
|
Numeric |
Creates a token stream for numeric values with the specified
|
Fields
Name | Description |
---|---|
TOKEN_TYPE_FULL_PREC | The full precision token gets this token type assigned. |
TOKEN_TYPE_LOWER_PREC | The lower precision tokens gets this token type assigned. |
Methods
Name | Description |
---|---|
Dispose(Boolean) | |
Increment |
|
Reset() | |
Set |
Initializes the token stream with the supplied |
Set |
Initializes the token stream with the supplied |
Set |
Initializes the token stream with the supplied |
Set |
Initializes the token stream with the supplied |
To |