jenkins-bot has submitted this change and it was merged.
Change subject: Add option to turn off all fields in rescore
......................................................................
Add option to turn off all fields in rescore
This is for a performance experiment - it doesn't change the default behavior.
Change-Id: I3f51e2a46b3a75f8380690b86ad160f617f19dfd
(cherry picked from commit 4a8be57238e202029ffede0f4260e9e34e436574)
---
M CirrusSearch.php
M includes/Hooks.php
M includes/Searcher.php
3 files changed, 21 insertions(+), 2 deletions(-)
Approvals:
Chad: Looks good to me, approved
Manybubbles: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/CirrusSearch.php b/CirrusSearch.php
index d3b3180..2b95557 100644
--- a/CirrusSearch.php
+++ b/CirrusSearch.php
@@ -230,6 +230,10 @@
// reindex will cause all searches to find nothing.
$wgCirrusSearchAllFields = array( 'build' => false, 'use' => false );
+// Should Cirrus use the weighted all fields for the phrase rescore if it is
using them
+// for the regular query?
+$wgCirrusSearchAllFieldsForRescore = true;
+
// The method Cirrus will use to extract the opening section of the text.
Valid values are:
// * first_heading - Wikipedia style. Grab the text before the first heading
(h1-h6) tag.
// * none - Do not extract opening text and do not search it.
diff --git a/includes/Hooks.php b/includes/Hooks.php
index 7f5077e..d2e39c9 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -79,7 +79,8 @@
$wgCirrusSearchFunctionRescoreWindowSize,
$wgCirrusSearchFragmentSize,
$wgCirrusSearchBoostLinks,
- $wgCirrusSearchAllFields;
+ $wgCirrusSearchAllFields,
+ $wgCirrusSearchAllFieldsForRescore;
// If the user has the BetaFeature enabled, use Cirrus as
default.
if ( $wgCirrusSearchEnablePref && $user->isLoggedIn() &&
class_exists( 'BetaFeatures' )
@@ -134,6 +135,14 @@
$wgCirrusSearchAllFields[ 'use' ] =
false;
}
}
+ $useAllFieldsForRescore = $request->getVal(
'cirrusUseAllFieldsForRescore' );
+ if ( $useAllFieldsForRescore !== null ) {
+ if ( $useAllFieldsForRescore === 'yes' ) {
+ $wgCirrusSearchAllFieldsForRescore =
true;
+ } elseif( $useAllFieldsForRescore = 'no' ) {
+ $wgCirrusSearchAllFieldsForRescore =
false;
+ }
+ }
}
}
diff --git a/includes/Searcher.php b/includes/Searcher.php
index 9eff90e..67a4f7c 100644
--- a/includes/Searcher.php
+++ b/includes/Searcher.php
@@ -645,10 +645,16 @@
!$this->searchContainedSyntax &&
strpos( $queryStringQueryString, '"' )
=== false &&
strpos( $queryStringQueryString, ' ' )
!== false ) {
+
+ $rescoreFields = $fields;
+ if ( !$wgCirrusSearchAllFieldsForRescore ) {
+ $rescoreFields = $nonAllFields;
+ }
+
$this->rescore[] = array(
'window_size' =>
$wgCirrusSearchPhraseRescoreWindowSize,
'query' => array(
- 'rescore_query' =>
$this->buildSearchTextQueryForFields( $fields,
+ 'rescore_query' =>
$this->buildSearchTextQueryForFields( $rescoreFields,
'"' .
$queryStringQueryString . '"', $wgCirrusSearchPhraseSlop[ 'boost' ] ),
'query_weight' => 1.0,
'rescore_query_weight' =>
$wgCirrusSearchPhraseRescoreBoost,
--
To view, visit https://gerrit.wikimedia.org/r/159339
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I3f51e2a46b3a75f8380690b86ad160f617f19dfd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: wmf/1.24wmf20
Gerrit-Owner: Manybubbles <[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