Package org.apache.lucene.document
Class InetAddressRange
- java.lang.Object
-
- org.apache.lucene.document.Field
-
- org.apache.lucene.document.InetAddressRange
-
- All Implemented Interfaces:
IndexableField
public class InetAddressRange extends Field
An indexed InetAddress Range FieldThis 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
-
-
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 : sync w/InetAddressPoint
-
Fields inherited from class org.apache.lucene.document.Field
fieldsData, name, tokenStream, type
-
-
Constructor Summary
Constructors Constructor Description InetAddressRange(String name, InetAddress min, InetAddress max)
Create a new InetAddressRange from min/max value
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Query
newContainsQuery(String field, InetAddress min, InetAddress max)
Create a query for matching indexed ip ranges thatCONTAINS
the defined range.static Query
newCrossesQuery(String field, InetAddress min, InetAddress max)
Create a query for matching indexed ip ranges thatCROSS
the defined range.static Query
newIntersectsQuery(String field, InetAddress min, InetAddress max)
Create a query for matching indexed ip ranges thatINTERSECT
the defined range.static Query
newWithinQuery(String field, InetAddress min, InetAddress max)
Create a query for matching indexed ip ranges that areWITHIN
the defined range.void
setRangeValues(InetAddress min, InetAddress max)
Change (or set) the min/max values of the field.-
Methods inherited from class org.apache.lucene.document.Field
binaryValue, fieldType, getCharSequenceValue, name, numericValue, readerValue, setBytesValue, setBytesValue, setByteValue, setDoubleValue, setFloatValue, setIntValue, setLongValue, setReaderValue, setShortValue, setStringValue, setTokenStream, stringValue, tokenStream, tokenStreamValue, toString
-
-
-
-
Field Detail
-
BYTES
public static final int BYTES
The number of bytes per dimension : sync w/InetAddressPoint
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
InetAddressRange
public InetAddressRange(String name, InetAddress min, InetAddress max)
Create a new InetAddressRange from min/max value- Parameters:
name
- field name. must not be null.min
- range min value; defined as anInetAddress
max
- range max value; defined as anInetAddress
-
-
Method Detail
-
setRangeValues
public void setRangeValues(InetAddress min, InetAddress max)
Change (or set) the min/max values of the field.- Parameters:
min
- range min value; defined as anInetAddress
max
- range max value; defined as anInetAddress
-
newIntersectsQuery
public static Query newIntersectsQuery(String field, InetAddress min, InetAddress max)
Create a query for matching indexed ip ranges thatINTERSECT
the defined range.- Parameters:
field
- field name. must not be null.min
- range min value; provided as anInetAddress
max
- range max value; provided as anInetAddress
- Returns:
- query for matching intersecting ranges (overlap, within, crosses, or contains)
- Throws:
IllegalArgumentException
- iffield
is null,min
ormax
is invalid
-
newContainsQuery
public static Query newContainsQuery(String field, InetAddress min, InetAddress max)
Create a query for matching indexed ip ranges thatCONTAINS
the defined range.- Parameters:
field
- field name. must not be null.min
- range min value; provided as anInetAddress
max
- range max value; provided as anInetAddress
- Returns:
- query for matching intersecting ranges (overlap, within, crosses, or contains)
- Throws:
IllegalArgumentException
- iffield
is null,min
ormax
is invalid
-
newWithinQuery
public static Query newWithinQuery(String field, InetAddress min, InetAddress max)
Create a query for matching indexed ip ranges that areWITHIN
the defined range.- Parameters:
field
- field name. must not be null.min
- range min value; provided as anInetAddress
max
- range max value; provided as anInetAddress
- Returns:
- query for matching intersecting ranges (overlap, within, crosses, or contains)
- Throws:
IllegalArgumentException
- iffield
is null,min
ormax
is invalid
-
newCrossesQuery
public static Query newCrossesQuery(String field, InetAddress min, InetAddress max)
Create a query for matching indexed ip ranges thatCROSS
the defined range.- Parameters:
field
- field name. must not be null.min
- range min value; provided as anInetAddress
max
- range max value; provided as anInetAddress
- Returns:
- query for matching intersecting ranges (overlap, within, crosses, or contains)
- Throws:
IllegalArgumentException
- iffield
is null,min
ormax
is invalid
-
-