org.apache.lucene.search
Class DateFilter

java.lang.Object
  |
  +--org.apache.lucene.search.Filter
        |
        +--org.apache.lucene.search.DateFilter

public final class DateFilter
extends Filter

A Filter that restricts search results to a range of time.

For this to work, documents must have been indexed with a DateField.


Constructor Summary
DateFilter(String f, Date from, Date to)
          Constructs a filter for field f matching dates between from and to.
DateFilter(String f, long from, long to)
          Constructs a filter for field f matching times between from and to.
 
Method Summary
static DateFilter After(String field, Date date)
          Constructs a filter for field f matching dates after date.
static DateFilter After(String field, long time)
          Constructs a filter for field f matching times after time.
static DateFilter Before(String field, Date date)
          Constructs a filter for field f matching dates before date.
static DateFilter Before(String field, long time)
          Constructs a filter for field f matching times before time.
 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.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DateFilter

public DateFilter(String f,
                  Date from,
                  Date to)
Constructs a filter for field f matching dates between from and to.

DateFilter

public DateFilter(String f,
                  long from,
                  long to)
Constructs a filter for field f matching times between from and to.
Method Detail

Before

public static DateFilter Before(String field,
                                Date date)
Constructs a filter for field f matching dates before date.

Before

public static DateFilter Before(String field,
                                long time)
Constructs a filter for field f matching times before time.

After

public static DateFilter After(String field,
                               Date date)
Constructs a filter for field f matching dates after date.

After

public static DateFilter After(String field,
                               long time)
Constructs a filter for field f matching times after time.

bits

public final 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.
Overrides:
bits in class Filter

toString

public final String toString()
Overrides:
toString in class Object


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