You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by Antony Blakey <an...@gmail.com> on 2009/01/31 23:57:55 UTC
'prefixkey' query parameter
Hi,
every time I see someone talking about \u9999 in a key string I'm
reminded that it isn't really correct. On top of the trivial issue of
\u9999 being the wrong value, using a unicode escape like this is
problematic because Unicode is not a 16 bit character set, and as
Unicode evolves the character set increases.
I think a better solution is to add a prefixkey=<xx> query parameter,
that does the equivalent of the current \uXXXX and {} techniques using
startkey and endkey, extended for all JSON types.
----------------------------------------------------
'abc' would match all strings starting with abc
numbers and true/false/null would match exactly
{ ... } would match exactly (because there is no ordering in hashes)
[ a, b ] is the interesting case. It would match recursively, with the
last element of the list recursively using prefix matching
e.g.:
[ 'abc', 2 ] matches all lists with [ 'abc', 2 ] as a head
[ 2 , 'abc' ] matches all lists with 2 as the first element, and any
string starting with 'abc' as the second element, and an arbitrary tail.
----------------------------------------------------
Is there any support for this?
One alternative would be to allow the specification of the key test
functions as a query parameter, which would enable inclusive/exclusive/
prefix ranges
e.g. (ignoring the syntax and names)
start-key=greater
startkey-test=greater-or-equals
startkey-test=prefix
and the same for endkey-test. This is a more complete solution.
Antony Blakey
--------------------------
CTO, Linkuistics Pty Ltd
Ph: 0438 840 787
Isn't it enough to see that a garden is beautiful without having to
believe that there are fairies at the bottom of it too?
-- Douglas Adams