lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Halácsy Péter <>
Subject DateFilter vs RangeQuery
Date Wed, 24 Apr 2002 21:24:44 GMT
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 =, 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 =;

Could someone help to decide which option is better?


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message