anl.aida.ae.lucene
Class DateRangeFieldFilter

java.lang.Object
  extended by anl.aida.ae.lucene.DateRangeFieldFilter

public class DateRangeFieldFilter
extends java.lang.Object

Passes documents whose date field value is within some specified range.


Field Summary
private  long end
           
private  long start
           
 
Constructor Summary
DateRangeFieldFilter(java.util.Date start, java.util.Date end)
          Creates a DateFieldFilter with the specified range.
 
Method Summary
 boolean evaluate(org.apache.lucene.document.Document item)
          Evaluates an item against the date range criteria and returns true if the item passes the filter.
 boolean evaluate(long time)
          Evaluates an item against the date range criteria and returns true if the item passes the filter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

start

private long start

end

private long end
Constructor Detail

DateRangeFieldFilter

public DateRangeFieldFilter(java.util.Date start,
                            java.util.Date end)
Creates a DateFieldFilter with the specified range. The filter will be inclusive of start and end.

Parameters:
start - the start of the range
end - the end of the range
Method Detail

evaluate

public boolean evaluate(org.apache.lucene.document.Document item)
                 throws java.text.ParseException
Evaluates an item against the date range criteria and returns true if the item passes the filter.

Parameters:
item - the item to evaluate
Returns:
true if the item passes the filter, otherwise false.
Throws:
java.text.ParseException - if there is an error getting the timestamp from the document.

evaluate

public boolean evaluate(long time)
Evaluates an item against the date range criteria and returns true if the item passes the filter. The time must be rounded using DateTools.round(time, DateTools.Resolution.DAY).

Parameters:
time - the item to evaluate. It must be rounded using DateTools.round(time, DateTools.Resolution.DAY)
Returns:
true if the item passes the filter, otherwise false.