jenkins-bot has submitted this change and it was merged.

Change subject: Fix profiling method calls
......................................................................


Fix profiling method calls

Also add a comment to some code that took me a few minutes to recognize.

Bug: 58987
Change-Id: Ie2318bad6a70594a6490cdba1a3798ed9868126e
---
M includes/CirrusSearchSearcher.php
1 file changed, 7 insertions(+), 2 deletions(-)

Approvals:
  Ori.livneh: Looks good to me, approved
  Chad: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/includes/CirrusSearchSearcher.php 
b/includes/CirrusSearchSearcher.php
index c716b1d..e0a4bbb 100644
--- a/includes/CirrusSearchSearcher.php
+++ b/includes/CirrusSearchSearcher.php
@@ -327,7 +327,7 @@
                $this->filters = $filters;
                $this->notFilters = $notFilters;
                wfProfileOut( __METHOD__ . '-other-filters' );
-               wfProfileIn( __METHOD__ . '-switch-phrase-queries-to-plain' );
+               wfProfileIn( __METHOD__ . '-find-phrase-queries' );
                // Match quoted phrases including those containing escaped 
quotes
                // Those phrases can optionally be followed by ~ then a number 
(this is the phrase slop)
                // That can optionally be followed by a ~ (this matches stemmed 
words in phrases)
@@ -342,12 +342,15 @@
                        } );
                wfProfileOut( __METHOD__ . '-find-phrase-queries' );
                wfProfileIn( __METHOD__ . '-switch-prefix-to-plain' );
+               // Find prefix matches and force them to only match against the 
plain analyzed fields.  This
+               // prevents prefix matches from getting confused by stemming.  
Users really don't expect stemming
+               // in prefix queries.
                $query = self::replaceAllPartsOfQuery( $query, 
'/\w*\*(?:\w*\*?)*/',
                        function ( $matches ) use ( $showRedirects ) {
                                $term = 
CirrusSearchSearcher::fixupQueryStringPart( $matches[ 0 ][ 0 ] );
                                return array( 'escaped' => 
CirrusSearchSearcher::switchSearchToExact( $term, $showRedirects ) );
                        } );
-               wfProfileOut( __METHOD__ . '-switch-phrase-queries-to-plain' );
+               wfProfileOut( __METHOD__ . '-switch-prefix-to-plain' );
 
                wfProfileIn( __METHOD__ . '-escape' );
                $escapedQuery = array();
@@ -805,6 +808,7 @@
                if ( $inQuote ) {
                        $string = $string . '"';
                }
+               wfProfileOut( __METHOD__ );
                return $string;
        }
 
@@ -813,6 +817,7 @@
         * If it isn't then the syntax escaped so it becomes part of the query 
text.
         */
        public static function fixupWholeQueryString( $string ) {
+               wfProfileIn( __METHOD__ );
                // Turn bad fuzzy searches into searches that contain a ~
                $string = preg_replace_callback( 
'/(?<leading>[^\s"])~(?<trailing>\S+)/', function ( $matches ) {
                        if ( preg_match( '/0|(?:0?\.[0-9]+)|(?:1(?:\.0)?)/', 
$matches[ 'trailing' ] ) ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/104031
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie2318bad6a70594a6490cdba1a3798ed9868126e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Manybubbles <never...@wikimedia.org>
Gerrit-Reviewer: Chad <ch...@wikimedia.org>
Gerrit-Reviewer: Ori.livneh <o...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to