couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antony Blakey <>
Subject 'prefixkey' query parameter
Date Sat, 31 Jan 2009 22:57:55 GMT
    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


[ '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)


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

View raw message