public class BigIntegerPoint extends Field
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.
PointValues
Field.Store
Modifier and Type | Field and Description |
---|---|
static int |
BYTES
The number of bytes per dimension: 128 bits.
|
static java.math.BigInteger |
MAX_VALUE
A constant holding the maximum value a BigIntegerPoint can have, 2127-1.
|
static java.math.BigInteger |
MIN_VALUE
A constant holding the minimum value a BigIntegerPoint can have, -2127.
|
fieldsData, name, tokenStream, type
Constructor and Description |
---|
BigIntegerPoint(java.lang.String name,
java.math.BigInteger... point)
Creates a new BigIntegerPoint, indexing the
provided N-dimensional big integer point.
|
Modifier and Type | Method and Description |
---|---|
static java.math.BigInteger |
decodeDimension(byte[] value,
int offset)
Decode single BigInteger dimension
|
static void |
encodeDimension(java.math.BigInteger value,
byte[] dest,
int offset)
Encode single BigInteger dimension
|
private static FieldType |
getType(int numDims) |
static Query |
newExactQuery(java.lang.String field,
java.math.BigInteger value)
Create a query for matching an exact big integer value.
|
static Query |
newRangeQuery(java.lang.String field,
java.math.BigInteger[] lowerValue,
java.math.BigInteger[] upperValue)
Create a range query for n-dimensional big integer values.
|
static Query |
newRangeQuery(java.lang.String field,
java.math.BigInteger lowerValue,
java.math.BigInteger upperValue)
Create a range query for big integer values.
|
static Query |
newSetQuery(java.lang.String field,
java.math.BigInteger... values)
Create a query matching any of the specified 1D values.
|
java.lang.Number |
numericValue()
Non-null if this field has a numeric value
|
private static BytesRef |
pack(java.math.BigInteger... point) |
void |
setBigIntegerValues(java.math.BigInteger... point)
Change the values of this field
|
void |
setBytesValue(BytesRef bytes)
Expert: change the value of this field.
|
java.lang.String |
toString()
Prints a Field for human consumption.
|
binaryValue, fieldType, getCharSequenceValue, name, readerValue, setBytesValue, setByteValue, setDoubleValue, setFloatValue, setIntValue, setLongValue, setReaderValue, setShortValue, setStringValue, setTokenStream, stringValue, tokenStream, tokenStreamValue
public static final int BYTES
public static final java.math.BigInteger MIN_VALUE
public static final java.math.BigInteger MAX_VALUE
public BigIntegerPoint(java.lang.String name, java.math.BigInteger... point)
name
- field namepoint
- BigInteger[] valuejava.lang.IllegalArgumentException
- if the field name or value is null.private static FieldType getType(int numDims)
public void setBigIntegerValues(java.math.BigInteger... 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 java.lang.Number numericValue()
IndexableField
numericValue
in interface IndexableField
numericValue
in class Field
private static BytesRef pack(java.math.BigInteger... point)
public java.lang.String toString()
Field
public static void encodeDimension(java.math.BigInteger value, byte[] dest, int offset)
public static java.math.BigInteger decodeDimension(byte[] value, int offset)
public static Query newExactQuery(java.lang.String field, java.math.BigInteger value)
This is for simple one-dimension points, for multidimensional points use
newRangeQuery(String, BigInteger[], BigInteger[])
instead.
field
- field name. must not be null
.value
- exact value. must not be null
.java.lang.IllegalArgumentException
- if field
is null or value
is null.public static Query newRangeQuery(java.lang.String field, java.math.BigInteger lowerValue, java.math.BigInteger upperValue)
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
or upperValue = BigIntegerPoint.MAX_VALUE
.
Ranges are inclusive. For exclusive ranges, pass lowerValue.add(BigInteger.ONE)
or upperValue.subtract(BigInteger.ONE)
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
.java.lang.IllegalArgumentException
- if field
is null, lowerValue
is null, or upperValue
is null.public static Query newRangeQuery(java.lang.String field, java.math.BigInteger[] lowerValue, java.math.BigInteger[] upperValue)
You can have half-open ranges (which are in fact </≤ or >/≥ queries)
by setting lowerValue[i] = BigIntegerPoint.MIN_VALUE
or upperValue[i] = BigIntegerPoint.MAX_VALUE
.
Ranges are inclusive. For exclusive ranges, pass lowerValue[i].add(BigInteger.ONE)
or upperValue[i].subtract(BigInteger.ONE)
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
.java.lang.IllegalArgumentException
- if field
is null, if lowerValue
is null, if upperValue
is null,
or if lowerValue.length != upperValue.length
public static Query newSetQuery(java.lang.String field, java.math.BigInteger... values)
TermsQuery
.field
- field name. must not be null
.values
- all values to match