Skip to content

Commit

Permalink
fix(search): 馃悰 avoid double encoding conditions and printouts
Browse files Browse the repository at this point in the history
  • Loading branch information
alistair3149 committed Aug 4, 2023
1 parent 1346151 commit 4b1a39e
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions resources/skins.citizen.search/searchClients/smwAskApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ function smwAskApiSearchClient( config ) {
/**
* @type {fetchByTitle}
*/
fetchByTitle: ( q, limit = config.wgCitizenMaxSearchResults, showDescription = true ) => {
// FIXME: Set showDescription to false for now, the 'Description' key in printout seems to be causing issue
fetchByTitle: ( q, limit = config.wgCitizenMaxSearchResults, showDescription = false ) => {
const searchApiUrl = config.wgScriptPath + '/api.php';

const getConditions = () => {
Expand All @@ -118,23 +119,23 @@ function smwAskApiSearchClient( config ) {
return s.replace( /\[|\]/g, '' );
};
const conditions = removeSquareBrackets( separateConditions( q ) );
return encodeURIComponent( conditions );
return conditions;
};

const getPrintouts = () => {
/*
* FIXME: Figure out how to assign a label to printout statement in askargs
* TODO: Should let user define what property is used for description and thumbnail
*
* Property list
* Description - Extension:Semantic Meta Tags
* Page_Image - Extension:PageImages and Extension:SemanticExtraSpecialProperties
*/
const printouts = [
'Description',
/* Extension:PageImages and Extension:SemanticExtraSpecialProperties */
'Page_Image'
];
return encodeURIComponent( printouts.join( '|' ) );
if ( showDescription === true ) {
/* Extension:Semantic Meta Tags */
printouts.push( 'Description' );
}
return printouts.join( '|' );
};

// @see https://www.semantic-mediawiki.org/wiki/Help:API:askargs
Expand Down

0 comments on commit 4b1a39e

Please sign in to comment.