Mailing List Archive

DateFilter vs RangeQuery
Hello,
I have some documents indexed with a field date.created that is produced by DateField.dateToString. I want to filter the results for documents that were created in the last X day..
I don't understand what is the difference between:

Option I.
// perform the normal query and filter the result with a DateFilter
DateFilter df = new DateFilter.After("created", calendar.getTime());
Hits hits = mySearcher.search(myQuery, df);


Option II.
// add a clause to the original query

Term t = new Term("created", DateField.dateToField(calendar.getTime()));

BooleanQuery q = new BooleanQuery();
q.add(myQuery, true, false);
q.add(new RangeQuery(t, null, true));
Hits hits = mySearcher.search(q);


Could someone help to decide which option is better?

thanks,
peter

--
To unsubscribe, e-mail: <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>