public class InetAddressRange extends Field
This field indexes an InetAddress
range defined as a min/max pairs. It is single
dimension only (indexed as two 16 byte paired values).
Multiple values are supported.
This field defines the following static factory methods for common search operations over Ip Ranges
newIntersectsQuery()
matches ip ranges that intersect the defined search range.
newWithinQuery()
matches ip ranges that are within the defined search range.
newContainsQuery()
matches ip ranges that contain the defined search range.
newCrossesQuery()
matches ip ranges that cross the defined search range
Field.Store
Modifier and Type | Field and Description |
---|---|
static int |
BYTES
The number of bytes per dimension : sync w/
InetAddressPoint |
private static FieldType |
TYPE |
fieldsData, name, tokenStream, type
Constructor and Description |
---|
InetAddressRange(java.lang.String name,
java.net.InetAddress min,
java.net.InetAddress max)
Create a new InetAddressRange from min/max value
|
Modifier and Type | Method and Description |
---|---|
private static byte[] |
encode(java.net.InetAddress min,
java.net.InetAddress max)
encode the min/max range and return the byte array
|
private static void |
encode(java.net.InetAddress min,
java.net.InetAddress max,
byte[] bytes)
encode the min/max range into the provided byte array
|
static Query |
newContainsQuery(java.lang.String field,
java.net.InetAddress min,
java.net.InetAddress max)
Create a query for matching indexed ip ranges that
CONTAINS the defined range. |
static Query |
newCrossesQuery(java.lang.String field,
java.net.InetAddress min,
java.net.InetAddress max)
Create a query for matching indexed ip ranges that
CROSS the defined range. |
static Query |
newIntersectsQuery(java.lang.String field,
java.net.InetAddress min,
java.net.InetAddress max)
Create a query for matching indexed ip ranges that
INTERSECT the defined range. |
private static Query |
newRelationQuery(java.lang.String field,
java.net.InetAddress min,
java.net.InetAddress max,
RangeFieldQuery.QueryType relation)
helper method for creating the desired relational query
|
static Query |
newWithinQuery(java.lang.String field,
java.net.InetAddress min,
java.net.InetAddress max)
Create a query for matching indexed ip ranges that are
WITHIN the defined range. |
void |
setRangeValues(java.net.InetAddress min,
java.net.InetAddress max)
Change (or set) the min/max values of the field.
|
private static java.lang.String |
toString(byte[] ranges,
int dimension)
Returns the String representation for the range at the given dimension
|
binaryValue, fieldType, getCharSequenceValue, name, numericValue, readerValue, setBytesValue, setBytesValue, setByteValue, setDoubleValue, setFloatValue, setIntValue, setLongValue, setReaderValue, setShortValue, setStringValue, setTokenStream, stringValue, tokenStream, tokenStreamValue, toString
public static final int BYTES
InetAddressPoint
private static final FieldType TYPE
public InetAddressRange(java.lang.String name, java.net.InetAddress min, java.net.InetAddress max)
name
- field name. must not be null.min
- range min value; defined as an InetAddress
max
- range max value; defined as an InetAddress
public void setRangeValues(java.net.InetAddress min, java.net.InetAddress max)
min
- range min value; defined as an InetAddress
max
- range max value; defined as an InetAddress
private static void encode(java.net.InetAddress min, java.net.InetAddress max, byte[] bytes)
private static byte[] encode(java.net.InetAddress min, java.net.InetAddress max)
public static Query newIntersectsQuery(java.lang.String field, java.net.InetAddress min, java.net.InetAddress max)
INTERSECT
the defined range.field
- field name. must not be null.min
- range min value; provided as an InetAddress
max
- range max value; provided as an InetAddress
java.lang.IllegalArgumentException
- if field
is null, min
or max
is invalidpublic static Query newContainsQuery(java.lang.String field, java.net.InetAddress min, java.net.InetAddress max)
CONTAINS
the defined range.field
- field name. must not be null.min
- range min value; provided as an InetAddress
max
- range max value; provided as an InetAddress
java.lang.IllegalArgumentException
- if field
is null, min
or max
is invalidpublic static Query newWithinQuery(java.lang.String field, java.net.InetAddress min, java.net.InetAddress max)
WITHIN
the defined range.field
- field name. must not be null.min
- range min value; provided as an InetAddress
max
- range max value; provided as an InetAddress
java.lang.IllegalArgumentException
- if field
is null, min
or max
is invalidpublic static Query newCrossesQuery(java.lang.String field, java.net.InetAddress min, java.net.InetAddress max)
CROSS
the defined range.field
- field name. must not be null.min
- range min value; provided as an InetAddress
max
- range max value; provided as an InetAddress
java.lang.IllegalArgumentException
- if field
is null, min
or max
is invalidprivate static Query newRelationQuery(java.lang.String field, java.net.InetAddress min, java.net.InetAddress max, RangeFieldQuery.QueryType relation)
private static java.lang.String toString(byte[] ranges, int dimension)
ranges
- the encoded ranges, never nulldimension
- the dimension of interest (not used for this field)