After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 763392 - Recent places search sensitive to accents and diacritics
Recent places search sensitive to accents and diacritics
Status: RESOLVED FIXED
Product: gnome-maps
Classification: Applications
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: gnome-maps-maint
gnome-maps-maint
Depends on:
Blocks:
 
 
Reported: 2016-03-09 18:57 UTC by Marius Stanciu
Modified: 2016-03-13 18:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[placeEntry] Making the auto-complete place match insensitive to accents (2.71 KB, patch)
2016-03-10 20:43 UTC, Marius Stanciu
none Details | Review
placeEntry: Make auto-complete accent insensitive (3.56 KB, patch)
2016-03-12 15:39 UTC, Marius Stanciu
none Details | Review
placeEntry: Make auto-complete accent insensitive (3.56 KB, patch)
2016-03-12 15:46 UTC, Marius Stanciu
none Details | Review
placeEntry: Make auto-complete accent insensitive (2.95 KB, patch)
2016-03-12 15:52 UTC, Marius Stanciu
committed Details | Review

Description Marius Stanciu 2016-03-09 18:57:07 UTC
Looking up places that normally contain accents and other diacritics without actually using any (eg. Searching for "Evry" instead of "Évry") does not match anything in the place store.

Might not seem like a big deal but Maps' geocode service is insensitive to such special characters so I think it would be more intuitive to make the place store auto-complete behave the same way.

This gif ilustrates a confusing scenario: 
https://media.giphy.com/media/3o7abkA5SCczLScEDe/giphy.gif

Assuming the first(geocode) search found valid results, I would assume the next time I search the same thing, it would be in the history.
Comment 1 Jonas Danielsson 2016-03-10 08:46:25 UTC
Thanks for filing this! I agree we should try to fix it!


Right now the matching takes place here:
https://git.gnome.org/browse/gnome-maps/tree/src/place.js#n246

After normalizing for UTF-8 the match/search is done by:

return name.toLowerCase().search(searchString.toLowerCase()) !== -1;
So we need to make this accent insensitive in some way.
Comment 2 Marius Stanciu 2016-03-10 14:58:43 UTC
i'll have a look :D
Comment 3 Marius Stanciu 2016-03-10 20:43:53 UTC
Created attachment 323665 [details] [review]
[placeEntry] Making the auto-complete place match insensitive to accents
Comment 4 Marius Stanciu 2016-03-10 20:48:18 UTC
Not really sure about the placement of the ACCENTS_REGEX. Is there a better, common, place to put such a constant in order to avoid redeclaring it?
Comment 5 Jonas Danielsson 2016-03-11 18:21:47 UTC
Review of attachment 323665 [details] [review]:

Thanks,

(For the shortlog, we are using the style of "placeEntry: ...", and imperative: "placeEntry: Make auto-complete...")
And maybe add "accent insensitive"?

Maybe move the normalize function to the utils module? Then the regex can move there? Utils.normalizeString? Or so, that fold the accent?
Comment 6 Jonas Danielsson 2016-03-11 18:22:08 UTC
Review of attachment 323665 [details] [review]:

Forgot to mark
Comment 7 Marius Stanciu 2016-03-12 15:39:26 UTC
Created attachment 323760 [details] [review]
placeEntry: Make auto-complete accent insensitive
Comment 8 Marius Stanciu 2016-03-12 15:46:03 UTC
Created attachment 323761 [details] [review]
placeEntry: Make auto-complete accent insensitive
Comment 9 Marius Stanciu 2016-03-12 15:52:45 UTC
Created attachment 323762 [details] [review]
placeEntry: Make auto-complete accent insensitive
Comment 10 Marius Stanciu 2016-03-12 15:54:18 UTC
(In reply to Marius Stanciu from comment #9)
> Created attachment 323762 [details] [review] [review]
> placeEntry: Make auto-complete accent insensitive

sorry about the messed-up patches, had some trouble with git-bz :D
Comment 11 Jonas Danielsson 2016-03-13 18:11:30 UTC
Review of attachment 323762 [details] [review]:

Thanks!

Will fix this up while pushing!

::: src/utils.js
@@ +387,3 @@
+function normalizeString(string) {
+    return GLib.utf8_normalize(string, -1, GLib.NormalizeMode.ALL)
+               .replace(ACCENTS_REGEX, '');

We do not break strings like this in Maps at the moment, and I think that we should not start.
Comment 12 Jonas Danielsson 2016-03-13 18:11:47 UTC
Attachment 323762 [details] pushed as 213825b - placeEntry: Make auto-complete accent insensitive