You can rank records alphabetically by a string attribute using customRanking.
The sorting criterion string limit is 50 characters and exists to cap index memory on large datasets. If your strings require sorting past 50 characters, you can employ these workarounds:
-
Use a numeric sort key. Numeric sort criteria have no length cap, so compute a rank-preserving integer at ingestion time and store it alongside the string:
{ "name": "00000000000111...4A", "name_sort": 1 } { "name": "00000000000111...4B", "name_sort": 2 } { "name": "00000000000111...4C", "name_sort": 3 }Then use
customRanking: ["asc(name_sort)"]. Restructure the attribute so the differentiating bytes come within the first 50 chars (only useful if the long prefix is padding/noise you control at ingestion).