You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Use case and current behavior
Alphabetical sorting of strings in Dgraph, using the
orderasc
andorderdesc
options, actually follow the "ASCIIbetical ordering" convention, where the ASCII order is followed strictly for String collation. For example, usingorderasc
, the sorted result-set contains all uppercase charactersA-Z
first, and only then followed by all the lowercase charsa-z
. This is because ASCII code for uppercaseZ
is90
, while that of the lowercasea
is97
, placing all strings containing the charactera
only after all strings starting withZ
, 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
The text was updated successfully, but these errors were encountered: