Class: Ferret::Search::TypedRangeQuery

Inherits:
Object
  • Object
show all
Defined in:
ext/r_search.c

Overview

Summary

TypedRangeQuery is used to find documents with terms in a range. RangeQuerys are usually used on untokenized fields like date fields or number fields. TypedRangeQuery is particularly useful for fields with unnormalized numbers, both positive and negative, integer and float.

Example

To find all documents written between January 1st 2006 and January 26th 2006 inclusive you would write the query like this;

query = RangeQuery.new(:create_date, :>= "-1.0", :<= "10.0")

Performance Note

TypedRangeQuery works by converting all the terms in a field to numbers and then comparing those numbers with the range bondaries. This can have quite an impact on performance on large indexes so in those cases it is usually better to use a standard RangeQuery. This will require a little work on your behalf. See RangeQuery for notes on how to do this.