Save This Page
Home » lucene-2.4.1-src » org.apache » lucene » search » [javadoc | source]
org.apache.lucene.search
public class: RangeFilter [javadoc | source]
java.lang.Object
   org.apache.lucene.search.Filter
      org.apache.lucene.search.RangeFilter

All Implemented Interfaces:
    Serializable

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

Constructor:
 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)
 public RangeFilter(String fieldName,
    String lowerTerm,
    String upperTerm,
    boolean includeLower,
    boolean includeUpper,
    Collator collator) 
    WARNING: Using this constructor and supplying a non-null value in the collator parameter will cause every single index Term in the Field referenced by lowerTerm and/or upperTerm to be examined. Depending on the number of index Terms in this Field, the operation could be very slow.
    Parameters:
    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?
    collator - The collator to use when determining range inclusion; set to null to use Unicode code point ordering instead of collation.
    Throws:
    IllegalArgumentException - if both terms are null or if lowerTerm is null and includeLower is true (similar for upperTerm and includeUpper)
Method from org.apache.lucene.search.RangeFilter Summary:
Less,   More,   bits,   equals,   getDocIdSet,   hashCode,   toString
Methods from org.apache.lucene.search.Filter:
bits,   getDocIdSet
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.lucene.search.RangeFilter Detail:
 public static RangeFilter Less(String fieldName,
    String upperTerm) 
    Constructs a filter for field fieldName matching less than or equal to upperTerm.
 public static RangeFilter More(String fieldName,
    String lowerTerm) 
    Constructs a filter for field fieldName matching greater than or equal to lowerTerm.
 public BitSet bits(IndexReader reader) throws IOException 
Deprecated! Use - #getDocIdSet(IndexReader) instead.

    Returns a BitSet with true for documents which should be permitted in search results, and false for those that should not.
 public boolean equals(Object o) 
    Returns true if o is equal to this.
 public DocIdSet getDocIdSet(IndexReader reader) throws IOException 
    Returns a DocIdSet with documents that should be permitted in search results.
 public int hashCode() 
    Returns a hash code value for this object.
 public String toString()