mirror of
https://github.com/StarCitizenTools/mediawiki-skins-Citizen.git
synced 2024-11-24 06:24:22 +00:00
fix(search): 🐛 search all content namespaces for Action API
This commit is contained in:
parent
ee2310be67
commit
3719897e93
|
@ -3,6 +3,15 @@
|
|||
const fetchJson = require( '../fetch.js' );
|
||||
const urlGenerator = require( '../urlGenerator.js' );
|
||||
|
||||
// Based on mediawiki.searchSuggest
|
||||
// eslint-disable-next-line array-callback-return
|
||||
const searchNS = Object.entries( mw.config.get( 'wgFormattedNamespaces' ) ).map( ( [ nsID ] ) => {
|
||||
if ( nsID >= 0 && mw.user.options.get( 'searchNs' + nsID ) ) {
|
||||
// Cast string key to number
|
||||
return Number( nsID );
|
||||
}
|
||||
} ).filter( ( item ) => item !== undefined );
|
||||
|
||||
/**
|
||||
* @typedef {Object} ActionResponse
|
||||
* @property {ActionQuery[]} query
|
||||
|
@ -151,12 +160,14 @@ function mwActionApiSearchClient( config ) {
|
|||
const descriptionSource = config.wgCitizenSearchDescriptionSource;
|
||||
|
||||
const searchApiUrl = config.wgScriptPath + '/api.php';
|
||||
|
||||
const params = {
|
||||
format: 'json',
|
||||
formatversion: '2',
|
||||
action: 'query',
|
||||
smaxage: cacheExpiry,
|
||||
maxage: cacheExpiry,
|
||||
namespace: searchNS,
|
||||
generator: 'prefixsearch',
|
||||
gpssearch: q,
|
||||
gpslimit: limit.toString(),
|
||||
|
|
Loading…
Reference in a new issue