Class SingleField
Field that indexes
document.Add(new SingleField(name, 6.0F, Field.Store.NO));
For optimal performance, re-use the Single FloatField field = new SingleField(name, 0.0F, Field.Store.NO);
Document document = new Document();
document.Add(field);
for (all documents)
{
...
field.SetSingleValue(value)
writer.AddDocument(document);
...
}
See also Int32Field, Int64Field,
DoubleTo perform range querying or filtering against a
Single
You may add the same field name as an Single
A Single
Within Lucene, each numeric value is indexed as a
trie structure, where each term is logically
assigned to larger and larger pre-defined brackets (which
are simply lower-precision representations of the value).
The step size between each successive bracket is called the
precisionStep
, measured in bits. Smaller
precisionStep
values result in larger number
of brackets, which consumes more disk space in the index
but may result in faster range search performance. The
default value, 4, was selected for a reasonable tradeoff
of disk space consumption versus performance. You can
create a custom Field
For more information on the internals of numeric trie
indexing, including the PrecisionprecisionStep
configuration, see NumericRangeQuery<T>. The format of
indexed values is described in Numeric
If you only need to sort by numeric value, and never
run range querying/filtering, you can index using a
precisionStep
of
More advanced users can instead use
Numeric
NOTE: This was FloatField in Lucene
@since 2.9Implements
Inherited Members
Namespace: Lucene.Net.Documents
Assembly: Lucene.Net.dll
Syntax
public sealed class SingleField : Field, IIndexableField
Constructors
| Improve this Doc View SourceSingleField(String, Single, Field.Store)
Creates a stored or un-stored SingleprecisionStep
PRECISION_STEP_DEFAULT
(4).
Declaration
public SingleField(string name, float value, Field.Store stored)
Parameters
Type | Name | Description |
---|---|---|
System. |
name | field name |
System. |
value | 32-bit |
Field. |
stored | YES if the content should also be stored |
SingleField(String, Single, FieldType)
Expert: allows you to customize the Field
Declaration
public SingleField(string name, float value, FieldType type)
Parameters
Type | Name | Description |
---|---|---|
System. |
name | field name |
System. |
value | 32-bit |
Field |
type | customized field type: must have Numeric |
Fields
| Improve this Doc View SourceTYPE_NOT_STORED
Type for a Single
Declaration
public static readonly FieldType TYPE_NOT_STORED
Field Value
Type | Description |
---|---|
Field |
TYPE_STORED
Type for a stored Single
Declaration
public static readonly FieldType TYPE_STORED
Field Value
Type | Description |
---|---|
Field |