Class | Ferret::Search::RangeFilter |
In: |
ext/r_search.c
|
Parent: | cFilter |
RangeFilter filters a set of documents which contain a lexicographical range of terms (ie "aaa", "aab", "aac", etc). See also RangeQuery
Find all documents created before 5th of September 2002.
filter = RangeFilter.new(:created_on, :< => "20020905")
See RangeQuery for notes on how to use the RangeFilter on a field containing numbers.
Create a new RangeFilter on field field. There are two ways to build a range filter. With the old-style options; +:lower+, +:upper+, +:include_lower+ and +:include_upper+ or the new style options; +:<+, +:<=+, +:>+ and +:>=+. The options’ names should speak for themselves. In the old-style options, limits are inclusive by default.
f = RangeFilter.new(:date, :lower => "200501", :include_lower => false) # is equivalent to f = RangeFilter.new(:date, :< => "200501") # is equivalent to f = RangeFilter.new(:date, :lower_exclusive => "200501") f = RangeFilter.new(:date, :lower => "200501", :upper => 200502) # is equivalent to f = RangeFilter.new(:date, :>= => "200501", :<= => 200502)