org.apache.lucene.search

Class DateFilter

Implemented Interfaces:
Serializable

public 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.

See Also:
Serialized Form

Constructor Summary

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

Method Summary

static DateFilter
After(String field, Date date)
Constructs a filter for field f matching dates on or after date.
static DateFilter
After(String field, long time)
Constructs a filter for field f matching times on or after time.
static DateFilter
Before(String field, Date date)
Constructs a filter for field f matching dates on or before before date.
static DateFilter
Before(String field, long time)
Constructs a filter for field f matching times on or 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 org.apache.lucene.search.Filter

bits

Constructor Details

DateFilter

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

DateFilter

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

Method Details

After

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

After

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

Before

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

Before

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

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.
Overrides:
bits in interface Filter

toString

public String toString()

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