Improve ULS language search api
* Store prefixes and infixes separately in the data * First match language code, then prefixes, then infixes * Try to use suggestion either in user language or autonym first * use formatversion=2 to avoid escaping Unicode Using Language::fetchLanguageName might can have a small performance impact. On the other hand there is now check to skip languages we already found, avoiding some fuzzy matching. This is in a preparation for a change in jquery.uls to use the search API more, while trying to reduce the amount of weird autocompletion suggestions we show to the user. Bug: T73891 Change-Id: Id94c5352d9a591969bf90144d1d2d5e758d08301
This commit is contained in:
@@ -22,12 +22,11 @@
|
||||
* @ingroup API
|
||||
*/
|
||||
class ApiLanguageSearch extends ApiBase {
|
||||
|
||||
public function execute() {
|
||||
$params = $this->extractRequestParams();
|
||||
$search = $params['search'];
|
||||
$typos = $params['typos'];
|
||||
$searches = LanguageNameSearch::search( $search, $typos );
|
||||
$searches = LanguageNameSearch::search( $search, $typos, $this->getLanguage()->getCode() );
|
||||
$result = $this->getResult();
|
||||
$result->addValue( null, $this->getModuleName(), $searches );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user