From: Stanislav Malyshev Date: Wed, 6 Dec 2017 00:10:45 +0000 (-0800) Subject: Add parameter for query/search to fetch augmented data. X-Git-Tag: 1.31.0-rc.0~1216^2 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=769d8a62626ef3132e8cd61720d98c414c0875e0;p=lhc%2Fweb%2Fwiklou.git Add parameter for query/search to fetch augmented data. Bug: T182145 Change-Id: I54b50a1474b885ebe52900fd50729d6353e07807 --- diff --git a/includes/api/ApiQuerySearch.php b/includes/api/ApiQuerySearch.php index f0c4180069..2c681f57af 100644 --- a/includes/api/ApiQuerySearch.php +++ b/includes/api/ApiQuerySearch.php @@ -272,6 +272,16 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { if ( isset( $prop['isfilematch'] ) ) { $vals['isfilematch'] = $result->isFileMatch(); } + + if ( isset( $prop['extensiondata'] ) ) { + $extra = $result->getExtensionData(); + // Add augmented data to the result. The data would be organized as a map: + // augmentorName => data + if ( $extra ) { + $vals['extensiondata'] = ApiResult::addMetadataToResultVars( $extra ); + } + } + return $vals; } @@ -372,6 +382,7 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { 'categorysnippet', 'score', // deprecated 'hasrelated', // deprecated + 'extensiondata', ], ApiBase::PARAM_ISMULTI => true, ApiBase::PARAM_HELP_MSG_PER_VALUE => [], diff --git a/includes/api/i18n/en.json b/includes/api/i18n/en.json index 91c3e185b0..e1360c8ad8 100644 --- a/includes/api/i18n/en.json +++ b/includes/api/i18n/en.json @@ -1153,6 +1153,7 @@ "apihelp-query+search-paramvalue-prop-sectiontitle": "Adds the title of the matching section.", "apihelp-query+search-paramvalue-prop-categorysnippet": "Adds a parsed snippet of the matching category.", "apihelp-query+search-paramvalue-prop-isfilematch": "Adds a boolean indicating if the search matched file content.", + "apihelp-query+search-paramvalue-prop-extensiondata": "Adds extra data generated by extensions.", "apihelp-query+search-paramvalue-prop-score": "Ignored.", "apihelp-query+search-paramvalue-prop-hasrelated": "Ignored.", "apihelp-query+search-param-limit": "How many total pages to return.", diff --git a/includes/api/i18n/qqq.json b/includes/api/i18n/qqq.json index 47afdc12b9..1724fa905b 100644 --- a/includes/api/i18n/qqq.json +++ b/includes/api/i18n/qqq.json @@ -1077,6 +1077,7 @@ "apihelp-query+search-paramvalue-prop-sectiontitle": "{{doc-apihelp-paramvalue|query+search|prop|sectiontitle}}", "apihelp-query+search-paramvalue-prop-categorysnippet": "{{doc-apihelp-paramvalue|query+search|prop|categorysnippet}}", "apihelp-query+search-paramvalue-prop-isfilematch": "{{doc-apihelp-paramvalue|query+search|prop|isfilematch}}", + "apihelp-query+search-paramvalue-prop-extensiondata": "{{doc-apihelp-paramvalue|query+search|prop|extensiondata}}", "apihelp-query+search-paramvalue-prop-score": "{{doc-apihelp-paramvalue|query+search|prop|score}}\n{{Identical|Ignored}}", "apihelp-query+search-paramvalue-prop-hasrelated": "{{doc-apihelp-paramvalue|query+search|prop|hasrelated}}\n{{Identical|Ignored}}", "apihelp-query+search-param-limit": "{{doc-apihelp-param|query+search|limit}}",