- All Implemented Interfaces:
IndexableField
BigInteger field.
Finding all documents within an N-dimensional shape or range 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, BigInteger)for matching an exact 1D point.newSetQuery(String, BigInteger...)for matching a set of 1D values.newRangeQuery(String, BigInteger, BigInteger)for matching a 1D range.newRangeQuery(String, BigInteger[], BigInteger[])for matching points/ranges in n-dimensional space.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.lucene.document.Field
Field.Store -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe number of bytes per dimension: 128 bits.static final BigIntegerA constant holding the maximum value a BigIntegerPoint can have, 2127-1.static final BigIntegerA constant holding the minimum value a BigIntegerPoint can have, -2127.Fields inherited from class org.apache.lucene.document.Field
fieldsData, name, tokenStream, type -
Constructor Summary
ConstructorsConstructorDescriptionBigIntegerPoint(String name, BigInteger... point) Creates a new BigIntegerPoint, indexing the provided N-dimensional big integer point. -
Method Summary
Modifier and TypeMethodDescriptionstatic BigIntegerdecodeDimension(byte[] value, int offset) Decode single BigInteger dimensionstatic voidencodeDimension(BigInteger value, byte[] dest, int offset) Encode single BigInteger dimensionprivate static FieldTypegetType(int numDims) static QuerynewExactQuery(String field, BigInteger value) Create a query for matching an exact big integer value.static QuerynewRangeQuery(String field, BigInteger[] lowerValue, BigInteger[] upperValue) Create a range query for n-dimensional big integer values.static QuerynewRangeQuery(String field, BigInteger lowerValue, BigInteger upperValue) Create a range query for big integer values.static QuerynewSetQuery(String field, BigInteger... values) Create a query matching any of the specified 1D values.Non-null if this field has a numeric valueprivate static BytesRefpack(BigInteger... point) voidsetBigIntegerValues(BigInteger... point) Change the values of this fieldvoidsetBytesValue(BytesRef bytes) Expert: change the value of this field.toString()Prints a Field for human consumption.Methods inherited from class org.apache.lucene.document.Field
binaryValue, fieldType, getCharSequenceValue, invertableType, name, readerValue, setBytesValue, setByteValue, setDoubleValue, setFloatValue, setIntValue, setLongValue, setReaderValue, setShortValue, setStringValue, setTokenStream, storedValue, stringValue, tokenStream, tokenStreamValue
-
Field Details
-
BYTES
public static final int BYTESThe number of bytes per dimension: 128 bits.- See Also:
-
MIN_VALUE
A constant holding the minimum value a BigIntegerPoint can have, -2127. -
MAX_VALUE
A constant holding the maximum value a BigIntegerPoint can have, 2127-1.
-
-
Constructor Details
-
BigIntegerPoint
Creates a new BigIntegerPoint, indexing the provided N-dimensional big integer point.- Parameters:
name- field namepoint- BigInteger[] value- Throws:
IllegalArgumentException- if the field name or value is null.
-
-
Method Details
-
getType
-
setBigIntegerValues
Change the values of this field -
setBytesValue
Description copied from class:FieldExpert: change the value of this field. SeeField.setStringValue(String).NOTE: the provided BytesRef is not copied so be sure not to change it until you're done with this field.
- Overrides:
setBytesValuein classField
-
numericValue
Description copied from interface:IndexableFieldNon-null if this field has a numeric value- Specified by:
numericValuein interfaceIndexableField- Overrides:
numericValuein classField
-
pack
-
toString
Description copied from class:FieldPrints a Field for human consumption. -
encodeDimension
Encode single BigInteger dimension -
decodeDimension
Decode single BigInteger dimension -
newExactQuery
Create a query for matching an exact big integer value.This is for simple one-dimension points, for multidimensional points use
newRangeQuery(String, BigInteger[], BigInteger[])instead.- Parameters:
field- field name. must not benull.value- exact value. must not benull.- Returns:
- a query matching documents with this exact value
- Throws:
IllegalArgumentException- iffieldis null orvalueis null.
-
newRangeQuery
Create a range query for big integer values.This is for simple one-dimension ranges, for multidimensional ranges use
newRangeQuery(String, BigInteger[], BigInteger[])instead.You can have half-open ranges (which are in fact </≤ or >/≥ queries) by setting
lowerValue = BigIntegerPoint.MIN_VALUEorupperValue = BigIntegerPoint.MAX_VALUE.Ranges are inclusive. For exclusive ranges, pass
lowerValue.add(BigInteger.ONE)orupperValue.subtract(BigInteger.ONE)- Parameters:
field- field name. must not benull.lowerValue- lower portion of the range (inclusive). must not benull.upperValue- upper portion of the range (inclusive). must not benull.- Returns:
- a query matching documents within this range.
- Throws:
IllegalArgumentException- iffieldis null,lowerValueis null, orupperValueis null.
-
newRangeQuery
Create a range query for n-dimensional big integer values.You can have half-open ranges (which are in fact </≤ or >/≥ queries) by setting
lowerValue[i] = BigIntegerPoint.MIN_VALUEorupperValue[i] = BigIntegerPoint.MAX_VALUE.Ranges are inclusive. For exclusive ranges, pass
lowerValue[i].add(BigInteger.ONE)orupperValue[i].subtract(BigInteger.ONE)- Parameters:
field- field name. must not benull.lowerValue- lower portion of the range (inclusive). must not benull.upperValue- upper portion of the range (inclusive). must not benull.- Returns:
- a query matching documents within this range.
- Throws:
IllegalArgumentException- iffieldis null, iflowerValueis null, ifupperValueis null, or iflowerValue.length != upperValue.length
-
newSetQuery
Create a query matching any of the specified 1D values. This is the points equivalent ofTermsQuery.- Parameters:
field- field name. must not benull.values- all values to match
-