Re: Custom Collation

2017-09-03 Thread Cliff Stanford
On 03/09/17 12:01, Cliff Stanford wrote: sort = (collation[alphabet.indexOf char.toUpperCase()] ? char for char in word.split '').join ''emit [sort, word] Sorry, formatting issue. The emit should have been on the next line. Cliff. -- Cliff Stanford London:+44 20 0222 1666

Re: Custom Collation

2017-09-03 Thread Cliff Stanford
On 03/09/17 10:45, Cliff Stanford wrote: OK, presumably I'd need to do this in each map function? Do I need to copy and paste the code to each function or is there any way to use subroutines across map function? Actually, I realised there is a fairly simple way to do this in three extra

Re: Custom Collation

2017-09-03 Thread Cliff Stanford
On 03/09/17 06:44, Joan Touzet wrote: The official answer is that CouchDB only supports UTF-8 collation order. Thanks. I also tried "raw" collation order but that didn't help. I was hoping there was a CouchDB way to alter the collation. The unofficial answer is that one or more of the

Re: Custom Collation

2017-09-03 Thread Cliff Stanford
On 02/09/17 20:54, Aurélien Bénel wrote: 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 know this is not exactly what you are trying to do, but in similar situations I « normalize » keys before emitting them

Re: Custom Collation

2017-09-02 Thread Joan Touzet
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

Re: Custom Collation

2017-09-02 Thread Aurélien Bénel
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

Re: Custom Collation

2017-09-02 Thread Joel Wallis Jucá
Should you create a custom index based on each character ASCII code? You could use String#charCodeAt() to get each one's code and build a custom index Joel Wallis Jucá joelwallis.com Em 2 de set de 2017 12:40 PM, "Cliff Stanford" escreveu: > I have an interesting problem and I'm

Custom Collation

2017-09-02 Thread Cliff Stanford
I have an interesting problem and I'm not sure how to solve it. 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