## org.apache.lucene.search
Class RangeFilter

    java.lang.Object
      org.apache.lucene.search.Filter
          org.apache.lucene.search.RangeFilter

All Implemented Interfaces:
  Serializable

    public class RangeFilter

extends Filter

A Filter that restricts search results to a range of values in a given field.

This code borrows heavily from `RangeQuery`, but is implemented as a Filter

See Also:
  Serialized Form

Constructor Summary
`RangeFilter(String fieldName, String lowerTerm, String upperTerm, boolean includeLower, boolean includeUpper)`

Method Summary
`BitSet` `bits(IndexReader reader)` Returns a BitSet with true for documents which should be permitted in search results, and false for those that should not.
`boolean` `equals(Object o)` Returns true if `o` is equal to this.
`int` `hashCode()` Returns a hash code value for this object.
`static RangeFilter` `Less(String fieldName, String upperTerm)` Constructs a filter for field `fieldName` matching less than or equal to `upperTerm`.
`static RangeFilter` `More(String fieldName, String lowerTerm)` Constructs a filter for field `fieldName` matching greater than or equal to `lowerTerm`.
`String` `toString()`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### RangeFilter

    public RangeFilter(String fieldName,
                       String lowerTerm,
                       String upperTerm,
                       boolean includeLower,
                       boolean includeUpper)

Parameters:
  `fieldName` - The field this range applies to
  `lowerTerm` - The lower bound on this range
  `upperTerm` - The upper bound on this range
  `includeLower` - Does this range include the lower bound?
  `includeUpper` - Does this range include the upper bound?
Throws:
  `IllegalArgumentException` - if both terms are null or if lowerTerm is null and includeLower is true (similar for upperTerm and includeUpper)

Method Detail

### Less

    public static RangeFilter Less(String fieldName,
                                   String upperTerm)

  Constructs a filter for field `fieldName` matching less than or equal to `upperTerm`.

### More

    public static RangeFilter More(String fieldName,
                                   String lowerTerm)

  Constructs a filter for field `fieldName` matching greater than or equal to `lowerTerm`.

### bits

    public BitSet bits(IndexReader reader)
                throws IOException

  Returns a BitSet with true for documents which should be permitted in search results, and false for those that should not.

  Specified by:
    `bits` in class `Filter`
  Throws:
    `IOException`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### equals

    public boolean equals(Object o)

  Returns true if `o` is equal to this.

  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Returns a hash code value for this object.

  Overrides:
    `hashCode` in class `Object`

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