GNOME Bugzilla – Bug 668499
Suggestions don't match full name with alias
Last modified: 2012-01-23 22:18:17 UTC
If i have an eds contact named "Alexander Larsson" and e.g. a Facebook persona called "Alexander Larsson" the two will never be suggested for linkage, since one uses full_name, and the other alias. The obvious fix: diff --git a/folks/potential-match.vala b/folks/potential-match.vala index 0f2c6dd..e2626bc 100644 --- a/folks/potential-match.vala +++ b/folks/potential-match.vala @@ -175,7 +175,13 @@ public class Folks.PotentialMatch : Object } if (this._look_alike (this._individual_a.full_name, - this._individual_b.full_name)) + this._individual_b.full_name) || + this._look_alike (this._individual_a.alias, + this._individual_b.full_name) || + this._look_alike (this._individual_a.full_name, + this._individual_b.alias) || + this._look_alike (this._individual_a.alias, + this._individual_b.alias)) { similarity += 0.70; } Makes this slightly better, but still not good enough for e.g. contacts. If we just match this we bump the prio by two, reaching MEDIUM. To avoid false positives i have to require HIGH prio in contacts. Maybe we should bump the prio by three for an exact match.
Created attachment 205884 [details] [review] Possible fix This seems to help a lot. First of all it avoids matching e.g. an empty full_name with an empty alias, (or even an empty full name with an empty full name!). Additionally it bumps the prio by 3 if we have an exact name match. This is required to ever give a HIGH match for e.g. a facebook account, where the alias is the only data we have to match on.
Review of attachment 205884 [details] [review]: Seems reasonable to me. Please commit to master with the whitespace/commenting fixes below. Cheers! ::: folks/potential-match.vala @@ +168,3 @@ { double similarity = 0.0; + bool exact_match = false; Whitespace problem. @@ +187,3 @@ + this._look_alike_or_identical (this._individual_a.alias, + this._individual_b.alias, + out exact_match)) Whitespace problems (function parameters should be indented four spaces further than the function name when wrapping lines). @@ +228,3 @@ debug ("[name_similarity] Got %f\n", similarity); + if (similarity >= this._DIST_THRESHOLD) { Opening braces should be on a new line, indented further by two spaces. @@ +231,3 @@ + int inc = 2; + if (exact_match) + inc += 1; Might be good to put a comment in with a brief rationale for this. @@ +233,3 @@ + inc += 1; + this._result = this._inc_match_level (this._result, inc); + } Whitespace problem. @@ +410,3 @@ + private bool _look_alike_or_identical (string? a, string? b, out bool exact) + { + exact = false; Whitespace problem. @@ +419,3 @@ + exact = true; + return true; + } Brackets, whitespace.
pushed on master... Would be nice to have this in whatever release ends up in Gnome 3.4 though.
Thanks for the patch.
(In reply to comment #3) > pushed on master... Would be nice to have this in whatever release ends up in > Gnome 3.4 though. Yes, I'm planning to do a release as soon as bug #668415 is fixed (see its comments for some details on what's currently blocking it).