Ticket #339 (closed defect: fixed)
RangeQuery bounds comparison does not handle negative numbers well
| Reported by: | philippe@… | Owned by: | somebody |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | component1 | Version: | |
| Keywords: | Cc: |
Description
I'm using RangeQuery? to query against positive and negative floats, and the comparison function to assert the bounds are ok uses strcmp, therefore it doesn't work well with negative numbers.
For positive numbers it works ok because the ascii codes of 1 is smaller than 2 in a string.
ferret/ruby/ext/r_search.c: line 1058
if (*uterm && *lterm && (strcmp(*uterm, *lterm) < 0)) {
rb_raise(rb_eArgError,
"The upper bound should greater than the lower bound."
" %s > %s", *lterm, *uterm);
}
Maybe the code should test if the string is a number and just use a regular mathematics comparison.
Ideally the code would also handle floats!
Attachments
Change History
Note: See
TracTickets for help on using
tickets.
