The official answer is that CouchDB only supports UTF-8 collation order.

The unofficial answer is that one or more of the workarounds posted,
wherein you emit something different that collates correctly, should
get you what you need. For instance, you could assign numbers to each
letter in the order you want and emit that as the first key in a
compound key.

Best regards,
Joan

----- Original Message -----
From: "Aurélien Bénel" <aurelien.be...@utt.fr>
To: user@couchdb.apache.org
Sent: Saturday, 2 September, 2017 1:54:48 PM
Subject: Re: Custom Collation

Hi Cliff,

> I am using a language where the sort order for the alphabet is:
>    A B D E F G H I J K L M N O P R S Š Z Ž T U V Õ Ä Ö Ü
> I need to sort the keys for my views based on this order.  So:
> A a B b ... Ö ö Ü ü
> Is there any way to achieve this?

I know this is not exactly what you are trying to do, but in similar situations 
I « normalize » keys before emitting them (transforming « Š » and « s » into « 
S » for example). You can still get the original (unnormalized) words in the 
`doc` or `value` field. Even if « S*** », « s*** » and « Š*** » will not be 
sorted *for real*, they will be next to each other in the sorted list.

Implementation is trivial but here is an implementation: 
https://github.com/Hypertopic/Tire-a-part/blob/d54018e8a81ceedfcbac7c921152e58989ec406b/lib/string.js

Regards,

Aurélien

Reply via email to