org.apache.lucene.search

## Class DocTermOrdsRangeFilter

- java.lang.Object
- - org.apache.lucene.search.Filter
  - - org.apache.lucene.search.DocTermOrdsRangeFilter

-     public abstract class DocTermOrdsRangeFilter
      extends Filter

  A range filter built on top of a cached multi-valued term field (in `FieldCache`).

  Like `FieldCacheRangeFilter`, this is just a specialized range query versus using a TermRangeQuery with `DocTermOrdsRewriteMethod`: it will only do two ordinal to term lookups.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)`
    `abstract DocIdSet` | `getDocIdSet(AtomicReaderContext context, Bits acceptDocs)` This method is implemented for each data type
    `String` | `getField()` Returns the field name for this filter
    `BytesRef` | `getLowerVal()` Returns the lower value of this range filter
    `BytesRef` | `getUpperVal()` Returns the upper value of this range filter
    `int` | `hashCode()`
    `boolean` | `includesLower()` Returns `true` if the lower endpoint is inclusive
    `boolean` | `includesUpper()` Returns `true` if the upper endpoint is inclusive
    `static DocTermOrdsRangeFilter` | `newBytesRefRange(String field, BytesRef lowerVal, BytesRef upperVal, boolean includeLower, boolean includeUpper)` Creates a BytesRef range filter using `FieldCache.getTermsIndex(org.apache.lucene.index.AtomicReader, java.lang.String)`.
    `String` | `toString()`

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

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

- - ### Method Detail

    - #### getDocIdSet

          public abstract DocIdSet getDocIdSet(AtomicReaderContext context,
                             Bits acceptDocs)
                                        throws IOException

      This method is implemented for each data type
      Specified by:
        `getDocIdSet` in class `Filter`
      Parameters:
        `context` - a `AtomicReaderContext` instance opened on the index currently searched on. Note, it is likely that the provided reader info does not represent the whole underlying index i.e. if the index has more than one segment the given reader only represents a single segment. The provided context is always an atomic context, so you can call `AtomicReader.fields()` on the context's reader, for example.
        `acceptDocs` - Bits that represent the allowable docs to match (typically deleted docs but possibly filtering other documents)
      Returns:
        a DocIdSet that provides the documents which should be permitted or prohibited in search results. NOTE: null can be returned if no documents will be accepted by this Filter.
      Throws:
        `IOException`

    - #### newBytesRefRange

          public static DocTermOrdsRangeFilter newBytesRefRange(String field,
                                                BytesRef lowerVal,
                                                BytesRef upperVal,
                                                boolean includeLower,
                                                boolean includeUpper)

      Creates a BytesRef range filter using `FieldCache.getTermsIndex(org.apache.lucene.index.AtomicReader, java.lang.String)`. This works with all fields containing zero or one term in the field. The range can be half-open by setting one of the values to `null`.

    - #### toString

          public final String toString()

      Overrides:
        `toString` in class `Object`

    - #### equals

          public final boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public final int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### getField

          public String getField()

      Returns the field name for this filter

    - #### includesLower

          public boolean includesLower()

      Returns `true` if the lower endpoint is inclusive

    - #### includesUpper

          public boolean includesUpper()

      Returns `true` if the upper endpoint is inclusive

    - #### getLowerVal

          public BytesRef getLowerVal()

      Returns the lower value of this range filter

    - #### getUpperVal

          public BytesRef getUpperVal()

      Returns the upper value of this range filter

Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.