From: David Causse Date: Fri, 27 Jan 2017 14:04:51 +0000 (+0100) Subject: Allow SearchEngine users to access features data X-Git-Tag: 1.31.0-rc.0~4213^2 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=cc61a14751e4dff0d37212eb2d9e3300a7de4843 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 --- 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.