jenkins-bot has submitted this change and it was merged.
Change subject: Don't respect the "show redirects" option
......................................................................
Don't respect the "show redirects" option
MWSearch has never respected this and always included redirects. You always
want redirects. I0ebe321a proposes to remove it from MediaWiki entirely.
We also no longer emit the option on the Special:Search.
Change-Id: Icc7514ef3fb6224711aaea7bcff6d423f9c94f40
---
M includes/CirrusSearch.php
M includes/InterwikiSearcher.php
M includes/Searcher.php
M tests/browser/features/did_you_mean.feature
M tests/browser/features/full_text_advanced.feature
5 files changed, 8 insertions(+), 22 deletions(-)
Approvals:
Chad: Looks good to me, approved
Manybubbles: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/includes/CirrusSearch.php b/includes/CirrusSearch.php
index ac50eb8..e582e8b 100644
--- a/includes/CirrusSearch.php
+++ b/includes/CirrusSearch.php
@@ -47,6 +47,7 @@
public function supports( $feature ) {
switch ( $feature ) {
case 'search-update':
+ case 'list-redirects':
return false;
default:
return parent::supports( $feature );
@@ -93,7 +94,7 @@
$status = $searcher->moreLikeThisArticle(
$title->getArticleID() );
}
} else {
- $status = $searcher->searchText( $term,
$this->showRedirects, $this->showSuggestion );
+ $status = $searcher->searchText( $term,
$this->showSuggestion );
}
$this->lastSearchMetrics = $searcher->getSearchMetrics();
diff --git a/includes/InterwikiSearcher.php b/includes/InterwikiSearcher.php
index b276510..308debd 100644
--- a/includes/InterwikiSearcher.php
+++ b/includes/InterwikiSearcher.php
@@ -67,7 +67,7 @@
if ( !$res ) {
$this->setExplicitIndexes( array_values(
$this->interwikis ) );
$this->setResultsType( new InterwikiResultsType(
$this->interwikis ) );
- $results = $this->searchText( $term, false, false );
+ $results = $this->searchText( $term, false );
if ( $results->isOk() ) {
$res = $results->getValue();
$wgMemc->set( $key, $res,
$wgCirrusSearchInterwikiCacheTime );
diff --git a/includes/Searcher.php b/includes/Searcher.php
index 83d137f..25f9ff9 100644
--- a/includes/Searcher.php
+++ b/includes/Searcher.php
@@ -125,10 +125,6 @@
* @var string index base name to use
*/
private $indexBaseName;
- /**
- * @var bool should this search show redirects?
- */
- private $showRedirects;
/**
* @var boolean is this a fuzzy query?
@@ -256,11 +252,10 @@
/**
* Search articles with provided term.
* @param $term string term to search
- * @param $showRedirects boolean should this request show redirects?
* @param boolean $showSuggestion should this search suggest
alternative searches that might be better?
* @param Status(mixed) status containing results defined by
resultsType on success
*/
- public function searchText( $term, $showRedirects, $showSuggestion ) {
+ public function searchText( $term, $showSuggestion ) {
global $wgCirrusSearchPhraseRescoreBoost,
$wgCirrusSearchPhraseRescoreWindowSize,
$wgCirrusSearchPhraseUseText,
@@ -275,7 +270,6 @@
$searcher = $this;
$originalTerm = $term;
$searchContainedSyntax = false;
- $this->showRedirects = $showRedirects;
$this->term = trim( $term );
$this->boostLinks = true;
// Handle title prefix notation
@@ -918,10 +912,10 @@
$fields[] = "text${fieldSuffix}^${weight}";
$fields[] = "file_text${fieldSuffix}^${fileTextWeight}";
}
- if ( $this->showRedirects ) {
- $redirectWeight = $weight * $wgCirrusSearchWeights[
'redirect' ];
- $fields[] =
"redirect.title${fieldSuffix}^${redirectWeight}";
- }
+
+ $redirectWeight = $weight * $wgCirrusSearchWeights[ 'redirect'
];
+ $fields[] = "redirect.title${fieldSuffix}^${redirectWeight}";
+
return $fields;
}
diff --git a/tests/browser/features/did_you_mean.feature
b/tests/browser/features/did_you_mean.feature
index 15bf194..5724b08 100644
--- a/tests/browser/features/did_you_mean.feature
+++ b/tests/browser/features/did_you_mean.feature
@@ -44,14 +44,6 @@
Then there is no suggestion
@suggestions
- Scenario: Suggestions don't come from redirect titles when redirects are not
included in search
- Given I am at the search results page
- And I click the Advanced link
- And I click the List redirects label
- When I search for Rrr Ward
- Then there is no suggestion
-
- @suggestions
Scenario Outline: Special search syntax is preserved in suggestions (though
sometimes moved around)
When I search for <term>
Then <suggested> is suggested
diff --git a/tests/browser/features/full_text_advanced.feature
b/tests/browser/features/full_text_advanced.feature
index 11e6232..5d96b93 100644
--- a/tests/browser/features/full_text_advanced.feature
+++ b/tests/browser/features/full_text_advanced.feature
@@ -39,4 +39,3 @@
| Talk, Help | catapult | Talk:Two Words is |
| Help, Help talk | catapult | none is |
| (Main) or (Article) | catapult | Catapult is in |
- | List redirects | "rdir" | none is |
--
To view, visit https://gerrit.wikimedia.org/r/118593
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Icc7514ef3fb6224711aaea7bcff6d423f9c94f40
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Chad <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: Manybubbles <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits