fr.gouv.culture.sdx.search.lucene
Class DateFilter

java.lang.Object
  extended by org.apache.lucene.search.Filter
      extended by fr.gouv.culture.sdx.search.lucene.DateFilter
All Implemented Interfaces:
java.io.Serializable

public class DateFilter
extends org.apache.lucene.search.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(java.lang.String f, java.util.Date from, java.util.Date to)
          Constructs a filter for field f matching dates between from and to inclusively.
DateFilter(java.lang.String f, long from, long to)
          Constructs a filter for field f matching times between from and to inclusively.
 
Method Summary
static DateFilter After(java.lang.String field, java.util.Date date)
          Constructs a filter for field f matching dates on or after date.
static DateFilter After(java.lang.String field, long time)
          Constructs a filter for field f matching times on or after time.
static DateFilter Before(java.lang.String field, java.util.Date date)
          Constructs a filter for field f matching dates on or before before date.
static DateFilter Before(java.lang.String field, long time)
          Constructs a filter for field f matching times on or before time.
 java.util.BitSet bits(org.apache.lucene.index.IndexReader reader)
          Returns a BitSet with true for documents which should be permitted in search results, and false for those that should not.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DateFilter

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


DateFilter

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

Method Detail

Before

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


Before

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


After

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


After

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


bits

public java.util.BitSet bits(org.apache.lucene.index.IndexReader reader)
                      throws java.io.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 org.apache.lucene.search.Filter
Throws:
java.io.IOException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2000-2010 Ministere de la culture et de la communication / AJLSM. All Rights Reserved.