Yaron Koren has submitted this change and it was merged.

Change subject: Attempted improvements to Drilldown search highlighting
......................................................................


Attempted improvements to Drilldown search highlighting

Change-Id: I8fcd2bc0b9636b9ff032e8f0a8d292a26d5315fe
---
M CargoQueryDisplayer.php
1 file changed, 7 insertions(+), 1 deletion(-)

Approvals:
  Yaron Koren: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/CargoQueryDisplayer.php b/CargoQueryDisplayer.php
index 4572a10..40f55cb 100644
--- a/CargoQueryDisplayer.php
+++ b/CargoQueryDisplayer.php
@@ -260,7 +260,13 @@
                list( $contextlines, $contextchars ) = 
SearchEngine::userHighlightPrefs();
 
                foreach ( $terms as $i => $term ) {
-                       $terms[$i] = str_replace( array( '"', "'" ), '', $term 
);
+                       // Try to map from a MySQL search to a PHP one -
+                       // this code could probably be improved.
+                       $term = str_replace( array( '"' /*, "'"*/, '+', '*' ), 
'', $term );
+                       if ( strpos( $term, '*' ) !== false ) {
+                               $term = '\b' . $term . '\b';
+                       }
+                       $terms[$i] = $term;
                }
 
                $h = new SearchHighlighter();

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8fcd2bc0b9636b9ff032e8f0a8d292a26d5315fe
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Cargo
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <yaro...@gmail.com>
Gerrit-Reviewer: Yaron Koren <yaro...@gmail.com>
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