From 67dcb0b2d6250158511c6dd81a4cb75f5bcf1408 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Wed, 10 Sep 2014 13:16:12 -0700 Subject: [PATCH] Properly deprecate srprop=score|hasrelated Logs stats on usage, output param descriptions for callers. Change-Id: I000b91ff4d81dc1563231cd3ae0b56952b9574fd --- includes/api/ApiQuerySearch.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/includes/api/ApiQuerySearch.php b/includes/api/ApiQuerySearch.php index 6c5023780b..b7dcd0ed2b 100644 --- a/includes/api/ApiQuerySearch.php +++ b/includes/api/ApiQuerySearch.php @@ -67,6 +67,16 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { $searchInfo = array_flip( $params['info'] ); $prop = array_flip( $params['prop'] ); + // Deprecated parameters + if ( isset( $prop['hasrelated'] ) ) { + $this->logFeatureUsage( 'action=search&srprop=hasrelated' ); + $this->setWarning( 'srprop=hasrelated has been deprecated' ); + } + if ( isset( $prop['score'] ) ) { + $this->logFeatureUsage( 'action=search&srprop=score' ); + $this->setWarning( 'srprop=score has been deprecated' ); + } + // Create search engine instance and set options $search = isset( $params['backend'] ) && $params['backend'] != self::BACKEND_NULL_PARAM ? SearchEngine::create( $params['backend'] ) : SearchEngine::create(); @@ -329,14 +339,14 @@ class ApiQuerySearch extends ApiQueryGeneratorBase { ' size - Adds the size of the page in bytes', ' wordcount - Adds the word count of the page', ' timestamp - Adds the timestamp of when the page was last edited', - ' score - Adds the score (if any) from the search engine', + ' score - DEPRECATED and IGNORED', ' snippet - Adds a parsed snippet of the page', ' titlesnippet - Adds a parsed snippet of the page title', ' redirectsnippet - Adds a parsed snippet of the redirect title', ' redirecttitle - Adds the title of the matching redirect', ' sectionsnippet - Adds a parsed snippet of the matching section title', ' sectiontitle - Adds the title of the matching section', - ' hasrelated - Indicates whether a related search is available', + ' hasrelated - DEPRECATED and IGNORED', ), 'offset' => 'Use this value to continue paging (return by query)', 'limit' => 'How many total pages to return', -- 2.20.1