From dev-return-3867-apmail-couchdb-dev-archive=couchdb.apache.org@couchdb.apache.org Thu Apr 09 10:54:05 2009 Return-Path: Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: (qmail 6470 invoked from network); 9 Apr 2009 10:54:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 9 Apr 2009 10:54:04 -0000 Received: (qmail 82361 invoked by uid 500); 9 Apr 2009 10:54:04 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 82274 invoked by uid 500); 9 Apr 2009 10:54:04 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 82264 invoked by uid 99); 9 Apr 2009 10:54:03 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Apr 2009 10:54:03 +0000 X-ASF-Spam-Status: No, hits=1.5 required=10.0 tests=NORMAL_HTTP_TO_IP,SPF_PASS,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of b.candler@pobox.com designates 208.72.237.25 as permitted sender) Received: from [208.72.237.25] (HELO sasl.smtp.pobox.com) (208.72.237.25) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Apr 2009 10:53:54 +0000 Received: from localhost.localdomain (unknown [127.0.0.1]) by a-sasl-quonix.sasl.smtp.pobox.com (Postfix) with ESMTP id A8609DECF for ; Thu, 9 Apr 2009 06:53:32 -0400 (EDT) Received: from mappit (unknown [80.45.95.114]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by a-sasl-quonix.sasl.smtp.pobox.com (Postfix) with ESMTPSA id 67487DECD for ; Thu, 9 Apr 2009 06:53:32 -0400 (EDT) Received: from brian by mappit with local (Exim 4.69) (envelope-from ) id 1Lrrsw-0003YS-RM for dev@couchdb.apache.org; Thu, 09 Apr 2009 11:53:30 +0100 Date: Thu, 9 Apr 2009 11:53:30 +0100 From: Brian Candler To: dev@couchdb.apache.org Subject: View keys case-insensitive? Message-ID: <20090409105330.GA13320@uk.tiscali.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.17+20080114 (2008-01-14) X-Pobox-Relay-ID: AAF9AA3A-24F4-11DE-A1B2-DC76898A30C1-28021239!a-sasl-quonix.pobox.com X-Virus-Checked: Checked by ClamAV on apache.org I was very surprised to find that view keys seem to be case-insensitive when using startkey and endkey: $ curl -X POST -d '{"map":"function(doc) { emit(doc.foo, null); }"}' 'http://127.0.0.1:5984/test_suite_db/_temp_view?startkey="a"&endkey="az"' {"total_rows":26,"offset":7,"rows":[ {"id":"7","key":"a","value":null}, {"id":"8","key":"A","value":null}, <<<< huh?! {"id":"9","key":"aa","value":null} ]} But not when fetching them individually: $ curl -X POST -d '{"map":"function(doc) { emit(doc.foo, null); }"}' 'http://127.0.0.1:5984/test_suite_db/_temp_view?key="a"' {"total_rows":26,"offset":7,"rows":[ {"id":"7","key":"a","value":null} ]} $ curl -X POST -d '{"map":"function(doc) { emit(doc.foo, null); }"}' 'http://127.0.0.1:5984/test_suite_db/_temp_view?key="A"' {"total_rows":26,"offset":8,"rows":[ {"id":"8","key":"A","value":null} ]} (Ditto for startkey="a"&endkey="a", or startkey="A"&endkey="A") At http://wiki.apache.org/couchdb/View_collation it says that view keys are case-sensitive, which normally means that "A" does not appear in the range "a" to "aa". And with normal ASCII ordering I would expect "A" to sort before "a", as is the case with Javascript: js> "a" < "A" false Could someone please explain to me what's going on? This may also explain my recent report COUCHDB-324 where tilde does not collate where I'd expect. I am running a recent SVN build: {"couchdb":"Welcome","version":"0.9.0a762247"} Thanks, Brian.