org.hibernate.search.bridge.util.impl

## Class NumericFieldUtils

- java.lang.Object
- - org.hibernate.search.bridge.util.impl.NumericFieldUtils

-     public final class NumericFieldUtils
      extends Object

  Utility class to handle numeric fields.
  Author:
    Gustavo Fernandes, Hardy Ferentschik

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Query` | `createExactMatchQuery(String fieldName, Object value)` Will create a `RangeQuery` matching exactly the provided value: lower and upper value match, and bounds are included.
    `static Query` | `createNumericRangeQuery(String fieldName, Object from, Object to, boolean includeLower, boolean includeUpper)`
    `static boolean` | `isNumericContainerOrNumericFieldBridge(FieldBridge fieldBridge)` Indicates whether the considered `FieldBridge`, or its `element bridge`, is a numeric one.
    `static boolean` | `isNumericFieldBridge(FieldBridge fieldBridge)` Indicates whether the considered `FieldBridge` is a numeric one.
    `static boolean` | `requiresNumericRangeQuery(Object value)` When the type of `RangeQuery` needs to be guessed among keyword based ranges or numeric based range queries, the parameter type defines the strategy.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### createNumericRangeQuery

          public static Query createNumericRangeQuery(String fieldName,
                                                      Object from,
                                                      Object to,
                                                      boolean includeLower,
                                                      boolean includeUpper)

    - #### createExactMatchQuery

          public static Query createExactMatchQuery(String fieldName,
                                                    Object value)

      Will create a `RangeQuery` matching exactly the provided value: lower and upper value match, and bounds are included. This should perform as efficiently as a TermQuery.
      Parameters:
        `fieldName` - the field name the query targets
        `value` - the value to match
      Returns:
        the created `Query`

    - #### requiresNumericRangeQuery

          public static boolean requiresNumericRangeQuery(Object value)

      When the type of `RangeQuery` needs to be guessed among keyword based ranges or numeric based range queries, the parameter type defines the strategy. Note that this is currently only used by the Infinispan backend as a fallback and it should be used with a lot of caution as it does not take into account backend specific behaviors. For instance, when indexing on Elasticsearch, Dates require a keyword range query. This should match the default `FieldBridge` used for each type.
      Parameters:
        `value` - on Object
      Returns:
        true if the value argument is of any type which is by default indexed as a NumericField

    - #### isNumericFieldBridge

          public static boolean isNumericFieldBridge(FieldBridge fieldBridge)

      Indicates whether the considered `FieldBridge` is a numeric one.
      Parameters:
        `fieldBridge` - the considered `FieldBridge`
      Returns:
        true if the considered `FieldBridge` is a numeric `FieldBridge`

    - #### isNumericContainerOrNumericFieldBridge

          public static boolean isNumericContainerOrNumericFieldBridge(FieldBridge fieldBridge)

      Indicates whether the considered `FieldBridge`, or its `element bridge`, is a numeric one.
      Parameters:
        `fieldBridge` - the considered `FieldBridge`
      Returns:
        true if the considered `FieldBridge` is a numeric `FieldBridge`

Copyright © 2006-2017 Red Hat, Inc. All Rights Reserved