# How to use fixnum in RangeQuery?

**URL:** <https://www.ruby-forum.com/t/how-to-use-fixnum-in-rangequery/109714>\
**Category:** Ferret\
**Created:** [July 18, 2007, 9:36am UTC](https://www.ruby-forum.com/t/how-to-use-fixnum-in-rangequery/109714 "2007-07-18T09:36:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![whiteagles](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/22d042/32.png) [@whiteagles](https://www.ruby-forum.com/u/whiteagles)\
**Post date:** [July 18, 2007, 9:36am UTC](https://www.ruby-forum.com/t/how-to-use-fixnum-in-rangequery/109714/1 "2007-07-18T09:36:32Z")

</div>

As far as i know about the RangeQuery is that it need fixed-length  
number in query options such as RangeQuery.new(:count, :\>= =\> ‘00’, :\<=  
=\> ‘99’).  
But is there a mechanism to use a fixnum in the options instead of  
filling the left with 0?  
Regards.

---

<div class="post-metadata">

**Author:** ![whiteagles](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/22d042/32.png) [@whiteagles](https://www.ruby-forum.com/u/whiteagles)\
**Post date:** [July 18, 2007, 10:34am UTC](https://www.ruby-forum.com/t/how-to-use-fixnum-in-rangequery/109714/2 "2007-07-18T10:34:02Z")

</div>

Hi!

On Wed, Jul 18, 2007 at 09:36:32AM +0200, Sinnyn Lee wrote:

> As far as i know about the RangeQuery is that it need fixed-length  
> number in query options such as RangeQuery.new(:count, :\>= =\> ‘00’, :\<=  
> =\> ‘99’).  
> But is there a mechanism to use a fixnum in the options instead of  
> filling the left with 0?

No, you have to use strings. You could write a wrapper around RangeQuery  
that accepts Fixnums and does the left padding to the width of your  
largest field value of course.

cheers,  
Jens

–  
Jens Krämer  
[http://www.jkraemer.net/](http://www.jkraemer.net/) - Blog  
[http://www.omdb.org/](http://www.omdb.org/) - The new free film database
