Smalyshev has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/387959 )

Change subject: Normalize search term before matching against result
......................................................................

Normalize search term before matching against result

Users can search for non-normalized unicode strings, and the index
can contain normalized ones. The search would match on the backend
but frontend will fail to display it.

Note that this patch relies on ES6 function to normalize. It would not
break on ES5 but the fix won't work either. If we want ES5, we should
use a polyfill like https://github.com/walling/unorm .

Bug: T170779
Change-Id: I9d1c5b15d9555693a5d12d9a93461782d0492186
---
M lib/jquery.ui/jquery.ui.suggester.js
1 file changed, 8 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/data-values/value-view 
refs/changes/59/387959/1

diff --git a/lib/jquery.ui/jquery.ui.suggester.js 
b/lib/jquery.ui/jquery.ui.suggester.js
index 4be305b..ac9a4b5 100644
--- a/lib/jquery.ui/jquery.ui.suggester.js
+++ b/lib/jquery.ui/jquery.ui.suggester.js
@@ -539,7 +539,14 @@
 
                        if ( typeof requestTerm === 'string' && requestTerm !== 
self._term ) {
                                // Skip request since it does not correspond to 
the current search term.
-                               return;
+                               if ( typeof String.prototype.normalize === 
'function' ) {
+                                       // If we can normalize, check 
normalized strings too
+                                       if ( requestTerm.normalize() !== 
self._term.normalize() ) {
+                                               return;
+                                       }
+                               } else {
+                                       return;
+                               }
                        }
                        if ( self.options.menu ) {
                                // Suggester (including the menu) might have 
been destroyed in the meantime.

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9d1c5b15d9555693a5d12d9a93461782d0492186
Gerrit-PatchSet: 1
Gerrit-Project: data-values/value-view
Gerrit-Branch: master
Gerrit-Owner: Smalyshev <smalys...@wikimedia.org>

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

Reply via email to