Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENHANCEMENT]: Support case-insensitive sorting of strings #8989

Open
rarvikar opened this issue Sep 3, 2023 · 1 comment
Open

[ENHANCEMENT]: Support case-insensitive sorting of strings #8989

rarvikar opened this issue Sep 3, 2023 · 1 comment
Labels
kind/enhancement Something could be better.

Comments

@rarvikar
Copy link

rarvikar commented Sep 3, 2023

Use case and current behavior

Alphabetical sorting of strings in Dgraph, using the orderasc and orderdesc options, actually follow the "ASCIIbetical ordering" convention, where the ASCII order is followed strictly for String collation. For example, using orderasc, the sorted result-set contains all uppercase characters A-Z first, and only then followed by all the lowercase chars a-z. This is because ASCII code for uppercase Z is 90, while that of the lowercase a is 97, placing all strings containing the character a only after all strings starting with Z, although the order defined is 'Ascending'. This is not the desired result for most use-cases.

Due to this limitation, users need to handle the conversion themselves and in some cases, even need to add pre-processing steps to ensure all string values are either capitalized (or not), before they're inserted to Dgraph.

Enhancement

Allow for case insensitive sorting in Dgraph so that sorted result-sets can include the correct order of values regardless of the case of the characters.
A possible solutions is to modify our implementation of String collation so that uppercase characters are considered identical to their corresponding lowercase characters for the purpose of alphabetical ordering.

Solution proposal

No response

Links to Discuss, RFC or previous Issues and PRs

https://discuss.dgraph.io/t/string-field-collation/8771

Links to examples and research

No response

Additional Information

No response

@rarvikar rarvikar added the kind/enhancement Something could be better. label Sep 3, 2023
@tikiatua
Copy link

tikiatua commented Mar 7, 2024

This would be very helpful. I currently need to sort all entries again in the client to get the sort order that our users expect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Something could be better.
Development

No branches or pull requests

2 participants