support indexes on non-string types

Bug #987412 reported by Eric Casteleijn
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
U1DB
Fix Released
Wishlist
Eric Casteleijn

Bug Description

It would be nice to have indexes on the simple non-string types that are supported in json, at the very least booleans and integers.

Related branches

Revision history for this message
Eric Casteleijn (thisfred) wrote :

The only way I see this working in the backend is a table per field type, but since json of course doesn't enforce that a field is the same type every time, we'll need a lot of error checking.

Revision history for this message
Eric Casteleijn (thisfred) wrote :

Or alternatively, encode all types to strings somehow. Which seems mad, since we'd be reinventing json to parse json.

Revision history for this message
Eric Casteleijn (thisfred) wrote :

After some discussion with Samuele I think I have a better grasp.

What I'll do for now:

integers will get indexed as zero padded strings by a special number() mapping that specifies the amount of padding.
booleans will get indexed as strings (probably just "0" and "1" in keeping with tradition, to not waste any more space than necessary.)
floats we'll ignore for now.

Open question:
If we index a field and the value is not recognized as one of the above, do we ignore the value, raise an exception, or convert to a string and index that?

Revision history for this message
Eric Casteleijn (thisfred) wrote :

Answer: we ignore them.

Changed in u1db:
status: Triaged → In Progress
Revision history for this message
Eric Casteleijn (thisfred) wrote :

numbers done

Changed in u1db:
status: In Progress → Fix Committed
Changed in u1db:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.