RangeQuery is a good approach. Put fields on your documents like age.
The only tricky thing is that the comparisons are all done
lexicographically rather that numerically. Lucene has a built-in
routine to convert dates into a monotonic lexicographic sequence
(DateField.timeToString). For positive integer data types like age, it
is sufficient to store them as fixed line String's, e.g.:
5 --> "005"
18 --> "018"
100 --> "100"
Then just access range queries. E.g.:
1. age:[018 TO]
2. age:[TO 018]
3. age:[005 TO 018]
Those are <= queries. Use {} instead of [] for < queries.
Good luck,
Chuck
> -----Original Message-----
> From: sam s [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, October 13, 2004 12:55 PM
> To: [EMAIL PROTECTED]
> Subject: Filtering Results?
>
> Hi,
> I want to do filtering on matched results of a query.
> For example
> 1. age > 18
> 2. age < 18
> 3. age > 5 and age < 18
> 4. birthdate = [some date]
> What can be the best approach?
> How can it be done with range query?
> Can it be done without range query?
>
> Also.
> Where can I find information meaning of following classes and how to
use
> them?
> FilteredQuery
> QueryFilter (I didnt understand much looking at test case of this)
> CachingWrapperFilter
> etc..
>
> Thanks in advance
>
> _________________________________________________________________
> Don't just search. Find. Check out the new MSN Search!
> http://search.msn.com/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]