/** * Perform a completion search. * Does not resolve namespaces and does not check variants. * Search engine implementations may want to override this function. * @param string $search * @return SearchSuggestionSet */ protected function completionSearchBackend($search) { $results = []; $search = trim($search); if (!in_array(NS_SPECIAL, $this->namespaces) && !Hooks::run('PrefixSearchBackend', [$this->namespaces, $search, $this->limit, &$results, $this->offset])) { // False means hook worked. // FIXME: Yes, the API is weird. That's why it is going to be deprecated. return SearchSuggestionSet::fromStrings($results); } else { // Hook did not do the job, use default simple search $results = $this->simplePrefixSearch($search); return SearchSuggestionSet::fromTitles($results); } }