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
string: string values are ordered using a localized comparison, using the configured server language
for sorting according to the alphabetical order rules of that language
But I'm not sure what the compare function SORT in AQL uses in my ArangoDB.
Dataset:
Above is from a dummy document collection
Size of your Dataset on disk:
Very small
Replication Factor & Number of Shards (Cluster only):
N/A
Steps to reproduce
Add documents to collection (with the content above)
Run the AQL query
Problem:
The sort order is not what I expected
Expected result:
I would expect the same results as using a.localeCompare(b), 'en-US')
The text was updated successfully, but these errors were encountered:
String comparisons are handled by ICU, with exceptions for ArangoSearch-related features.
The difference between JavaScript and AQL seems to be that JS sorts lowercase characters before uppercase characters, whereas in AQL it is upper before lower. This is explicitly set for ICU by the server here, but only in the fallback case:
coll->setAttribute(UCOL_CASE_FIRST, UCOL_UPPER_FIRST, status); // A < a
If you explicitly specify --icu-language en_US, this attribute does not get set, and you get the default ICU behavior AFAICT.
I'm not sure if JavaScript explicitly sorts lowercase before uppercase or if it uses the default, which seems to be "off" according to the ICU Collation Demo - but I don't know whether it means "undefined order". It rather looks like the default is lowercase before uppercase (see the diff strengths in the collation demo).
My Environment
Component, Query & Data
AQL, arangojs
AQL query (if applicable):
AQL explain and/or profile (if applicable):
Query results are:
The sorted strings are effectively:
The sorted results are different from Array.sort() or localeCompare()
In the Arangodb container, the default LANGUAGE is set to en_US.
According to the documentation: https://www.arangodb.com/docs/stable/aql/fundamentals-type-value-order.html,
But I'm not sure what the compare function
SORT
in AQL uses in my ArangoDB.Dataset:
Above is from a dummy document collection
Size of your Dataset on disk:
Very small
Replication Factor & Number of Shards (Cluster only):
N/A
Steps to reproduce
Problem:
The sort order is not what I expected
Expected result:
I would expect the same results as using
a.localeCompare(b), 'en-US')
The text was updated successfully, but these errors were encountered: