http://ferret.davebalmain.com/api/classes/Ferret/QueryParser.html

Have you had a look at the api? Here's an excerpt from the above uri
regarding range queries. Sorting of date-fields has been subject of
discussion as well: http://www.ruby-forum.com/topic/84502
Cheers,
Jan


RangeQuery

A range query finds all documents with terms between the two query terms.
This can be very useful in particular for dates. eg;

 'date:[20050725 20050905]' # all dates >= 20050725 and <= 20050905
 'date:[20050725 20050905}' # all dates >= 20050725 and <  20050905
 'date:{20050725 20050905]' # all dates >  20050725 and <= 20050905
 'date:{20050725 20050905}' # all dates >  20050725 and <  20050905

You can also do open ended queries like this;

 'date:[20050725>' # all dates >= 20050725
 'date:{20050725>' # all dates >  20050725
 'date:<20050905]' # all dates <= 20050905
 'date:<20050905}' # all dates <  20050905

Or like this;

 'date: >= 20050725'
 'date: >  20050725'
 'date: <= 20050905'
 'date: <  20050905'

If you prefer the above style you could use a boolean query but like this;

 'date:( >= 20050725 AND <= 20050905)'

But rangequery only solution shown first will be faster
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to