DCausse has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/399451 )
Change subject: [WIP] Profile management
......................................................................
[WIP] Profile management
WIP patch to get early feedback on the approach.
Profile are accessible thanks to a SearchProfileService.
This service is loaded by collecting various SearchProfileRepositories.
A search profile repository is:
- typed: what kind of profiles does it stores (similarity, rescores,
functions...)
- named
For now there are two main levels of profile repositories:
- cirrus_base: contains defaults profiles defined in cirrus code (does not
depend on the config)
- cirrus_config: contains customzation made to existing wgCirrusSearch vars
There are no detection of duplicates for few reason:
- I'd like to allow easy transitions to/from cirrus_base/cirrus_config
- This would require listing all the profiles stored in a repository.
I prefer to avoid needing to extract a list to permit implementing
other kind of repositories that may not be able to extract their content
easily.
Extension can register to a hook to declare their own repositories.
This allows extensions to declare the same level of repositories:
- base (stored in the codebase)
- config (customizable by extension config vars)
We do not merge the repositories, we rely on php array which maintains insert
order. In case of name ambiguities the first repo that was declared wins.
Caveats:
I attached the SearchProfileService to the SearchConfig for convenience reasons.
SearchConfig is already available from most places in the code. That creates
a cyclic dependency between SearchConfig and SearchProfileService. Initially
I started to expose the service as a MediaWikiService but realized that it
may require some method signature changes.
The hook is called when the service is constructed but since we are bound
to SearchConfig we call the hook multiple times and sometimes on external
wiki config (during crosslanguage/crossproject). I think this is not ideal
but I don't have yet a good solution for this.
Only two profile types are currently implemented.
Bug: T183279
Change-Id: Icca9a44373d26309ac4e1c2392cebecdf2fae46b
---
M CirrusSearch.php
M autoload.php
M docs/hooks.txt
M includes/Api/ConfigDump.php
M includes/Hooks.php
M includes/InterwikiSearcher.php
M includes/Maintenance/AnalysisConfigBuilder.php
A includes/Profile/ArrayProfileRepository.php
A includes/Profile/SearchProfileRepository.php
A includes/Profile/SearchProfileService.php
A includes/Profile/SearchProfileServiceFactory.php
M includes/Search/CrossProjectBlockScorer.php
M includes/Search/TextIndexField.php
M includes/SearchConfig.php
M includes/Searcher.php
M profiles/CrossProjectBlockScorerProfiles.config.php
D profiles/CrossProjectBlockScorerProfiles.php
R profiles/SimilarityProfiles.config.php
18 files changed, 348 insertions(+), 62 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch
refs/changes/51/399451/1
diff --git a/CirrusSearch.php b/CirrusSearch.php
index a2d3461..24a8786 100644
--- a/CirrusSearch.php
+++ b/CirrusSearch.php
@@ -24,10 +24,8 @@
require_once __DIR__ . "/profiles/SuggestProfiles.php";
require_once __DIR__ . "/profiles/PhraseSuggesterProfiles.config.php";
require_once __DIR__ . "/profiles/RescoreProfiles.config.php";
-require_once __DIR__ . "/profiles/SimilarityProfiles.php";
require_once __DIR__ . "/profiles/SaneitizeProfiles.php";
require_once __DIR__ . "/profiles/FullTextQueryBuilderProfiles.config.php";
-require_once __DIR__ . "/profiles/CrossProjectBlockScorerProfiles.config.php";
$wgExtensionCredits['other'][] = [
'path' => __FILE__,
@@ -493,9 +491,14 @@
/**
* Configure the similarity module
- * see profile/SimilarityProfiles.php for more details
+ * see profile/SimilarityProfiles.config.php for more details
*/
$wgCirrusSearchSimilarityProfile = 'classic';
+
+/**
+ * Extra similarity profiles
+ */
+$wgCirrusSearchSimilarityProfiles = [];
/**
* Weight of fields. Must be integers not decimals. If
$wgCirrusSearchAllFields['use']
@@ -734,6 +737,11 @@
$wgCirrusSearchCrossProjectOrder = 'static';
/**
+ * Profiles to control ordering of blocks of CrossProject searchresults.
+ */
+$wgCirrusSearchCrossProjectBlockScorerProfiles = [];
+
+/**
* The seconds Elasticsearch will wait to batch index changes before making
* them available for search. Lower values make search more real time but put
* more load on Elasticsearch. Defaults to 1 second because that is the
default
diff --git a/autoload.php b/autoload.php
index 32db390..8bd69c2 100644
--- a/autoload.php
+++ b/autoload.php
@@ -35,7 +35,6 @@
'CirrusSearch\\CompletionRequestLog' => __DIR__ .
'/includes/CompletionRequestLog.php',
'CirrusSearch\\CompletionSuggester' => __DIR__ .
'/includes/CompletionSuggester.php',
'CirrusSearch\\Connection' => __DIR__ . '/includes/Connection.php',
- 'CirrusSearch\\CrossProjectBlockScorerProfiles' => __DIR__ .
'/profiles/CrossProjectBlockScorerProfiles.php',
'CirrusSearch\\DataSender' => __DIR__ . '/includes/DataSender.php',
'CirrusSearch\\Dump' => __DIR__ . '/includes/Dump.php',
'CirrusSearch\\ElasticaErrorHandler' => __DIR__ .
'/includes/ElasticaErrorHandler.php',
@@ -111,6 +110,10 @@
'CirrusSearch\\NearMatchPicker' => __DIR__ .
'/includes/NearMatchPicker.php',
'CirrusSearch\\OtherIndexes' => __DIR__ . '/includes/OtherIndexes.php',
'CirrusSearch\\PhraseSuggesterProfiles' => __DIR__ .
'/profiles/PhraseSuggesterProfiles.php',
+ 'CirrusSearch\\Profile\\ArrayProfileRepository' => __DIR__ .
'/includes/Profile/ArrayProfileRepository.php',
+ 'CirrusSearch\\Profile\\SearchProfileRepository' => __DIR__ .
'/includes/Profile/SearchProfileRepository.php',
+ 'CirrusSearch\\Profile\\SearchProfileService' => __DIR__ .
'/includes/Profile/SearchProfileService.php',
+ 'CirrusSearch\\Profile\\SearchProfileServiceFactory' => __DIR__ .
'/includes/Profile/SearchProfileServiceFactory.php',
'CirrusSearch\\Query\\BaseSimpleKeywordFeatureTest' => __DIR__ .
'/tests/unit/Query/BaseSimpleKeywordFeatureTest.php',
'CirrusSearch\\Query\\BoostTemplatesFeature' => __DIR__ .
'/includes/Query/BoostTemplatesFeature.php',
'CirrusSearch\\Query\\CompSuggestQueryBuilder' => __DIR__ .
'/includes/Query/CompSuggestQueryBuilder.php',
diff --git a/docs/hooks.txt b/docs/hooks.txt
index 0da7f7e..ba12bc5 100644
--- a/docs/hooks.txt
+++ b/docs/hooks.txt
@@ -46,3 +46,6 @@
For other parameter examples, see RescoreProfiles.config.php
$context - SearchContext object
&$builder - object implementing the function. Should be placed in this
variable if this extension has it.
+
+'CirrusSearchProfileService': Allows extensions to register search profile
repositories
+$service - \CirrusSearch\Profile\SearchProfileService the profile service
being built
diff --git a/includes/Api/ConfigDump.php b/includes/Api/ConfigDump.php
index e3d3c1f..682987d 100644
--- a/includes/Api/ConfigDump.php
+++ b/includes/Api/ConfigDump.php
@@ -81,6 +81,8 @@
'CirrusSearchEnableArchive',
'CirrusSearchUseIcuFolding',
'CirrusSearchUseIcuTokenizer',
+ 'CirrusSearchCrossProjectBlockScorerProfiles',
+ 'CirrusSearchSimilarityProfiles',
// All the config below was added when moving this data
// from CirrusSearch config to a static array in this class
'CirrusSearchDevelOptions',
diff --git a/includes/Hooks.php b/includes/Hooks.php
index 63a1766..e2e6f50 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -828,7 +828,6 @@
->getResolver( $config );
}
);
- return true;
}
/**
diff --git a/includes/InterwikiSearcher.php b/includes/InterwikiSearcher.php
index 66431f9..2d0629f 100644
--- a/includes/InterwikiSearcher.php
+++ b/includes/InterwikiSearcher.php
@@ -124,8 +124,7 @@
return $retval;
}
- return CrossProjectBlockScorerFactory::load( $this->config )
- ->reorder( $retval );
+ return CrossProjectBlockScorerFactory::load( $this->config
)->reorder( $retval );
}
/**
diff --git a/includes/Maintenance/AnalysisConfigBuilder.php
b/includes/Maintenance/AnalysisConfigBuilder.php
index ae57a5c..0b5e548 100644
--- a/includes/Maintenance/AnalysisConfigBuilder.php
+++ b/includes/Maintenance/AnalysisConfigBuilder.php
@@ -90,10 +90,7 @@
->getConfigFactory()
->makeConfig( 'CirrusSearch' );
}
- $this->similarity = $config->getElement(
- 'CirrusSearchSimilarityProfiles',
- $config->get( 'CirrusSearchSimilarityProfile' )
- );
+ $this->similarity =
$config->getSearchProfileService()->loadSimilarityProfile();
$this->config = $config;
}
diff --git a/includes/Profile/ArrayProfileRepository.php
b/includes/Profile/ArrayProfileRepository.php
new file mode 100644
index 0000000..a8feb62
--- /dev/null
+++ b/includes/Profile/ArrayProfileRepository.php
@@ -0,0 +1,60 @@
+<?php
+
+namespace CirrusSearch\Profile;
+
+class ArrayProfileRepository implements SearchProfileRepository {
+
+ /**
+ * @var string
+ */
+ private $name;
+
+ /**
+ * @var string
+ */
+ private $type;
+
+ /**
+ * @var array
+ */
+ private $profiles;
+
+ /**
+ * ArrayProfileRepository constructor.
+ * @param $repoType
+ * @param $repoName
+ * @param array $profiles
+ */
+ public function __construct( $repoType, $repoName, array $profiles ) {
+ $this->type = $repoType;
+ $this->name = $repoName;
+ $this->profiles = $profiles;
+ }
+
+ /**
+ * The repository type
+ * @return string
+ */
+ public function repositoryType() {
+ return $this->type;
+ }
+
+ /**
+ * The repository name
+ * @return string
+ */
+ public function repositoryName() {
+ return $this->name;
+ }
+
+ /**
+ * Load a profile named $name
+ * @param profile
+ * @return array|null the profile data or null if not found
+ */
+ public function getProfile( $name ) {
+ if ( isset( $this->profiles[$name] ) ) {
+ return $this->profiles[$name];
+ }
+ }
+}
diff --git a/includes/Profile/SearchProfileRepository.php
b/includes/Profile/SearchProfileRepository.php
new file mode 100644
index 0000000..bf886f1
--- /dev/null
+++ b/includes/Profile/SearchProfileRepository.php
@@ -0,0 +1,29 @@
+<?php
+
+namespace CirrusSearch\Profile;
+
+/**
+ * A repository of search profiles
+ *
+ */
+interface SearchProfileRepository {
+
+ /**
+ * The repository type
+ * @return string
+ */
+ public function repositoryType();
+
+ /**
+ * The repository name
+ * @return string
+ */
+ public function repositoryName();
+
+ /**
+ * Load a profile named $name
+ * @param string $name
+ * @return array|null the profile data or null if not found
+ */
+ public function getProfile( $name );
+}
diff --git a/includes/Profile/SearchProfileService.php
b/includes/Profile/SearchProfileService.php
new file mode 100644
index 0000000..9bc472c
--- /dev/null
+++ b/includes/Profile/SearchProfileService.php
@@ -0,0 +1,149 @@
+<?php
+
+namespace CirrusSearch\Profile;
+
+use CirrusSearch\SearchConfig;
+use RuntimeException;
+
+/**
+ * Service to manage and access search profiles.
+ * Search profiles are arranged by type identified by a string constant:
+ * - CROSS_PROJECT_BLOCK_SCORER: use when reordering blocks of crossproject
search results
+ * - SIMILARITY: Define similarity profiles used when building the index
+ *
+ * Multiple repository per type can be declared, in general we have:
+ * - the cirrus_base repository holding the default profiles contained in
cirrus code
+ * - the cirrus_config repository holding the profiles customized using
$wgCirrusSearch config vars.
+ *
+ * The service is bound to a SearchConfig instance which means that the
profiles may vary depending
+ * on the SearchConfig being used. The cirrus_base repository will always hold
the same set of
+ * profiles but the cirrus_config may change according to SearchConfig content.
+ */
+class SearchProfileService {
+
+ /**
+ * Profile type for ordering crossproject result blocks
+ */
+ const CROSS_PROJECT_BLOCK_SCORER = 'crossproject_block_scorer';
+
+ /**
+ * Profile type for
+ */
+ const SIMILARITY = 'similarity';
+
+ /**
+ * List of profiles, grouped by type and then by repository name.
+ * @var SearchProfileRepository[][]
+ */
+ private $repositories = [];
+
+ /**
+ * XXX: SearchConfig also depends on us, there might be a better to do
this
+ * @var SearchConfig
+ */
+ private $config;
+
+ /**
+ * @var boolean
+ */
+ private $frozen;
+
+ public function __construct( SearchConfig $config ) {
+ $this->config = $config;
+ }
+
+ /**
+ * @param string $type repository type
+ * @param string $name profile name
+ * @param bool $failIfMissing set to false to not fail on missing
profile
+ * @return array|null the profile or null
+ */
+ public function loadProfile( $type, $name, $failIfMissing = true ) {
+ $prof = null;
+ if ( isset( $this->repositories[$type] ) ) {
+ $repos = $this->repositories[$type];
+ foreach ( $repos as $repo ) {
+ $prof = $repo->getProfile( $name );
+ if ( $prof ) {
+ break;
+ }
+ }
+ }
+ if ( $prof === null && $failIfMissing ) {
+ throw new RuntimeException( "Cannot load a profile type
$type: $name not found" );
+ }
+ return $prof;
+ }
+
+ /**
+ * Load profile for ordering crossproject result blocks
+ * @return array|null
+ */
+ public function loadCrossProjectBlockScorerProfile() {
+ return $this->loadOverriddenProfile(
self::CROSS_PROJECT_BLOCK_SCORER,
+ 'CirrusSearchCrossProjectOrder',
+ 'cirrusCrossProjectOrderProfile' );
+ }
+
+ /**
+ * Load the similarity profile
+ * @return array
+ */
+ public function loadSimilarityProfile() {
+ return $this->loadOverriddenProfile( self::SIMILARITY,
'CirrusSearchSimilarityProfile' );
+ }
+
+ /**
+ * @param $type string profile type
+ * @param $configVar string config var name holding the profile name
+ * @param $requestVar string request var allowing to override the
profile
+ * @param bool $failsIfMissing set to false to not fail if the profile
is missing
+ * @return array|null the profile
+ */
+ private function loadOverriddenProfile( $type, $configVar, $requestVar
= null ) {
+ $configProfName = $this->config->get( $configVar );
+ $profile = null;
+ if ( $requestVar ) {
+ $overridden = $this->getOverriddenName(
$configProfName, $requestVar );
+ if ( $overridden !== $configProfName ) {
+ $profile = $this->loadProfile( $type,
$overridden );
+ }
+ }
+ if ( $profile === null ) {
+ $profile = $this->loadProfile( $type, $configProfName,
false );
+ }
+ return $profile;
+ }
+
+ private function getOverriddenName( $configVar, $requestVar ) {
+ $request = \RequestContext::getMain()->getRequest();
+ $profile = $request->getVal( $requestVar );
+ if ( $profile != null ) {
+ return $profile;
+ }
+ return $configVar;
+ }
+
+ /**
+ * Register a new profile repository
+ * @param SearchProfileRepository $repository
+ */
+ public function registerRepository( SearchProfileRepository $repository
) {
+ if ( $this->frozen ) {
+ throw new RuntimeException( self::class . " is frozen,
you cannot register new repositories." );
+ }
+ if ( isset(
$this->repositories[$repository->repositoryType()][$repository->repositoryName()]
) ) {
+ throw new RuntimeException( "A profile repository type
{$repository->repositoryType()} " .
+ "named {$repository->repositoryName()} is
already registered." );
+ }
+
$this->repositories[$repository->repositoryType()][$repository->repositoryName()]
= $repository;
+ }
+
+ /**
+ * Freeze the service, any attempt to declare a new repository
+ * will fail.
+ */
+ public function freeze() {
+ $this->frozen = true;
+ }
+}
diff --git a/includes/Profile/SearchProfileServiceFactory.php
b/includes/Profile/SearchProfileServiceFactory.php
new file mode 100644
index 0000000..d1988db
--- /dev/null
+++ b/includes/Profile/SearchProfileServiceFactory.php
@@ -0,0 +1,51 @@
+<?php
+
+namespace CirrusSearch\Profile;
+
+use CirrusSearch\SearchConfig;
+
+/**
+ * Class SearchProfileServiceFactory
+ */
+class SearchProfileServiceFactory {
+
+ private static $cirrusBaseProfiles = [
+ [
+ 'type' =>
SearchProfileService::CROSS_PROJECT_BLOCK_SCORER,
+ 'mw_config_var' =>
'CirrusSearchCrossProjectBlockScorerProfiles',
+ 'cirrus_base' =>
'CrossProjectBlockScorerProfiles.config.php'
+ ],
+ [
+ 'type' => SearchProfileService::SIMILARITY,
+ 'mw_config_var' => 'CirrusSearchSimilarityProfiles',
+ 'cirrus_base' => 'SimilarityProfiles.config.php'
+ ]
+ ];
+
+ /**
+ * @param SearchConfig $config
+ * @return SearchProfileService
+ * @throws \Exception
+ * @throws \FatalError
+ * @throws \MWException
+
+ */
+ public function loadService( SearchConfig $config ) {
+ $service = new SearchProfileService( $config );
+ foreach ( self::$cirrusBaseProfiles as $base ) {
+ $profileArray = include __DIR__ . '/../../profiles/' .
$base['cirrus_base'];
+ $type = $base['type'];
+ $configVar = isset( $base['mw_config_var'] ) ?
$base['mw_config_var'] : null;
+ $service->registerRepository( new
ArrayProfileRepository( $type, 'cirrus_base',
+ $profileArray ) );
+ if ( $configVar !== null && $config->has( $configVar )
) {
+ $service->registerRepository( new
ArrayProfileRepository( $type, 'cirrus_config',
+ $config->get( $configVar ) ) );
+ }
+ }
+ // TODO: we'll run the hook again for crosswiki searches, I'm
not sure it's right
+ \Hooks::run( 'CirrusSearchProfileService', [ $service ] );
+ $service->freeze();
+ return $service;
+ }
+}
diff --git a/includes/Search/CrossProjectBlockScorer.php
b/includes/Search/CrossProjectBlockScorer.php
index d2e0310..872378d 100644
--- a/includes/Search/CrossProjectBlockScorer.php
+++ b/includes/Search/CrossProjectBlockScorer.php
@@ -2,8 +2,8 @@
namespace CirrusSearch\Search;
-use CirrusSearch\Util;
use CirrusSearch\SearchConfig;
+use CirrusSearch\Util;
/**
* Score an interwiki block
@@ -43,15 +43,12 @@
* Factory that reads cirrus config and builds a CrossProjectBlockScorer
*/
class CrossProjectBlockScorerFactory {
- public static function load( SearchConfig $config ) {
- $profileName = $config->get( 'CirrusSearchCrossProjectOrder' );
- $profile = $config->getElement(
'CirrusSearchCrossProjectBlockScorerProfiles', $profileName );
- if ( !$profile ) {
- throw new \RuntimeException( 'Unknown
CrossProjectBlockScorer profile : ' . $profileName );
- }
- if ( !isset( $profile['type'] ) ) {
- throw new \RuntimeException( "Invalid
CrossProjectBlockScorer profile $profileName, 'type' must be set" );
- }
+ /**
+ * @param SearchConfig $searchConfig
+ * @return CrossProjectBlockScorer
+ */
+ public static function load( SearchConfig $searchConfig ) {
+ $profile =
$searchConfig->getSearchProfileService()->loadCrossProjectBlockScorerProfile();
return static::loadScorer( $profile['type'], isset(
$profile['settings'] ) ? $profile['settings'] : [] );
}
diff --git a/includes/Search/TextIndexField.php
b/includes/Search/TextIndexField.php
index f80cd6d..1ec8404 100644
--- a/includes/Search/TextIndexField.php
+++ b/includes/Search/TextIndexField.php
@@ -3,6 +3,7 @@
namespace CirrusSearch\Search;
use CirrusSearch\Maintenance\MappingConfigBuilder;
+use CirrusSearch\Profile\SearchProfileService;
use SearchIndexField;
use CirrusSearch\SearchConfig;
use SearchEngine;
@@ -216,10 +217,10 @@
* @return string
*/
public static function getSimilarity( SearchConfig $config, $field,
$analyzer = null ) {
- $similarity = $config->getElement(
- 'CirrusSearchSimilarityProfiles',
- $config->get( 'CirrusSearchSimilarityProfile' )
- );
+ /**
+ * @var SearchProfileService $profileService
+ */
+ $similarity =
$config->getSearchProfileService()->loadSimilarityProfile();
$fieldSimilarity = null;
if ( isset( $similarity['fields'] ) ) {
if ( isset( $similarity['fields'][$field] ) ) {
diff --git a/includes/SearchConfig.php b/includes/SearchConfig.php
index a44443c..196bacf 100644
--- a/includes/SearchConfig.php
+++ b/includes/SearchConfig.php
@@ -2,6 +2,8 @@
namespace CirrusSearch;
+use CirrusSearch\Profile\SearchProfileService;
+use CirrusSearch\Profile\SearchProfileServiceFactory;
use Config;
use RequestContext;
@@ -52,6 +54,11 @@
* getAvailableClusters() instead of direct access)
*/
private $availableClusters;
+
+ /**
+ * @var SearchProfileService|null
+ */
+ private $profileService;
/**
* Create new search config for current or other wiki.
@@ -318,4 +325,14 @@
}
return false;
}
+
+ /**
+ * @return SearchProfileService
+ */
+ public function getSearchProfileService() {
+ if ( $this->profileService === null ) {
+ $this->profileService = ( new
SearchProfileServiceFactory() )->loadService( $this );
+ }
+ return $this->profileService;
+ }
}
diff --git a/includes/Searcher.php b/includes/Searcher.php
index 3c1752c..b2962e9 100644
--- a/includes/Searcher.php
+++ b/includes/Searcher.php
@@ -2,6 +2,7 @@
namespace CirrusSearch;
+use CirrusSearch\Profile\SearchProfileService;
use CirrusSearch\Query\CountContentWordsBuilder;
use CirrusSearch\Query\NearMatchQueryBuilder;
use CirrusSearch\Query\PrefixSearchQueryBuilder;
@@ -125,6 +126,11 @@
protected $searchContext;
/**
+ * @var SearchProfileService
+ */
+ protected $searchProfilesService;
+
+ /**
* Indexing type we'll be using.
* @var string|\Elastica\Type
*/
diff --git a/profiles/CrossProjectBlockScorerProfiles.config.php
b/profiles/CrossProjectBlockScorerProfiles.config.php
index 7d1eb2f..3ec16e5 100644
--- a/profiles/CrossProjectBlockScorerProfiles.config.php
+++ b/profiles/CrossProjectBlockScorerProfiles.config.php
@@ -1,7 +1,5 @@
<?php
-namespace CirrusSearch;
-
/**
* CirrusSearch - List of FullTextQueryBuilderProfiles used to generate an
elasticsearch
* query by parsing user input.
@@ -30,7 +28,7 @@
* - 'type' the scorer to use (static, recall, random)
* - settings is scorer specific config
*/
-$wgCirrusSearchCrossProjectBlockScorerProfiles = [
+return [
// static ordering, scores are provided in the 'settings' key
// with a score (value) per 'wiki prefix (key)
'static' => [
diff --git a/profiles/CrossProjectBlockScorerProfiles.php
b/profiles/CrossProjectBlockScorerProfiles.php
deleted file mode 100644
index f9d1403..0000000
--- a/profiles/CrossProjectBlockScorerProfiles.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-
-namespace CirrusSearch;
-
-use WebRequest;
-
-/**
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- */
-
-class CrossProjectBlockScorerProfiles {
- public static function overrideOptions( WebRequest $request ) {
- global $wgCirrusSearchCrossProjectBlockScoreProfiles,
- $wgCirrusSearchCrossProjectOrder;
- $profile = $request->getVal( 'cirrusCrossProjectOrderProfile' );
- if ( $profile != null && isset(
$wgCirrusSearchCrossProjectBlockScoreProfiles[$profile] ) ) {
- $wgCirrusSearchCrossProjectOrder = $profile;
- }
- }
-}
diff --git a/profiles/SimilarityProfiles.php
b/profiles/SimilarityProfiles.config.php
similarity index 98%
rename from profiles/SimilarityProfiles.php
rename to profiles/SimilarityProfiles.config.php
index 13d96ed..b8da0b6 100644
--- a/profiles/SimilarityProfiles.php
+++ b/profiles/SimilarityProfiles.config.php
@@ -25,7 +25,7 @@
* http://www.gnu.org/copyleft/gpl.html
*/
-$wgCirrusSearchSimilarityProfiles = [
+return [
// default profile, uses the classic TF/IDF from Lucene.
// deprecated the use of the name default is confusing
'default' => [
--
To view, visit https://gerrit.wikimedia.org/r/399451
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Icca9a44373d26309ac4e1c2392cebecdf2fae46b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: DCausse <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits