jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/358086 )
Change subject: Handle simply newlines ...................................................................... Handle simply newlines Remove multiple empty lines and add some lines to functions Prepare to make phpcs pass Change-Id: I82926472980bd51ebe6375252d4154155397158b --- M CirrusSearch.php M includes/BuildDocument/Completion/SuggestBuilder.php M includes/BuildDocument/Completion/SuggestScoring.php M includes/CompletionSuggester.php M includes/Connection.php M includes/Elastica/MultiSearch.php M includes/Elastica/ReindexTask.php M includes/Extra/Query/TokenCountRouter.php M includes/Hooks.php M includes/InterwikiSearcher.php M includes/Maintenance/AnalysisConfigBuilder.php M includes/Maintenance/IndexCreator.php M includes/Maintenance/MappingConfigBuilder.php M includes/Maintenance/MetaStoreIndex.php M includes/NearMatchPicker.php M includes/OtherIndexes.php M includes/Query/FullTextSimpleMatchQueryBuilder.php M includes/Query/SimpleKeywordFeature.php M includes/Sanity/Checker.php M includes/Sanity/Remediator.php M includes/Search/DatetimeIndexField.php M includes/Search/RescoreBuilders.php M includes/Search/ResultsType.php M includes/Search/SearchContext.php M includes/Search/SourceTextIndexField.php M includes/Search/TextIndexField.php M includes/Searcher.php M includes/SiteMatrixInterwikiResolver.php M includes/Util.php M maintenance/forceSearchIndex.php M maintenance/saneitizeJobs.php M maintenance/updateSuggesterIndex.php M profiles/PhraseSuggesterProfiles.config.php M profiles/PhraseSuggesterProfiles.php M tests/jenkins/FullyFeaturedConfig.php M tests/relforge/bm25enwiki/rescore.inc M tests/relforge/bm25enwiki_inclinks_pv/rescore.inc M tests/relforge/bm25enwiki_inclinks_pv_reverse/rescore.inc M tests/relforge/bm25frwiki/rescore.inc M tests/relforge/en-wp-bm25-wp10-normal-sugg/rescore.inc M tests/relforge/en-wp-bm25-wp10/rescore.inc M tests/unit/CompletionSuggesterTest.php M tests/unit/InterwikiResolverTest.php M tests/unit/RequestLoggerTest.php M tests/unit/SearcherTest.php M tests/unit/SuggestScoringTest.php M tests/unit/UserTestingTest.php 47 files changed, 83 insertions(+), 84 deletions(-) Approvals: Cindy-the-browser-test-bot: Looks good to me, but someone else must approve jenkins-bot: Verified DCausse: Looks good to me, approved diff --git a/CirrusSearch.php b/CirrusSearch.php index 726c1cf..c2e6fc2 100644 --- a/CirrusSearch.php +++ b/CirrusSearch.php @@ -531,7 +531,6 @@ 'minimum_should_match' => '30%', ]; - // Hard limit to the max_query_terms parameter of more like this queries. // This prevent running too large queries. $wgCirrusSearchMoreLikeThisMaxQueryTermsLimit = 100; @@ -811,7 +810,6 @@ */ $wgCirrusSearchUseIcuTokenizer = 'default'; - /** * Set the default scoring function to be used by maintenance/updateSuggesterIndex.php * @see includes/BuildDocument/SuggestScoring.php for more details about scoring functions @@ -1090,7 +1088,6 @@ * reindex is running. */ $wgCirrusSearchPrefixIds = false; - /** * Adds an artificial backend latency in miroseconds. diff --git a/includes/BuildDocument/Completion/SuggestBuilder.php b/includes/BuildDocument/Completion/SuggestBuilder.php index 69c067b..7de959d 100644 --- a/includes/BuildDocument/Completion/SuggestBuilder.php +++ b/includes/BuildDocument/Completion/SuggestBuilder.php @@ -217,7 +217,6 @@ return array_values( array_unique( $fields ) ); } - /** * Builds the 'title' suggestion. * diff --git a/includes/BuildDocument/Completion/SuggestScoring.php b/includes/BuildDocument/Completion/SuggestScoring.php index 359e7de..ef64e76 100644 --- a/includes/BuildDocument/Completion/SuggestScoring.php +++ b/includes/BuildDocument/Completion/SuggestScoring.php @@ -66,7 +66,6 @@ public function setMaxDocs( $maxDocs ); } - /** * Very simple scoring method based on incoming links */ @@ -88,7 +87,8 @@ /** * @param int $maxDocs */ - public function setMaxDocs( $maxDocs ) {} + public function setMaxDocs( $maxDocs ) { + } } /** @@ -276,7 +276,6 @@ } } } - /** * Score that combines QualityScore and the pageviews statistics (popularity) diff --git a/includes/CompletionSuggester.php b/includes/CompletionSuggester.php index 9fc8bf7..84523d9 100644 --- a/includes/CompletionSuggester.php +++ b/includes/CompletionSuggester.php @@ -404,7 +404,6 @@ // for CrossNS redirect we prefer the returned suggestion $suggestion->setText( $targetTitle ); - } else { $suggestion->setText( $page ); } diff --git a/includes/Connection.php b/includes/Connection.php index f6e67b7..139532f 100644 --- a/includes/Connection.php +++ b/includes/Connection.php @@ -254,7 +254,6 @@ return $matches[1]; } - /** * Get the index suffix for a given namespace * @param int $namespace A namespace id diff --git a/includes/Elastica/MultiSearch.php b/includes/Elastica/MultiSearch.php index 070a600..ecf3cd8 100644 --- a/includes/Elastica/MultiSearch.php +++ b/includes/Elastica/MultiSearch.php @@ -24,6 +24,7 @@ ]; $queryOptions = array_diff_key( $header, $toKeep ); $actualHeader = array_intersect_key( $header, $toKeep );; + $data = \Elastica\JSON::stringify($actualHeader)."\n"; $queryBody = $query->toArray() + $queryOptions; $data .= \Elastica\JSON::stringify($queryBody)."\n"; diff --git a/includes/Elastica/ReindexTask.php b/includes/Elastica/ReindexTask.php index d479961..c5e43d5 100644 --- a/includes/Elastica/ReindexTask.php +++ b/includes/Elastica/ReindexTask.php @@ -119,7 +119,6 @@ return new ReindexStatus( $status ); } - private function mergeStatusWithChildren( array $status, array $childResponse ) { foreach ( $childResponse['nodes'] as $nodeData ) { foreach ( $nodeData['tasks'] as $taskId => $childData ) { diff --git a/includes/Extra/Query/TokenCountRouter.php b/includes/Extra/Query/TokenCountRouter.php index 9f56156..ca34e46 100644 --- a/includes/Extra/Query/TokenCountRouter.php +++ b/includes/Extra/Query/TokenCountRouter.php @@ -124,8 +124,10 @@ case self::EQ: case self::NEQ: case self::LT: - case self::LTE: break; - default: throw new \InvalidArgumentException( "$type is not allowed as a condition type" ); + case self::LTE: + break; + default: + throw new \InvalidArgumentException( "$type is not allowed as a condition type" ); } return $this->addParam( 'conditions', [ $type => $value, diff --git a/includes/Hooks.php b/includes/Hooks.php index a1e02ec..56443f3 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -665,7 +665,6 @@ return $result; } - /** * ResourceLoaderGetConfigVars hook handler * This should be used for variables which vary with the html @@ -828,7 +827,6 @@ ); return true; } - /** * When article is undeleted - check the archive for other instances of the title, diff --git a/includes/InterwikiSearcher.php b/includes/InterwikiSearcher.php index c19482e..4621ed5 100644 --- a/includes/InterwikiSearcher.php +++ b/includes/InterwikiSearcher.php @@ -166,7 +166,12 @@ // take the first 8 chars from the md5 to build a uint32 // and to prevent hexdec from returning floats mt_srand( hexdec( substr( Util::generateIdentToken(), 0, 8 ) ) ); - $sortKeys = array_map( function () { return mt_rand(); }, $retval ); + $sortKeys = array_map( + function () { + return mt_rand(); + }, + $retval + ); // "Randomly" sort crossproject results // Should give the same order for the same identity array_multisort( $sortKeys, SORT_ASC, $retval ); @@ -209,7 +214,9 @@ */ private function prepareContextKey( $overriddenProfiles ) { return implode( '|', array_map( - function( $v, $k ) { return "$k:$v"; }, + function( $v, $k ) { + return "$k:$v"; + }, $overriddenProfiles, array_keys( $overriddenProfiles ) ) ); diff --git a/includes/Maintenance/AnalysisConfigBuilder.php b/includes/Maintenance/AnalysisConfigBuilder.php index 904efec..6af8d98 100644 --- a/includes/Maintenance/AnalysisConfigBuilder.php +++ b/includes/Maintenance/AnalysisConfigBuilder.php @@ -125,13 +125,16 @@ $in_config = 'no'; } switch( $in_config ) { - case 'yes': return true; - case 'no': return false; + case 'yes': + return true; + case 'no': + return false; case 'default': if ( isset( $this->languagesWithIcuFolding[$this->language] ) ) { return $this->languagesWithIcuFolding[$this->language]; } - default: return false; + default: + return false; } } @@ -146,13 +149,16 @@ } $in_config = $this->config->get( 'CirrusSearchUseIcuTokenizer' ); switch( $in_config ) { - case 'yes': return true; - case 'no': return false; + case 'yes': + return true; + case 'no': + return false; case 'default': if ( isset( $this->languagesWithIcuTokenization[$this->language] ) ) { return $this->languagesWithIcuTokenization[$this->language]; } - default: return false; + default: + return false; } } @@ -322,10 +328,14 @@ switch( $this->language ) { // @todo: complete the default filters per language // For Swedish (sv), see https://www.mediawiki.org/wiki/User:TJones_(WMF)/T160562 - case 'fi': return '[^åäöÅÄÖ]'; - case 'ru': return '[^йЙ]'; - case 'sv': return '[^åäöÅÄÖ]'; - default: return null; + case 'fi': + return '[^åäöÅÄÖ]'; + case 'ru': + return '[^йЙ]'; + case 'sv': + return '[^åäöÅÄÖ]'; + default: + return null; } } diff --git a/includes/Maintenance/IndexCreator.php b/includes/Maintenance/IndexCreator.php index 31614fd..a1fccae 100644 --- a/includes/Maintenance/IndexCreator.php +++ b/includes/Maintenance/IndexCreator.php @@ -116,7 +116,6 @@ $args['settings']['index.query.default_field'] = 'all'; } - return $args; } diff --git a/includes/Maintenance/MappingConfigBuilder.php b/includes/Maintenance/MappingConfigBuilder.php index 05bb836..373e755 100644 --- a/includes/Maintenance/MappingConfigBuilder.php +++ b/includes/Maintenance/MappingConfigBuilder.php @@ -124,7 +124,6 @@ ]; } - $page = [ 'dynamic' => false, '_all' => [ 'enabled' => false ], diff --git a/includes/Maintenance/MetaStoreIndex.php b/includes/Maintenance/MetaStoreIndex.php index 7cbc729..ae19597 100644 --- a/includes/Maintenance/MetaStoreIndex.php +++ b/includes/Maintenance/MetaStoreIndex.php @@ -327,7 +327,6 @@ return $indexName; } - private function majorUpgrade() { $plugins = $this->configUtils->scanAvailableModules(); if ( !array_search( 'reindex', $plugins ) ) { diff --git a/includes/NearMatchPicker.php b/includes/NearMatchPicker.php index 3a8a4a8..2378511 100644 --- a/includes/NearMatchPicker.php +++ b/includes/NearMatchPicker.php @@ -78,7 +78,9 @@ } $transformers = [ - function( $term ) { return $term; }, + function( $term ) { + return $term; + }, [ $this->language, 'lc' ], [ $this->language, 'ucwords' ], ]; diff --git a/includes/OtherIndexes.php b/includes/OtherIndexes.php index fe97f74..ee00c49 100644 --- a/includes/OtherIndexes.php +++ b/includes/OtherIndexes.php @@ -81,7 +81,6 @@ return; } - $updates = []; // Build multisearch to find ids to update diff --git a/includes/Query/FullTextSimpleMatchQueryBuilder.php b/includes/Query/FullTextSimpleMatchQueryBuilder.php index a705e39..2f74a20 100644 --- a/includes/Query/FullTextSimpleMatchQueryBuilder.php +++ b/includes/Query/FullTextSimpleMatchQueryBuilder.php @@ -284,7 +284,6 @@ $boolQuery->addFilter( $filter ); } - /** * Builds a simple filter on all and all.plain when all terms must match * diff --git a/includes/Query/SimpleKeywordFeature.php b/includes/Query/SimpleKeywordFeature.php index 718a4c4..5ef05ed 100644 --- a/includes/Query/SimpleKeywordFeature.php +++ b/includes/Query/SimpleKeywordFeature.php @@ -54,7 +54,9 @@ $keyListRegex = implode( '|', array_map( - function( $kw ) { return preg_quote( $kw ); }, + function( $kw ) { + return preg_quote( $kw ); + }, $this->getKeywords() ) ); diff --git a/includes/Sanity/Checker.php b/includes/Sanity/Checker.php index b600e97..c8da26e 100644 --- a/includes/Sanity/Checker.php +++ b/includes/Sanity/Checker.php @@ -248,7 +248,6 @@ return false; } - /** * Check that the indexed version of the page is the * latest version in the database. diff --git a/includes/Sanity/Remediator.php b/includes/Sanity/Remediator.php index 1cd3812..eb194f8 100644 --- a/includes/Sanity/Remediator.php +++ b/includes/Sanity/Remediator.php @@ -66,28 +66,41 @@ * Remediator that takes no actions. */ class NoopRemediator implements Remediator { - public function redirectInIndex( WikiPage $page ) {} - public function pageNotInIndex( WikiPage $page ) {} + + /** + * @param WikiPage $page + */ + public function redirectInIndex( WikiPage $page ) { + } + + /** + * @param WikiPage $page + */ + public function pageNotInIndex( WikiPage $page ) { + } /** * @param string $docId * @param Title $title */ - public function ghostPageInIndex( $docId, Title $title ) {} + public function ghostPageInIndex( $docId, Title $title ) { + } /** * @param string $docId * @param WikiPage $page * @param string $indexType */ - public function pageInWrongIndex( $docId, WikiPage $page, $indexType ) {} + public function pageInWrongIndex( $docId, WikiPage $page, $indexType ) { + } /** * @param string $docId elasticsearch document id * @param WikiPage $page page with outdated document in index * @param string $indexType index contgaining outdated document */ - public function oldVersionInIndex( $docId, WikiPage $page, $indexType ) {} + public function oldVersionInIndex( $docId, WikiPage $page, $indexType ) { + } } /** diff --git a/includes/Search/DatetimeIndexField.php b/includes/Search/DatetimeIndexField.php index 5da5a88..f22f9bb 100644 --- a/includes/Search/DatetimeIndexField.php +++ b/includes/Search/DatetimeIndexField.php @@ -3,6 +3,7 @@ namespace CirrusSearch\Search; use SearchEngine; + /** * Index field representing datetime field. * @package CirrusSearch diff --git a/includes/Search/RescoreBuilders.php b/includes/Search/RescoreBuilders.php index e4f07a5..f3f680b 100644 --- a/includes/Search/RescoreBuilders.php +++ b/includes/Search/RescoreBuilders.php @@ -104,7 +104,8 @@ case self::FUNCTION_SCORE_TYPE: $funcChain = new FunctionScoreChain( $this->context, $rescoreDef['function_chain'] ); return $funcChain->buildRescoreQuery(); - default: throw new InvalidRescoreProfileException( "Unsupported rescore query type: " . $rescoreDef['type'] ); + default: + throw new InvalidRescoreProfileException( "Unsupported rescore query type: " . $rescoreDef['type'] ); } } diff --git a/includes/Search/ResultsType.php b/includes/Search/ResultsType.php index 0b59b4b..80d634e 100644 --- a/includes/Search/ResultsType.php +++ b/includes/Search/ResultsType.php @@ -421,7 +421,6 @@ return $config; } - /** * Behaves like array_merge with recursive descent. Unlike array_merge_recursive, * but just like array_merge, this does not convert non-arrays into arrays. diff --git a/includes/Search/SearchContext.php b/includes/Search/SearchContext.php index 36a98f5..6e2bd11 100644 --- a/includes/Search/SearchContext.php +++ b/includes/Search/SearchContext.php @@ -318,7 +318,6 @@ $this->preferRecentHalfLife = $preferRecentHalfLife; } - /** * @return bool true if preferRecent options have been set. */ @@ -659,7 +658,6 @@ } $mainQuery->addFilter( $unifiedFilter ); } - return $mainQuery; } diff --git a/includes/Search/SourceTextIndexField.php b/includes/Search/SourceTextIndexField.php index bb14feb..4d2acc0 100644 --- a/includes/Search/SourceTextIndexField.php +++ b/includes/Search/SourceTextIndexField.php @@ -23,7 +23,6 @@ } } - /** * @param SearchEngine $engine * @return array|void diff --git a/includes/Search/TextIndexField.php b/includes/Search/TextIndexField.php index a059a08..9297c9c 100644 --- a/includes/Search/TextIndexField.php +++ b/includes/Search/TextIndexField.php @@ -200,7 +200,6 @@ } } - /** * Init the field flags */ diff --git a/includes/Searcher.php b/includes/Searcher.php index e31384b..e022b60 100644 --- a/includes/Searcher.php +++ b/includes/Searcher.php @@ -25,7 +25,6 @@ use User; use WebRequest; - /** * Performs searches using Elasticsearch. Note that each instance of this class * is single use only. @@ -370,8 +369,6 @@ $features, $builderSettings['settings'] ); - - if ( !( $qb instanceof FullTextQueryBuilder ) ) { throw new RuntimeException( "Bad builder class configured: {$builderSettings['builder_class']}" ); diff --git a/includes/SiteMatrixInterwikiResolver.php b/includes/SiteMatrixInterwikiResolver.php index 139c3b6..4181e4b 100644 --- a/includes/SiteMatrixInterwikiResolver.php +++ b/includes/SiteMatrixInterwikiResolver.php @@ -50,7 +50,6 @@ return true; } - protected function loadMatrix() { $cacheKey = $this->cache->makeKey( 'cirrussearch-interwiki-matrix', 'v1' ); $matrix = $this->cache->getWithSetCallback( diff --git a/includes/Util.php b/includes/Util.php index 00dd519..bc897b2 100644 --- a/includes/Util.php +++ b/includes/Util.php @@ -440,5 +440,4 @@ } } - } diff --git a/maintenance/forceSearchIndex.php b/maintenance/forceSearchIndex.php index 166c513..5712af1 100644 --- a/maintenance/forceSearchIndex.php +++ b/maintenance/forceSearchIndex.php @@ -65,7 +65,6 @@ */ private $pageIds; - public function __construct() { parent::__construct(); $this->mDescription = "Force indexing some pages. Setting --from or --to will switch from page id based indexing to " @@ -201,7 +200,6 @@ $updater->deletePages( $batch['titlesToDelete'], $batch['docIdsToDelete'] ); } } - $completed += $size; $rate = $this->calculateIndexingRate( $completed, $operationStartTime ); @@ -385,7 +383,6 @@ ]; } ); } - protected function getIdsIterator() { $dbr = $this->getDB( DB_REPLICA, ['vslow'] ); diff --git a/maintenance/saneitizeJobs.php b/maintenance/saneitizeJobs.php index 7e908d1..f3f718f 100644 --- a/maintenance/saneitizeJobs.php +++ b/maintenance/saneitizeJobs.php @@ -323,7 +323,6 @@ return true; } - private function initMetaStores() { $connections = []; if ( $this->hasOption( 'cluster' ) ) { diff --git a/maintenance/updateSuggesterIndex.php b/maintenance/updateSuggesterIndex.php index aad2631..d634b3f 100644 --- a/maintenance/updateSuggesterIndex.php +++ b/maintenance/updateSuggesterIndex.php @@ -113,7 +113,6 @@ */ private $availablePlugins; - /** * @var string */ diff --git a/profiles/PhraseSuggesterProfiles.config.php b/profiles/PhraseSuggesterProfiles.config.php index 623c2d1..d1f8c2a 100644 --- a/profiles/PhraseSuggesterProfiles.config.php +++ b/profiles/PhraseSuggesterProfiles.config.php @@ -1,6 +1,7 @@ <?php namespace CirrusSearch; + /** * CirrusSearch - List of profiles for "Did you mean" suggestions * diff --git a/profiles/PhraseSuggesterProfiles.php b/profiles/PhraseSuggesterProfiles.php index 11d7430..b3acbd1 100644 --- a/profiles/PhraseSuggesterProfiles.php +++ b/profiles/PhraseSuggesterProfiles.php @@ -1,6 +1,7 @@ <?php namespace CirrusSearch; + use MediaWiki\MediaWikiServices; /** diff --git a/tests/jenkins/FullyFeaturedConfig.php b/tests/jenkins/FullyFeaturedConfig.php index a637292..4d147be 100644 --- a/tests/jenkins/FullyFeaturedConfig.php +++ b/tests/jenkins/FullyFeaturedConfig.php @@ -22,7 +22,6 @@ require_once( "$IP/extensions/Elastica/Elastica.php" ); - $wgSearchType = 'CirrusSearch'; $wgCirrusSearchUseExperimentalHighlighter = true; $wgCirrusSearchOptimizeIndexForExperimentalHighlighter = true; diff --git a/tests/relforge/bm25enwiki/rescore.inc b/tests/relforge/bm25enwiki/rescore.inc index c7a3693..9d366cf 100644 --- a/tests/relforge/bm25enwiki/rescore.inc +++ b/tests/relforge/bm25enwiki/rescore.inc @@ -1,7 +1,5 @@ <?php - - // w sum with pageviews and inc links $wgCirrusSearchPageViewsW = 2.5; $wgCirrusSearchPageViewsK = 8E-6; @@ -44,7 +42,6 @@ ), ), ); - $wgCirrusSearchRescoreProfiles['relforge_inclinks'] = array( 'supported_namespaces' => 'all', diff --git a/tests/relforge/bm25enwiki_inclinks_pv/rescore.inc b/tests/relforge/bm25enwiki_inclinks_pv/rescore.inc index 625acc3..d4e46ff 100644 --- a/tests/relforge/bm25enwiki_inclinks_pv/rescore.inc +++ b/tests/relforge/bm25enwiki_inclinks_pv/rescore.inc @@ -1,7 +1,5 @@ <?php - - // w sum with pageviews and inc links $wgCirrusSearchPageViewsW = 1.5;//0.;//2.5; $wgCirrusSearchPageViewsK = 8E-6; @@ -40,7 +38,6 @@ ), ), ); - $wgCirrusSearchRescoreProfiles['relforge_inclinks'] = array( 'supported_namespaces' => 'all', diff --git a/tests/relforge/bm25enwiki_inclinks_pv_reverse/rescore.inc b/tests/relforge/bm25enwiki_inclinks_pv_reverse/rescore.inc index 625acc3..d4e46ff 100644 --- a/tests/relforge/bm25enwiki_inclinks_pv_reverse/rescore.inc +++ b/tests/relforge/bm25enwiki_inclinks_pv_reverse/rescore.inc @@ -1,7 +1,5 @@ <?php - - // w sum with pageviews and inc links $wgCirrusSearchPageViewsW = 1.5;//0.;//2.5; $wgCirrusSearchPageViewsK = 8E-6; @@ -40,7 +38,6 @@ ), ), ); - $wgCirrusSearchRescoreProfiles['relforge_inclinks'] = array( 'supported_namespaces' => 'all', diff --git a/tests/relforge/bm25frwiki/rescore.inc b/tests/relforge/bm25frwiki/rescore.inc index 3cba021..9ee6f74 100644 --- a/tests/relforge/bm25frwiki/rescore.inc +++ b/tests/relforge/bm25frwiki/rescore.inc @@ -1,7 +1,5 @@ <?php - - // w sum with pageviews and inc links $wgCirrusSearchPageViewsW = 0.5;//2.5; $wgCirrusSearchPageViewsK = 8E-6; @@ -44,7 +42,6 @@ ), ), ); - $wgCirrusSearchRescoreProfiles['relforge_inclinks'] = array( 'supported_namespaces' => 'all', diff --git a/tests/relforge/en-wp-bm25-wp10-normal-sugg/rescore.inc b/tests/relforge/en-wp-bm25-wp10-normal-sugg/rescore.inc index 821e3cf..58cbb1f 100644 --- a/tests/relforge/en-wp-bm25-wp10-normal-sugg/rescore.inc +++ b/tests/relforge/en-wp-bm25-wp10-normal-sugg/rescore.inc @@ -1,7 +1,5 @@ <?php - - // w sum with pageviews and inc links $CirrusSearchWP10W = 3; $wgCirrusSearchPageViewsW = 3;//0.;//2.5; @@ -41,7 +39,6 @@ ), ), ); - $wgCirrusSearchRescoreProfiles['relforge_inclinks'] = array( 'supported_namespaces' => 'all', diff --git a/tests/relforge/en-wp-bm25-wp10/rescore.inc b/tests/relforge/en-wp-bm25-wp10/rescore.inc index 821e3cf..58cbb1f 100644 --- a/tests/relforge/en-wp-bm25-wp10/rescore.inc +++ b/tests/relforge/en-wp-bm25-wp10/rescore.inc @@ -1,7 +1,5 @@ <?php - - // w sum with pageviews and inc links $CirrusSearchWP10W = 3; $wgCirrusSearchPageViewsW = 3;//0.;//2.5; @@ -41,7 +39,6 @@ ), ), ); - $wgCirrusSearchRescoreProfiles['relforge_inclinks'] = array( 'supported_namespaces' => 'all', diff --git a/tests/unit/CompletionSuggesterTest.php b/tests/unit/CompletionSuggesterTest.php index 83faeec..fdde272 100644 --- a/tests/unit/CompletionSuggesterTest.php +++ b/tests/unit/CompletionSuggesterTest.php @@ -38,7 +38,6 @@ $this->assertEquals( $expectedQueries, $suggest ); } - public function provideQueries() { $simpleProfile = [ 'plain' => [ diff --git a/tests/unit/InterwikiResolverTest.php b/tests/unit/InterwikiResolverTest.php index 01746ce..e0a8f68 100644 --- a/tests/unit/InterwikiResolverTest.php +++ b/tests/unit/InterwikiResolverTest.php @@ -90,7 +90,8 @@ $resolver->getSameProjectWikiByLang( $arg ) ); break; - default: throw new \Exception( "Invalid op $what" ); + default: + throw new \Exception( "Invalid op $what" ); } } diff --git a/tests/unit/RequestLoggerTest.php b/tests/unit/RequestLoggerTest.php index 8ed0b22..550259f 100644 --- a/tests/unit/RequestLoggerTest.php +++ b/tests/unit/RequestLoggerTest.php @@ -113,7 +113,6 @@ $limit = isset( $query['limit'] ) ? $query['limit'] : 20; $namespaces = isset( $query['namespaces'] ) ? $query['namespaces'] : null; - $globals = [ 'wgCirrusSearchFullTextQueryBuilderProfile' => 'default', 'wgCirrusSearchInterwikiSources' => [], diff --git a/tests/unit/SearcherTest.php b/tests/unit/SearcherTest.php index f1f37de..7069047 100644 --- a/tests/unit/SearcherTest.php +++ b/tests/unit/SearcherTest.php @@ -46,7 +46,6 @@ return $tests; } - /** * @dataProvider searchTextProvider */ diff --git a/tests/unit/SuggestScoringTest.php b/tests/unit/SuggestScoringTest.php index ad43d7d..c66a2ad 100644 --- a/tests/unit/SuggestScoringTest.php +++ b/tests/unit/SuggestScoringTest.php @@ -103,7 +103,6 @@ $this->assertEquals( $res, 0, "When score is 0 and boost is 0 the score is still 0." ); } - public function testQualityScoreBoostTemplates() { $goodDoc = [ 'template' => [ 'Good' ] @@ -167,7 +166,6 @@ 'redirect' => array_fill( 0, 100, null ), 'template' => [ 'Bad' ] ]; - $this->assertLessThan( $qs->score( $veryGoodArticle ), $qs->score( $goodArticle ), "Same values but a boosted template give a better score" ); diff --git a/tests/unit/UserTestingTest.php b/tests/unit/UserTestingTest.php index 70eee6b..47a7de8 100644 --- a/tests/unit/UserTestingTest.php +++ b/tests/unit/UserTestingTest.php @@ -45,10 +45,14 @@ ->getMock(); $mockReq->expects( $this->any() ) ->method( 'getIP' ) - ->will( $this->returnCallback( function () { return mt_rand(); } ) ); + ->will( $this->returnCallback( function () { + return mt_rand(); + } ) ); $mockReq->expects( $this->any() ) ->method( 'getHeader' ) - ->will( $this->returnCallback( function () { return mt_rand(); } ) ); + ->will( $this->returnCallback( function () { + return mt_rand(); + } ) ); \RequestContext::getMain()->setRequest( $mockReq ); @@ -109,10 +113,18 @@ ] ), 'wgCirrusSearchBoostLinks' => false, ] ); - $ut = UserTesting::getInstance( function () { return true; } ); + $ut = UserTesting::getInstance( + function () { + return true; + } + ); $this->assertEquals( true, $GLOBALS['wgCirrusSearchBoostLinks'] ); $GLOBALS['wgCirrusSearchBoostLinks'] = false; - $ut = UserTesting::getInstance( function () { return true; } ); + $ut = UserTesting::getInstance( + function () { + return true; + } + ); $this->assertEquals( false, $GLOBALS['wgCirrusSearchBoostLinks'] ); } -- To view, visit https://gerrit.wikimedia.org/r/358086 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I82926472980bd51ebe6375252d4154155397158b Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/CirrusSearch Gerrit-Branch: master Gerrit-Owner: Umherirrender <umherirrender_de...@web.de> Gerrit-Reviewer: Cindy-the-browser-test-bot <bernhardsone...@gmail.com> Gerrit-Reviewer: DCausse <dcau...@wikimedia.org> Gerrit-Reviewer: EBernhardson <ebernhard...@wikimedia.org> Gerrit-Reviewer: Gehel <guillaume.leder...@wikimedia.org> Gerrit-Reviewer: Smalyshev <smalys...@wikimedia.org> Gerrit-Reviewer: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de> Gerrit-Reviewer: Tjones <tjo...@wikimedia.org> Gerrit-Reviewer: Umherirrender <umherirrender_de...@web.de> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits