dgraph icon indicating copy to clipboard operation
dgraph copied to clipboard

[ENHANCEMENT]: Support case-insensitive sorting of strings

Open rarvikar opened this issue 1 year ago • 1 comments

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 avatar Sep 03 '23 11:09 rarvikar

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.

tikiatua avatar Mar 07 '24 11:03 tikiatua

This issue has been stale for 60 days and will be closed automatically in 7 days. Comment to keep it open.

github-actions[bot] avatar Jul 14 '24 01:07 github-actions[bot]