From cc61a14751e4dff0d37212eb2d9e3300a7de4843 Mon Sep 17 00:00:00 2001 From: David Causse Date: Fri, 27 Jan 2017 15:04:51 +0100 Subject: [PATCH] Allow SearchEngine users to access features data Useful in case the client wants to re-evaluate what was set here, or if the SearchEngine implementation wants to expose some of its states. In our case it allows CirrusSearch to inform SpecialSearch that we prefer to display search results with a new experimental layout. Bug: T156299 Change-Id: I7f661c852ef70ea7bc9ae2959f7d6e48776a9877 --- includes/search/SearchEngine.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/includes/search/SearchEngine.php b/includes/search/SearchEngine.php index 0bcb07a5a6..206067f0a7 100644 --- a/includes/search/SearchEngine.php +++ b/includes/search/SearchEngine.php @@ -109,6 +109,20 @@ abstract class SearchEngine { $this->features[$feature] = $data; } + /** + * Way to retrieve custom data set by setFeatureData + * or by the engine itself. + * @since 1.29 + * @param string $feature feature name + * @return mixed the feature value or null if unset + */ + public function getFeatureData( $feature ) { + if ( isset ( $this->features[$feature] ) ) { + return $this->features[$feature]; + } + return null; + } + /** * When overridden in derived class, performs database-specific conversions * on text to be used for searching or updating search index. -- 2.20.1