Sorting Issue with Norwegian Alphabet in Typesense

TLDR Isak had trouble with Norwegian alphabet sorting in Typesense. Kishore Nallan explained that Typesense doesn't support locale specific sorting and proposed different character replacements. Isak found an acceptable solution.

Photo of Isak
Isak
Sat, 20 Aug 2022 14:34:46 UTC

Hello, When i sort after Ø, Æ and Å. They come above A and not after Z. In the norwegian alphabet, ÆØ and Å comes after Z not before. *Example:* ABCDEFGHIJKLMNOPQRSTUVWXYZÆØÅ. *In typesense it seems like this:* ÆØÅABCDEFGHIJKLMNOPQRSTUVWXYZ. *Example the way i want it to sort:* • Albert Einstein • Bill gates • Ørken Mannen *Example the way typesense sort it:* • Ørken Mannen • Albert Einstein • Bill gates

Photo of Kishore Nallan
Kishore Nallan
Sat, 20 Aug 2022 14:36:03 UTC

Hi Isak, Typesense does not support locale specific sorting. Since sorting is based on lexiographic ordering, it only works on English.

Photo of Kishore Nallan
Kishore Nallan
Sat, 20 Aug 2022 14:37:50 UTC

One work around is to see if it's possible to represent string in equivalent English form that could give the same order. However I realise it might not even be possible.

Photo of Isak
Isak
Sat, 20 Aug 2022 14:49:35 UTC

Hmm thats understandable, are there any characters after Z in lexiographic ordering i can replace with?

Photo of Isak
Isak
Sat, 20 Aug 2022 14:58:26 UTC

Found a solution: æ = zzzza ø = zzzzb å = zzzzc

Photo of Kishore Nallan
Kishore Nallan
Sat, 20 Aug 2022 15:08:25 UTC

The pipe character and curly braces also appear at the end:

Photo of Isak
Isak
Sat, 20 Aug 2022 15:10:19 UTC

Well thats a better workaround. :slightly_smiling_face: Thank you!