public class InetAddressPoint extends Field
InetAddress field.
Finding all documents within a 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, InetAddress) for matching an exact network address.
newPrefixQuery(String, InetAddress, int) for matching a network based on CIDR prefix.
newRangeQuery(String, InetAddress, InetAddress) for matching arbitrary network address ranges.
newSetQuery(String, InetAddress...) for matching a set of 1D values.
This field supports both IPv4 and IPv6 addresses: IPv4 addresses are converted
to IPv4-Mapped IPv6 Addresses:
indexing 1.2.3.4 is the same as indexing ::FFFF:1.2.3.4.
PointValuesField.Store| Modifier and Type | Field and Description |
|---|---|
static int |
BYTES
The number of bytes per dimension: 128 bits
|
boost, fieldsData, name, tokenStream, type| Constructor and Description |
|---|
InetAddressPoint(String name,
InetAddress point)
Creates a new InetAddressPoint, indexing the
provided address.
|
| Modifier and Type | Method and Description |
|---|---|
static InetAddress |
decode(byte[] value)
Decodes InetAddress value from binary encoding
|
static byte[] |
encode(InetAddress value)
Encode InetAddress value into binary encoding
|
static Query |
newExactQuery(String field,
InetAddress value)
Create a query for matching a network address.
|
static Query |
newPrefixQuery(String field,
InetAddress value,
int prefixLength)
Create a prefix query for matching a CIDR network range.
|
static Query |
newRangeQuery(String field,
InetAddress lowerValue,
InetAddress upperValue)
Create a range query for network addresses.
|
static Query |
newSetQuery(String field,
InetAddress... values)
Create a query matching any of the specified 1D values.
|
void |
setBytesValue(BytesRef bytes) |
void |
setInetAddressValue(InetAddress value)
Change the values of this field
|
String |
toString() |
binaryValue, boost, fieldType, name, numericValue, readerValue, setBoost, setBytesValue, setByteValue, setDoubleValue, setFloatValue, setIntValue, setLongValue, setReaderValue, setShortValue, setStringValue, setTokenStream, stringValue, tokenStream, tokenStreamValuepublic static final int BYTES
public InetAddressPoint(String name, InetAddress point)
name - field namepoint - InetAddress valueIllegalArgumentException - if the field name or value is null.public void setInetAddressValue(InetAddress value)
public void setBytesValue(BytesRef bytes)
setBytesValue in class Fieldpublic static byte[] encode(InetAddress value)
public static InetAddress decode(byte[] value)
public static Query newExactQuery(String field, InetAddress value)
field - field name. must not be null.value - exact valueIllegalArgumentException - if field is null.public static Query newPrefixQuery(String field, InetAddress value, int prefixLength)
field - field name. must not be null.value - any host addressprefixLength - the network prefix length for this address. This is also known as the subnet mask in the context of IPv4 addresses.IllegalArgumentException - if field is null, or prefixLength is invalid.public static Query newRangeQuery(String field, InetAddress lowerValue, InetAddress upperValue)
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.IllegalArgumentException - if field is null, lowerValue is null,
or upperValue is nullpublic static Query newSetQuery(String field, InetAddress... values)
TermsQuery.field - field name. must not be null.values - all values to matchCopyright © 2000-2016 Apache Software Foundation. All Rights Reserved.