[Bugs] #1342 IMME: range queries use lexical comparison, not numerical

Sugar Labs Bugs bugtracker-noreply at sugarlabs.org
Wed Sep 23 05:31:24 EDT 2009


#1342: range queries use lexical comparison, not numerical
--------------------------------+-------------------------------------------
    Reporter:  sascha_silbe     |          Owner:  sascha_silbe     
        Type:  defect           |         Status:  new              
    Priority:  Immediate        |      Milestone:  0.86             
   Component:  sugar-datastore  |        Version:  Git as of bugdate
    Severity:  Minor            |       Keywords:  r?               
Distribution:  Unspecified      |   Status_field:  Assigned         
--------------------------------+-------------------------------------------

Comment(by sascha_silbe):

 Replying to [comment:4 tomeu]:
 > Why not just doing this?
 > {{{
 > document.add_value(_VALUE_TIMESTAMP,
 xapian.sortable_serialise(float(properties['timestamp'])))
 > }}}
 Because that's only half of the solution and IMO the less important half.
 Timestamps are usually generated by the sugar.* framework while saving the
 entry, I can't think of any reason a (Python) activity would want to do it
 on their own and then I'd rather have it fail right away if they don't
 pass a numeric type, especially if passing a string for querying doesn't
 work.
 The other half is querying and this is where is makes an important
 difference: We need to know we're expecting a numeric type in order to
 invoke sortable_serialise() before comparison. sortable_serialise()
 produces binary data, so comparing with a decimal string doesn't make any
 sense.

-- 
Ticket URL: <http://bugs.sugarlabs.org/ticket/1342#comment:5>
Sugar Labs <http://sugarlabs.org/>
Sugar Labs bug tracking system


More information about the Bugs mailing list