Currently the language autocomplete endpoint is restricted to prefix matches which means that if a user types "gre" it won't return either "Ancient Greek" or "Modern Greek."
It should return all substring matches, with the prefix matches ranked highest in the list.
The auto-complete should then be able to find it as an option when someone types "greek".
Currently the language autocomplete endpoint is restricted to prefix matches which means that if a user types "gre" it won't return either "Ancient Greek" or "Modern Greek."
It should return all substring matches, with the prefix matches ranked highest in the list.
Originally posted by @seabelis in https://github.com/internetarchive/openlibrary/issues/8145#issuecomment-1658690051
The function
autocomplete_languages
needs to be updated with the desired functionality. It may also make sense to refactor it to pass in thelimit
parameter so that it has all the knowledge it needs. https://github.com/internetarchive/openlibrary/blob/dc35977560ae0ca752eda36017769fdd82f15daa/openlibrary/plugins/upstream/utils.py#L717-L750