/* * call-seq: * TypedRangeQuery.new(field, options = {}) -> range_query * * Create a new TypedRangeQuery on field +field+. This differs from the * standard RangeQuery in that it allows range queries with unpadded numbers, * both positive and negative, integer and float. You can even use * hexadecimal numbers. However it could be a lot slower than the standard * RangeQuery on large indexes. * * There are two ways to build a range query. 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. * * == Examples * * q = TypedRangeQuery.new(:date, :lower => "0.1", :include_lower => false) * # is equivalent to * q = TypedRangeQuery.new(:date, :< => "0.1") * # is equivalent to * q = TypedRangeQuery.new(:date, :lower_exclusive => "0.1") * * # Note that you numbers can be strings or actual numbers * q = TypedRangeQuery.new(:date, :lower => "-12.32", :upper => 0.21) * # is equivalent to * q = TypedRangeQuery.new(:date, :>= => "-12.32", :<= => 0.21) */ static VALUE frb_trq_init(VALUE self, VALUE rfield, VALUE roptions) { Query *q; char *lterm = NULL; char *uterm = NULL; bool include_lower = false; bool include_upper = false; get_range_params(roptions, <erm, &uterm, &include_lower, &include_upper); q = trq_new(frb_field(rfield), lterm, uterm, include_lower, include_upper); Frt_Wrap_Struct(self, NULL, &frb_q_free, q); object_add(q, self); return self; }