Class BigIntegerPoint
- java.lang.Object
-
- org.apache.lucene.document.Field
-
- org.apache.lucene.document.BigIntegerPoint
-
- All Implemented Interfaces:
IndexableField
public class BigIntegerPoint extends Field
An indexed 128-bitBigInteger
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:
PointValues
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.lucene.document.Field
Field.Store
-
-
Field Summary
Fields Modifier and Type Field Description static int
BYTES
The number of bytes per dimension: 128 bits.static BigInteger
MAX_VALUE
A constant holding the maximum value a BigIntegerPoint can have, 2127-1.static BigInteger
MIN_VALUE
A 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
Constructors Constructor Description BigIntegerPoint(String name, BigInteger... point)
Creates a new BigIntegerPoint, indexing the provided N-dimensional big integer point.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static BigInteger
decodeDimension(byte[] value, int offset)
Decode single BigInteger dimensionstatic void
encodeDimension(BigInteger value, byte[] dest, int offset)
Encode single BigInteger dimensionstatic Query
newExactQuery(String field, BigInteger value)
Create a query for matching an exact big integer value.static Query
newRangeQuery(String field, BigInteger[] lowerValue, BigInteger[] upperValue)
Create a range query for n-dimensional big integer values.static Query
newRangeQuery(String field, BigInteger lowerValue, BigInteger upperValue)
Create a range query for big integer values.static Query
newSetQuery(String field, BigInteger... values)
Create a query matching any of the specified 1D values.Number
numericValue()
void
setBigIntegerValues(BigInteger... point)
Change the values of this fieldvoid
setBytesValue(BytesRef bytes)
String
toString()
-
Methods inherited from class org.apache.lucene.document.Field
binaryValue, fieldType, getCharSequenceValue, name, readerValue, setBytesValue, setByteValue, setDoubleValue, setFloatValue, setIntValue, setLongValue, setReaderValue, setShortValue, setStringValue, setTokenStream, stringValue, tokenStream, tokenStreamValue
-
-
-
-
Field Detail
-
BYTES
public static final int BYTES
The number of bytes per dimension: 128 bits.- See Also:
- Constant Field Values
-
MIN_VALUE
public static final BigInteger MIN_VALUE
A constant holding the minimum value a BigIntegerPoint can have, -2127.
-
MAX_VALUE
public static final BigInteger MAX_VALUE
A constant holding the maximum value a BigIntegerPoint can have, 2127-1.
-
-
Constructor Detail
-
BigIntegerPoint
public BigIntegerPoint(String name, BigInteger... point)
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 Detail
-
setBigIntegerValues
public void setBigIntegerValues(BigInteger... point)
Change the values of this field
-
setBytesValue
public void setBytesValue(BytesRef bytes)
- Overrides:
setBytesValue
in classField
-
numericValue
public Number numericValue()
- Specified by:
numericValue
in interfaceIndexableField
- Overrides:
numericValue
in classField
-
encodeDimension
public static void encodeDimension(BigInteger value, byte[] dest, int offset)
Encode single BigInteger dimension
-
decodeDimension
public static BigInteger decodeDimension(byte[] value, int offset)
Decode single BigInteger dimension
-
newExactQuery
public static Query newExactQuery(String field, BigInteger value)
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
- iffield
is null orvalue
is null.
-
newRangeQuery
public static Query newRangeQuery(String field, BigInteger lowerValue, BigInteger upperValue)
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_VALUE
orupperValue = 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
- iffield
is null,lowerValue
is null, orupperValue
is null.
-
newRangeQuery
public static Query newRangeQuery(String field, BigInteger[] lowerValue, BigInteger[] upperValue)
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_VALUE
orupperValue[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
- iffield
is null, iflowerValue
is null, ifupperValue
is null, or iflowerValue.length != upperValue.length
-
newSetQuery
public static Query newSetQuery(String field, BigInteger... values)
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
-
-