GNOME Bugzilla – Bug 763392
Recent places search sensitive to accents and diacritics
Last modified: 2016-03-13 18:11:51 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.
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.
i'll have a look :D
Created attachment 323665 [details] [review] [placeEntry] Making the auto-complete place match insensitive to accents
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?
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?
Review of attachment 323665 [details] [review]: Forgot to mark
Created attachment 323760 [details] [review] placeEntry: Make auto-complete accent insensitive
Created attachment 323761 [details] [review] placeEntry: Make auto-complete accent insensitive
Created attachment 323762 [details] [review] placeEntry: Make auto-complete accent insensitive
(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
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.
Attachment 323762 [details] pushed as 213825b - placeEntry: Make auto-complete accent insensitive