Nick
unread,Mar 17, 2015, 5:48:03 AM3/17/15Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google-a...@googlegroups.com
There are a few options within the search api:
Scale/truncate the double to fit - this fails if your double has a wide range (such as very large and very small values across the dataset)
Store in multiple fields and create a query that knows how to span them (ie store the low and high quantities separately, such as everything before the decimal point in one value, shifted down appropriately and everything after the decimal point shifted up).
Stringify the double and store as a string, note that comparisons and ordering will be alphabetical so you'll need to zero pad the start and end, negative numbers would also be an issue.
Outside of that, you'll probably need to find another way, such as cloudsql, the datastore or another external search index (like elastic search on GCE)
As an aside, the search index is not very good with numbers. As you've learnt, it actually has the range of an int, with the precision of a float passed in as a double (wtf?).
It also behaves oddly when doing granular range queries. For example, if you do a query where x <= 0.21, it can in practice return values larger than this, such as 0.22. This seems to be related to how it writes the index, grouping indexed values into 'batches'.
There's also a faceted search api in trusted tester I think, this might be the thing for you.
It would be interesting to hear what you actually choose in the end.