Methods Summary |
---|
public static org.apache.lucene.search.DateFilter | After(java.lang.String field, java.util.Date date)Constructs a filter for field f matching
dates on or after date .
DateFilter result = new DateFilter(field);
result.start = DateField.dateToString(date);
return result;
|
public static org.apache.lucene.search.DateFilter | After(java.lang.String field, long time)Constructs a filter for field f matching
times on or after time .
DateFilter result = new DateFilter(field);
result.start = DateField.timeToString(time);
return result;
|
public static org.apache.lucene.search.DateFilter | Before(java.lang.String field, java.util.Date date)Constructs a filter for field f matching
dates on or before before date .
DateFilter result = new DateFilter(field);
result.end = DateField.dateToString(date);
return result;
|
public static org.apache.lucene.search.DateFilter | Before(java.lang.String field, long time)Constructs a filter for field f matching times
on or before time .
DateFilter result = new DateFilter(field);
result.end = DateField.timeToString(time);
return result;
|
public 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.
BitSet bits = new BitSet(reader.maxDoc());
TermEnum enumerator = reader.terms(new Term(field, start));
TermDocs termDocs = reader.termDocs();
if (enumerator.term() == null) {
return bits;
}
try {
Term stop = new Term(field, end);
while (enumerator.term().compareTo(stop) <= 0) {
termDocs.seek(enumerator.term());
while (termDocs.next()) {
bits.set(termDocs.doc());
}
if (!enumerator.next()) {
break;
}
}
} finally {
enumerator.close();
termDocs.close();
}
return bits;
|
public java.lang.String | toString()
StringBuffer buffer = new StringBuffer();
buffer.append(field);
buffer.append(":");
buffer.append(DateField.stringToDate(start).toString());
buffer.append("-");
buffer.append(DateField.stringToDate(end).toString());
return buffer.toString();
|