#community-help

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.

Powered by Struct AI

1

7
14mo
Solved
Join the chat
Aug 20, 2022 (14 months ago)
Isak
Photo of md5-2d5b94e8b6be973afd636fe76571cebb
Isak
02:34 PM
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
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
02:36 PM
Hi Isak, Typesense does not support locale specific sorting. Since sorting is based on lexiographic ordering, it only works on English.
02:37
Kishore Nallan
02:37 PM
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.
Isak
Photo of md5-2d5b94e8b6be973afd636fe76571cebb
Isak
02:49 PM
Hmm thats understandable, are there any characters after Z in lexiographic ordering i can replace with?
02:58
Isak
02:58 PM
Found a solution:
æ = zzzza
ø = zzzzb
å = zzzzc
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
03:08 PM
The pipe character and curly braces also appear at the end: https://www.cs.cmu.edu/~pattis/15-1XX/common/handouts/ascii.html
Isak
Photo of md5-2d5b94e8b6be973afd636fe76571cebb
Isak
03:10 PM
Well thats a better workaround. 🙂 Thank you!

1