An indexed Float Range field.
This field indexes dimensional ranges defined as min/max pairs. It supports up to a maximum of 4 dimensions (indexed as 8 numeric values). With 1 dimension representing a single float range, 2 dimensions representing a bounding box, 3 dimensions a bounding cube, and 4 dimensions a tesseract.
Multiple values for the same field in one document is supported, and open ended ranges can be
defined using Float.NEGATIVE_INFINITY and Float.POSITIVE_INFINITY.
This field defines the following static factory methods for common search operations over float ranges:
newIntersectsQuery() matches ranges that intersect the defined
search range.
newWithinQuery() matches ranges that are within the defined search
range.
newContainsQuery() matches ranges that contain the defined search
range.
| constant | type | note |
|---|---|---|
| BYTES | int | stores float values so number of bytes is 4 |
<init>(String name, float[] min, float[] max)Create a new FloatRange type, from min/max parallel arrays
| name | type | description |
|---|---|---|
| name | String | field name. must not be null. |
| min | float[] | range min values; each entry is the min value for the dimension |
| max | float[] | range max values; each entry is the max value for the dimension |
newContainsQuery(String field, float[] min, float[] max)Create a query for matching indexed float ranges that contain the defined range.
| name | type | description |
|---|---|---|
| field | String | field name. must not be null. |
| min | float[] | array of min values. (accepts Float.NEGATIVE_INFINITY) |
| max | float[] | array of max values. (accepts Float.POSITIVE_INFINITY) |
Returns: query for matching ranges that contain the defined range
| IllegalArgumentException | if field is null, min or max is
invalid |
|
newCrossesQuery(String field, float[] min, float[] max)Create a query for matching indexed ranges that cross the defined range. A CROSSES is defined as any set of ranges that are not disjoint and not wholly contained by the query. Effectively, its the complement of union(WITHIN, DISJOINT).
| name | type | description |
|---|---|---|
| field | String | field name. must not be null. |
| min | float[] | array of min values. (accepts Float.NEGATIVE_INFINITY) |
| max | float[] | array of max values. (accepts Float.POSITIVE_INFINITY) |
Returns: query for matching ranges within the defined range
| IllegalArgumentException | if field is null, min or max is
invalid |
|
newIntersectsQuery(String field, float[] min, float[] max)Create a query for matching indexed ranges that intersect the defined range.
| name | type | description |
|---|---|---|
| field | String | field name. must not be null. |
| min | float[] | array of min values. (accepts Float.NEGATIVE_INFINITY) |
| max | float[] | array of max values. (accepts Float.MAX_VALUE) |
Returns: query for matching intersecting ranges (overlap, within, or contains)
| IllegalArgumentException | if field is null, min or max is
invalid |
|
newWithinQuery(String field, float[] min, float[] max)Create a query for matching indexed ranges that are within the defined range.
| name | type | description |
|---|---|---|
| field | String | field name. must not be null. |
| min | float[] | array of min values. (accepts Float.NEGATIVE_INFINITY) |
| max | float[] | array of max values. (accepts Float.POSITIVE_INFINITY) |
Returns: query for matching ranges within the defined range
| IllegalArgumentException | if field is null, min or max is
invalid |
|
getMax(int dimension)Get the max value for the given dimension
| name | type | description |
|---|---|---|
| dimension | int | the dimension, always positive |
Returns: the decoded max value
getMin(int dimension)Get the min value for the given dimension
| name | type | description |
|---|---|---|
| dimension | int | the dimension, always positive |
Returns: the decoded min value
setRangeValues(float[] min, float[] max)Changes the values of the field.
| name | type | description |
|---|---|---|
| min | float[] | array of min values. (accepts Float.NEGATIVE_INFINITY) |
| max | float[] | array of max values. (accepts Float.POSITIVE_INFINITY) |
| IllegalArgumentException | if min or max is invalid |
|
toString()setByteValue(byte value) · also: set_byte_valueExpert: change the value of this field. See #setStringValue(String).
setBytesValue(byte[] value) · also: set_bytes_valueExpert: change the value of this field. See #setStringValue(String).
setBytesValue(org.apache.lucene.util.BytesRef value) · also: set_bytes_valueExpert: change the value of this field. See #setStringValue(String).
NOTE: the provided BytesRef is not copied so be sure not to change it until you're done with this field.
getCharSequenceValue() · also: get_char_sequence_valuesetDoubleValue(double value) · also: set_double_valueExpert: change the value of this field. See #setStringValue(String).
Returns the FieldType for this field.
setFloatValue(float value) · also: set_float_valueExpert: change the value of this field. See #setStringValue(String).
setIntValue(int value) · also: set_int_valueExpert: change the value of this field. See #setStringValue(String).
setLongValue(long value) · also: set_long_valueExpert: change the value of this field. See #setStringValue(String).
name()numericValue()readerValue()The value of the field as a Reader, or null. If null, the String value or binary value is used. Exactly one of stringValue(), readerValue(), and binaryValue() must be set.
setReaderValue(java.io.Reader value) · also: set_reader_valueExpert: change the value of this field. See #setStringValue(String).
setShortValue(short value) · also: set_short_valueExpert: change the value of this field. See #setStringValue(String).
stringValue()The value of the field as a String, or null. If null, the Reader value or binary value is used. Exactly one of stringValue(), readerValue(), and binaryValue() must be set.
setStringValue(String value) · also: set_string_valueExpert: change the value of this field. This can be used during indexing to re-use a single
Field instance to improve indexing speed by avoiding GC cost of new'ing and reclaiming Field
instances. Typically a single Document instance is re-used as well. This helps most on
small documents.
Each Field instance should only be used once within a single Document instance. See
ImproveIndexingSpeed for
details.
tokenStream(org.apache.lucene.analysis.Analyzer analyzer, org.apache.lucene.analysis.TokenStream reuse)setTokenStream(org.apache.lucene.analysis.TokenStream tokenStream) · also: set_token_streamExpert: sets the token stream to be used for indexing.
The TokenStream for this field to be used when indexing, or null. If null, the Reader value or String value is analyzed to produce the indexed tokens.