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 668499 - Suggestions don't match full name with alias
Suggestions don't match full name with alias
Status: RESOLVED FIXED
Product: folks
Classification: Platform
Component: general
git master
Other Linux
: Normal normal
: Unset
Assigned To: folks-maint
folks-maint
Depends on:
Blocks:
 
 
Reported: 2012-01-23 13:33 UTC by Alexander Larsson
Modified: 2012-01-23 22:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Possible fix (2.34 KB, patch)
2012-01-23 14:24 UTC, Alexander Larsson
accepted-commit_now Details | Review

Description Alexander Larsson 2012-01-23 13:33:06 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.
Comment 1 Alexander Larsson 2012-01-23 14:24:39 UTC
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.
Comment 2 Philip Withnall 2012-01-23 14:46:29 UTC
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.
Comment 3 Alexander Larsson 2012-01-23 15:35:52 UTC
pushed on master... Would be nice to have this in whatever release ends up in Gnome 3.4 though.
Comment 4 Philip Withnall 2012-01-23 16:47:30 UTC
Thanks for the patch.
Comment 5 Travis Reitter 2012-01-23 22:18:17 UTC
(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).