public class IntRange extends 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 integer 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
Integer.MIN_VALUE
and Integer.MAX_VALUE
.
This field defines the following static factory methods for common search operations over integer 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.
Field.Store
Modifier and Type | Field and Description |
---|---|
static int |
BYTES
stores integer values so number of bytes is 4
|
fieldsData, name, tokenStream, type
Constructor and Description |
---|
IntRange(String name,
int[] min,
int[] max)
Create a new IntRange type, from min/max parallel arrays
|
Modifier and Type | Method and Description |
---|---|
int |
getMax(int dimension)
Get the max value for the given dimension
|
int |
getMin(int dimension)
Get the min value for the given dimension
|
static Query |
newContainsQuery(String field,
int[] min,
int[] max)
Create a query for matching indexed ranges that contain the defined range.
|
static Query |
newCrossesQuery(String field,
int[] min,
int[] max)
Create a query for matching indexed ranges that cross the defined range.
|
static Query |
newIntersectsQuery(String field,
int[] min,
int[] max)
Create a query for matching indexed ranges that intersect the defined range.
|
static Query |
newWithinQuery(String field,
int[] min,
int[] max)
Create a query for matching indexed ranges that are within the defined range.
|
void |
setRangeValues(int[] min,
int[] max)
Changes the values of the field.
|
String |
toString()
Prints a Field for human consumption.
|
binaryValue, fieldType, getCharSequenceValue, name, numericValue, readerValue, setBytesValue, setBytesValue, setByteValue, setDoubleValue, setFloatValue, setIntValue, setLongValue, setReaderValue, setShortValue, setStringValue, setTokenStream, stringValue, tokenStream, tokenStreamValue
public static final int BYTES
public IntRange(String name, int[] min, int[] max)
name
- field name. must not be null.min
- range min values; each entry is the min value for the dimensionmax
- range max values; each entry is the max value for the dimensionpublic void setRangeValues(int[] min, int[] max)
min
- array of min values. (accepts Integer.NEGATIVE_INFINITY
)max
- array of max values. (accepts Integer.POSITIVE_INFINITY
)IllegalArgumentException
- if min
or max
is invalidpublic int getMin(int dimension)
dimension
- the dimension, always positivepublic int getMax(int dimension)
dimension
- the dimension, always positivepublic static Query newIntersectsQuery(String field, int[] min, int[] max)
field
- field name. must not be null.min
- array of min values. (accepts Integer.MIN_VALUE
)max
- array of max values. (accepts Integer.MAX_VALUE
)IllegalArgumentException
- if field
is null, min
or max
is invalidpublic static Query newContainsQuery(String field, int[] min, int[] max)
field
- field name. must not be null.min
- array of min values. (accepts Integer.MIN_VALUE
)max
- array of max values. (accepts Integer.MAX_VALUE
)IllegalArgumentException
- if field
is null, min
or max
is invalidpublic static Query newWithinQuery(String field, int[] min, int[] max)
field
- field name. must not be null.min
- array of min values. (accepts Integer.MIN_VALUE
)max
- array of max values. (accepts Integer.MAX_VALUE
)IllegalArgumentException
- if field
is null, min
or max
is invalidpublic static Query newCrossesQuery(String field, int[] min, int[] max)
field
- field name. must not be null.min
- array of min values. (accepts Integer.MIN_VALUE
)max
- array of max values. (accepts Integer.MAX_VALUE
)IllegalArgumentException
- if field
is null, min
or max
is invalidCopyright © 2000-2021 Apache Software Foundation. All Rights Reserved.