Package org.apache.lucene.sandbox.search

## Class MultiRangeQuery

- java.lang.Object
- - org.apache.lucene.search.Query
  - - org.apache.lucene.sandbox.search.MultiRangeQuery

- All Implemented Interfaces:
    `Cloneable`

      public abstract class MultiRangeQuery
      extends Query
      implements Cloneable

  Abstract class for range queries involving multiple ranges against physical points such as `IntPoints` All ranges are logically ORed together
  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `MultiRangeQuery.Builder` | A builder for multirange queries.
    `static class` | `MultiRangeQuery.RangeClause` | Representation of a single clause in a MultiRangeQuery

  - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `protected` | `MultiRangeQuery​(String field, int numDims, int bytesPerDim, List<MultiRangeQuery.RangeClause> rangeClauses)` | Expert: create a multidimensional range query with multiple connected ranges

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Weight` | `createWeight​(IndexSearcher searcher, ScoreMode scoreMode, float boost)` |
    `boolean` | `equals​(Object o)` |
    `int` | `getBytesPerDim()` |
    `String` | `getField()` |
    `int` | `getNumDims()` |
    `int` | `hashCode()` |
    `Query` | `rewrite​(IndexSearcher indexSearcher)` | Merges the overlapping ranges and returns unconnected ranges by calling `mergeOverlappingRanges(java.util.List<org.apache.lucene.sandbox.search.MultiRangeQuery.RangeClause>, int)`
    `protected abstract String` | `toString​(int dimension, byte[] value)` | Returns a string of a single value in a human-readable format for debugging.
    `String` | `toString​(String field)` |
    `void` | `visit​(QueryVisitor visitor)` |

    - ### Methods inherited from class org.apache.lucene.search.Query

      `classHash, rewrite, sameClassAs, toString`

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### MultiRangeQuery

          protected MultiRangeQuery​(String field,
                                    int numDims,
                                    int bytesPerDim,
                                    List<MultiRangeQuery.RangeClause> rangeClauses)

      Expert: create a multidimensional range query with multiple connected ranges
      Parameters:
        `field` - field name. must not be `null`.
        `rangeClauses` - Range Clauses for this query
        `numDims` - number of dimensions.

  - ### Method Detail

    - #### visit

          public void visit​(QueryVisitor visitor)

      Specified by:
        `visit` in class `Query`

    - #### rewrite

          public Query rewrite​(IndexSearcher indexSearcher)
                        throws IOException

      Merges the overlapping ranges and returns unconnected ranges by calling `mergeOverlappingRanges(java.util.List<org.apache.lucene.sandbox.search.MultiRangeQuery.RangeClause>, int)`
      Overrides:
        `rewrite` in class `Query`
      Throws:
        `IOException`

    - #### createWeight

          public final Weight createWeight​(IndexSearcher searcher,
                                           ScoreMode scoreMode,
                                           float boost)
                                    throws IOException

      Overrides:
        `createWeight` in class `Query`
      Throws:
        `IOException`

    - #### getField

          public String getField()

    - #### getNumDims

          public int getNumDims()

    - #### getBytesPerDim

          public int getBytesPerDim()

    - #### hashCode

          public final int hashCode()

      Specified by:
        `hashCode` in class `Query`

    - #### equals

          public final boolean equals​(Object o)

      Specified by:
        `equals` in class `Query`

    - #### toString

          public final String toString​(String field)

      Specified by:
        `toString` in class `Query`

    - #### toString

          protected abstract String toString​(int dimension,
                                             byte[] value)

      Returns a string of a single value in a human-readable format for debugging. This is used by `Query.toString()`.
      Parameters:
        `dimension` - dimension of the particular value
        `value` - single value, never null
      Returns:
        human readable value for debugging