You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Hank Knight <hk...@gmail.com> on 2013/10/21 21:19:41 UTC

CouchDB: Case Insensitive Keys

Can I do a search based on a case-insensitive key?

For example "aBc" should return the same results as "AbB".

http://localhost:5984/mydb/_design/type/_view/q?limit=100&key=%22aBc%22

Re: CouchDB: Case Insensitive Keys

Posted by Jens Alfke <je...@couchbase.com>.
On Oct 21, 2013, at 12:19 PM, Hank Knight <hk...@gmail.com> wrote:

> Can I do a search based on a case-insensitive key?
> 
> For example "aBc" should return the same results as "AbB".

It looks from the description of the collation algorithm* that it’s already mostly case-insensitive. (The comment says “case-sensitive” but I think what it means is that a lowercase string sorts before its uppercase equivalent.) Note that both “A” and “a” sort before “b” or “B”.

So regardless of the case of the keys that got emitted, if you query with a key range of “abc” through “ABC” you should get all keys that are case-insensitively equal to “abc”.

—Jens

* http://wiki.apache.org/couchdb/View_collation#Collation_Specification

Re: CouchDB: Case Insensitive Keys

Posted by Simon Metson <si...@cloudant.com>.
Lower case (or upper) case the string in the map function, and then only query for abc (or ABC) 


On Monday, 21 October 2013 at 20:19, Hank Knight wrote:

> Can I do a search based on a case-insensitive key?
> 
> For example "aBc" should return the same results as "AbB".
> 
> http://localhost:5984/mydb/_design/type/_view/q?limit=100&key=%22aBc%22