Hi! I was surprised to find out that it's not possible to sort search results alphabetically with the Search API. Sorting alphabetically is quite often what you want when using the Search API to generate lists of pages that match certain criteria, for example for a report. I'm sure there're other queries that would benefit from it.
Description
| Status | Subtype | Assigned | Task | ||
|---|---|---|---|---|---|
| Resolved | Feature | TheDJ | T403775 New search option: Sort results by page name | ||
| Duplicate | Feature | None | T331029 Option to sort alphabetically in Search API |
Event Timeline
This seems related to T40403. And was also requested in https://meta.wikimedia.org/wiki/Community_Wishlist_Survey_2023/Search_and_Categories/Add_%22Sorting_order_by_alphabet%22_in_Special:Search
I suspect the underlying technology is now sufficient to support alphabetical sorts (although we would have to evaluate it to be sure). The main sticking point in Cirrus today is going to be that the way we define keyword fields does not allow doc_values to be enabled. We would need to migrate all the existing fields with the keyword tokenizer to instead use the keyword type along with normalizers, which then allows us to enable doc_values on appropriate keyword fields. Once the index mapping is in place the new sort is only a few lines of configuration in Cirrus.