Manybubbles has uploaded a new change for review.
https://gerrit.wikimedia.org/r/85908
Change subject: Quotes turn off stemming.
......................................................................
Quotes turn off stemming.
Wrap something quotes to get a more specific match that also payes
attention to stop words. This is part of MWSearch.
This change comes at a price: 54526.
Bug: 54020
Change-Id: I934c98d8245b2b52f9d432d71ef3f6adaa0c2bca
---
M CirrusSearchSearcher.php
1 file changed, 16 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch
refs/changes/08/85908/1
diff --git a/CirrusSearchSearcher.php b/CirrusSearchSearcher.php
index 87bf29e..7e9dee1 100644
--- a/CirrusSearchSearcher.php
+++ b/CirrusSearchSearcher.php
@@ -139,6 +139,21 @@
},
$term
);
+ $term = preg_replace_callback(
+ '/(?<main>"([^"]+)"(?:~[0-9]+)?)(?<fuzzy>~)?/',
+ function ( $matches ) use ( $showRedirects,
&$extraQueryStrings ) {
+ $main = $matches[ 'main' ];
+ if ( isset( $matches[ 'fuzzy' ] ) ) {
+ return $main;
+ } else {
+ $query = join( ' OR ',
+
CirrusSearchSearcher::buildFullTextSearchFields( $showRedirects, ".plain:$main"
) );
+ $extraQueryStrings[] =
"($query)";
+ }
+ return '';
+ },
+ $term
+ );
$this->filters = $filters;
// Actual text query
@@ -428,7 +443,7 @@
return $matches[ 'leading' ] . '\\~' .
$matches[ 'trailing' ];
}
}, $string );
- // Turn bad proximity searches into seraches that contain a ~
+ // Turn bad proximity searches into searches that contain a ~
$string = preg_replace_callback( '/"~(?<trailing>\S*)/',
function ( $matches ) {
if ( preg_match( '/[0-9]+/', $matches[ 'trailing' ] ) )
{
return $matches[ 0 ];
--
To view, visit https://gerrit.wikimedia.org/r/85908
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I934c98d8245b2b52f9d432d71ef3f6adaa0c2bca
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Manybubbles <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits