X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQuerySearch.php;h=7d46a5fb08ce71d5463382e095c284b818310d2b;hb=e946bd1432e935dbf77b12dbcf7379ae32d4661c;hp=05b693d552f2e7983b080e24263a00e4a2db770b;hpb=c496cb3ff9ac2bbf73e5d018ef6e4be5942bea7a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQuerySearch.php b/includes/api/ApiQuerySearch.php index 05b693d552..7d46a5fb08 100644 --- a/includes/api/ApiQuerySearch.php +++ b/includes/api/ApiQuerySearch.php @@ -1,9 +1,5 @@ @gmail.com" * * This program is free software; you can redistribute it and/or modify @@ -62,18 +58,6 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { $searchInfo = array_flip( $params['info'] ); $prop = array_flip( $params['prop'] ); - // Deprecated parameters - if ( isset( $prop['hasrelated'] ) ) { - $this->addDeprecation( - [ 'apiwarn-deprecation-parameter', 'srprop=hasrelated' ], 'action=search&srprop=hasrelated' - ); - } - if ( isset( $prop['score'] ) ) { - $this->addDeprecation( - [ 'apiwarn-deprecation-parameter', 'srprop=score' ], 'action=search&srprop=score' - ); - } - // Create search engine instance and set options $search = $this->buildSearchEngine( $params ); $search->setFeatureData( 'rewrite', (bool)$params['enablerewrites'] ); @@ -245,6 +229,7 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { $title = $result->getTitle(); ApiQueryBase::addTitleInfo( $vals, $title ); + $vals['pageid'] = $title->getArticleID(); if ( isset( $prop['size'] ) ) { $vals['size'] = $result->getByteSize(); @@ -283,6 +268,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; } @@ -383,9 +378,14 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { 'categorysnippet', 'score', // deprecated 'hasrelated', // deprecated + 'extensiondata', ], ApiBase::PARAM_ISMULTI => true, ApiBase::PARAM_HELP_MSG_PER_VALUE => [], + ApiBase::PARAM_DEPRECATED_VALUES => [ + 'score' => true, + 'hasrelated' => true + ], ], 'interwiki' => false, 'enablerewrites' => false, @@ -415,6 +415,6 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { } public function getHelpUrls() { - return 'https://www.mediawiki.org/wiki/API:Search'; + return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Search'; } }