public final class FloatPoint extends Field
float
field for fast range filters. If you also
need to store the value, you should add a separate StoredField
instance.
Finding all documents within an N-dimensional at search time is efficient. Multiple values for the same field in one document is allowed.
This field defines static factory methods for creating common queries:
newExactQuery(String, float)
for matching an exact 1D point.
newSetQuery(String, float...)
for matching a set of 1D values.
newRangeQuery(String, float, float)
for matching a 1D range.
newRangeQuery(String, float[], float[])
for matching points/ranges in n-dimensional space.
PointValues
Field.Store
fieldsData, name, tokenStream, type
Constructor and Description |
---|
name,
float... point)
Creates a new FloatPoint, indexing the
provided N-dimensional float point.
|
Modifier and Type | Method and Description |
---|---|
static float |
decodeDimension(byte[] value,
int offset)
Decode single float dimension
|
static void |
encodeDimension(float value,
byte[] dest,
int offset)
Encode single float dimension
|
static Query |
field,
float value)
Create a query for matching an exact float value.
|
static Query |
field,
float[] lowerValue,
float[] upperValue)
Create a range query for n-dimensional float values.
|
static Query |
field,
float lowerValue,
float upperValue)
Create a range query for float values.
|
static Query |
field,
<> values)
Create a query matching any of the specified 1D values.
|
static Query |
field,
float... values)
Create a query matching any of the specified 1D values.
|
static float |
nextDown(float f)
Return the greatest float that compares less than
f consistently
with . |
static float |
nextUp(float f)
Return the least float that compares greater than
f consistently
with . |
|
numericValue()
Non-null if this field has a numeric value
|
static BytesRef |
pack(float... point)
Pack a float point into a BytesRef
|
void |
setBytesValue(BytesRef bytes)
Expert: change the value of this field.
|
void |
setFloatValue(float value)
Expert: change the value of this field.
|
void |
setFloatValues(float... point)
Change the values of this field
|
|
toString()
Prints a Field for human consumption.
|
binaryValue, fieldType, getCharSequenceValue, name, readerValue, setBytesValue, setByteValue, setDoubleValue, setIntValue, setLongValue, setReaderValue, setShortValue, setStringValue, setTokenStream, stringValue, tokenStream, tokenStreamValue
public FloatPoint( name, float... point)
name
- field namepoint
- float[] value
- if the field name or value is null.public static float nextUp(float f)
f
consistently
with . The only difference with
is that this method returns +0f
when
the argument is -0f
.public static float nextDown(float f)
f
consistently
with . The only difference with
is that this method returns -0f
when
the argument is +0f
.public void setFloatValue(float value)
Field
Field.setStringValue(String)
.setFloatValue
in class Field
public void setFloatValues(float... point)
public void setBytesValue(BytesRef bytes)
Field
Field.setStringValue(String)
.
NOTE: the provided BytesRef is not copied so be sure not to change it until you're done with this field.
setBytesValue
in class Field
public numericValue()
IndexableField
numericValue
in interface IndexableField
numericValue
in class Field
public static BytesRef pack(float... point)
point
- float[] value
- is the value is null or of zero lengthpublic toString()
Field
public static void encodeDimension(float value, byte[] dest, int offset)
public static float decodeDimension(byte[] value, int offset)
public static field, float value)
This is for simple one-dimension points, for multidimensional points use
newRangeQuery(String, float[], float[])
instead.
field
- field name. must not be null
.value
- float value
- if field
is null.public static field, float lowerValue, float upperValue)
This is for simple one-dimension ranges, for multidimensional ranges use
newRangeQuery(String, float[], float[])
instead.
You can have half-open ranges (which are in fact </≤ or >/≥ queries)
by setting lowerValue = Float.NEGATIVE_INFINITY
or upperValue = Float.POSITIVE_INFINITY
.
Ranges are inclusive. For exclusive ranges, pass nextUp(lowerValue)
or nextDown(upperValue)
.
Range comparisons are consistent with .
field
- field name. must not be null
.lowerValue
- lower portion of the range (inclusive).upperValue
- upper portion of the range (inclusive).
- if field
is null.public static field, float[] lowerValue, float[] upperValue)
You can have half-open ranges (which are in fact </≤ or >/≥ queries)
by setting lowerValue[i] = Float.NEGATIVE_INFINITY
or upperValue[i] = Float.POSITIVE_INFINITY
.
Ranges are inclusive. For exclusive ranges, pass Math#nextUp(lowerValue[i])
or Math.nextDown(upperValue[i])
.
Range comparisons are consistent with .
field
- field name. must not be null
.lowerValue
- lower portion of the range (inclusive). must not be null
.upperValue
- upper portion of the range (inclusive). must not be null
.
- if field
is null, if lowerValue
is null, if upperValue
is null,
or if lowerValue.length != upperValue.length
public static field, float... values)
TermsQuery
.field
- field name. must not be null
.values
- all values to matchpublic static field, <> values)
TermsQuery
.field
- field name. must not be null
.values
- all values to matchCopyright © 2000-2021 Apache Software Foundation. All Rights Reserved.