In WVUI, we use restSearchClient.ts to fetch search results for the TypeaheadSearch component. However, the url that restSearchClient constructs to fetch these results is hardcoded and assumes the mediawiki installation uses a default $wgScriptPath of /w:
const url = `//${domain}/w/rest.php/v1/search/title?${buildQueryString( params )}`; // Notice the `/w` is hardcoded
WVUI also hardcodes the script path in UrlGenerator.ts
Given that $wgScriptPath is configurable inside LocalSettings.php, we should make this configurable in WVUI as well. If we don't and the $wgScriptPath is different from the default, TypeaheadSearch won't receive any search results.
Acceptance Criteria
- The TypeaheadSearch component should still work and get back search results when used with a MediaWiki installation that sets a non-default $wgScriptPath
- The API client should be provided by Vector https://gerrit.wikimedia.org/r/c/mediawiki/skins/Vector/+/755506/1/resources/skins.vector.search/App.vue
- A patch to remove the code from WVUI. Open a task if needed to track that work as this does not block resolving this task.
- A unit test should be added to Vector for the new API client
Developer notes
To assist the Vue.js migration team in moving this to Codex, we'll move the client into Vector as part of fixing this bug.
A client property is already supported, so we can make this change without touching WVUI.