couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Couchdb Wiki] Update of "View collation" by BrianCandler
Date Thu, 30 Apr 2009 19:07:04 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.

The following page has been changed by BrianCandler:
http://wiki.apache.org/couchdb/View_collation

The comment on the change is:
_all_docs is different

------------------------------------------------------------------------------
  
  If you need start and end keys that encompass every string with a given prefix, it is better
to use a high value unicode character, than to use a 'ZZZZ' suffix.
  
- Rather than:
+ That is, rather than:
  {{{
- startkey="_design/"&endkey="_design/ZZZZZZZZZ" 
+ startkey="abc"&endkey="abcZZZZZZZZZ" 
  }}}
  
  You should use:
  {{{
- startkey="_design/"&endkey="_design/\u9999" 
+ startkey="abc"&endkey="abc\u9999" 
  }}}
  
  == Collation Specification ==
@@ -174, +174 @@

  
  The query {{{startkey=["foo"]&endkey=["foo",{}]}}} will match most array keys with "foo"
in the first element, such as {{{["foo","bar"]}}} and {{{["foo",["bar","baz"]]}}}. However
it will not match {{{["foo",{"an":"object"}]}}}
  
+ == _all_docs ==
+ 
+ The _all_docs view is a special case because it uses ASCII collation for doc ids, not UCA.
For example,
+ 
+ {{{
+ startkey="_design/"&endkey="_design/ZZZZZZZZ"
+ }}}
+ 
+ will ''not'' find {{{_design/abc}}} because 'Z' comes before 'a' in the ASCII sequence.
A better solution is:
+ 
+ {{{
+ startkey="_design/"&endkey="_design0"
+ }}}
+ 

Mime
View raw message