I'm trying to configure my search box to include content pages from two namespaces as suggestions. I've added the namespaces to $wgNamespacesToBeSearchedDefault which works correctly in regular search and also enabled $wgEnableMWSuggest which also works. There is a topic in the Manual:$wgEnableMWSuggest talk page that seems to indicate that this isn't possible but it's been done over at UESP.net. Does anyone know how to do this? If it helps this is the wiki and here is an example search that includes both namespaces in the search results. Thanks in advance.
Topic on Project:Support desk/Flow
I don't know how they did that, but I've asked for a HOWTO and/or the code.
Thanks for looking into it. Explains why I haven't seen it anywhere else. I'll keep an eye on on Daveh's talk page as well.
I know this is old, but I've found a solution.
Edit your resources\src\mediawiki\mediawiki.searchSuggest.js
Change from:
( function ( mw, $ ) {
mw.searchSuggest = {
// queries the wiki and calls response with the result
request: function ( api, query, response, maxRows, namespace ) {
return api.get( {
formatversion: 2,
action: 'opensearch',
search: query,
namespace: namespace || '0',
limit: maxRows,
suggest: true
} ).done( function ( data, jqXHR ) {
response( data[ 1 ], {
type: jqXHR.getResponseHeader( 'X-OpenSearch-Type' ),
query: query
} );
} );
}
};
To:
( function ( mw, $ ) {
mw.searchSuggest = {
// queries the wiki and calls response with the result
request: function ( api, query, response, maxRows, namespace ) {
return api.get( {
formatversion: 2,
action: 'opensearch',
search: query,
namespace: namespace || '0|3010',
limit: maxRows,
suggest: true
} ).done( function ( data, jqXHR ) {
response( data[ 1 ], {
type: jqXHR.getResponseHeader( 'X-OpenSearch-Type' ),
query: query
} );
} );
}
};
Where 3010 is your namespace ID. Use "|" to separate multiple ID's.