Class InetAddressPoint

    • 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 InetAddress MIN_VALUE
        The minimum value that an ip address can hold.
      • MAX_VALUE

        public static final InetAddress MAX_VALUE
        The maximum value that an ip address can hold.
    • Constructor Detail

      • InetAddressPoint

        public InetAddressPoint​(String name,
                                InetAddress point)
        Creates a new InetAddressPoint, indexing the provided address.
        Parameters:
        name - field name
        point - InetAddress value
        Throws:
        IllegalArgumentException - if the field name or value is null.
    • Method Detail

      • setInetAddressValue

        public void setInetAddressValue​(InetAddress value)
        Change the values of this field
      • encode

        public static byte[] encode​(InetAddress value)
        Encode InetAddress value into binary encoding
      • decode

        public static InetAddress decode​(byte[] value)
        Decodes InetAddress value from binary encoding
      • newExactQuery

        public static Query newExactQuery​(String field,
                                          InetAddress value)
        Create a query for matching a network address.
        Parameters:
        field - field name. must not be null.
        value - exact value
        Returns:
        a query matching documents with this exact value
        Throws:
        IllegalArgumentException - if field is null.
      • newPrefixQuery

        public static Query newPrefixQuery​(String field,
                                           InetAddress value,
                                           int prefixLength)
        Create a prefix query for matching a CIDR network range.
        Parameters:
        field - field name. must not be null.
        value - any host address
        prefixLength - the network prefix length for this address. This is also known as the subnet mask in the context of IPv4 addresses.
        Returns:
        a query matching documents with addresses contained within this network
        Throws:
        IllegalArgumentException - if field is null, or prefixLength is invalid.
      • newRangeQuery

        public static Query newRangeQuery​(String field,
                                          InetAddress lowerValue,
                                          InetAddress upperValue)
        Create a range query for network addresses.

        You can have half-open ranges (which are in fact </≤ or >/≥ queries) by setting lowerValue = InetAddressPoint.MIN_VALUE or upperValue = InetAddressPoint.MAX_VALUE.

        Ranges are inclusive. For exclusive ranges, pass InetAddressPoint#nextUp(lowerValue) or InetAddressPoint#nexDown(upperValue).

        Parameters:
        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.
        Returns:
        a query matching documents within this range.
        Throws:
        IllegalArgumentException - if field is null, lowerValue is null, or upperValue is null
      • newSetQuery

        public static Query newSetQuery​(String field,
                                        InetAddress... values)
        Create a query matching any of the specified 1D values. This is the points equivalent of TermsQuery.
        Parameters:
        field - field name. must not be null.
        values - all values to match