[gnome-documents] miner: fix inserting of contacts in the tracker store



commit 6cdae0174c645f9d6b40700082a03b86f1f3d786
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Tue Aug 2 19:49:26 2011 +0200

    miner: fix inserting of contacts in the tracker store
    
    Ensure the right contact resource is returned when the contact is
    already present in the store, and fix the mail address matching
    function.

 src/miner/gd-gdata-miner.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/miner/gd-gdata-miner.c b/src/miner/gd-gdata-miner.c
index 528ee11..6e4c542 100644
--- a/src/miner/gd-gdata-miner.c
+++ b/src/miner/gd-gdata-miner.c
@@ -124,11 +124,12 @@ _tracker_utils_ensure_contact_resource (TrackerSparqlConnection *connection,
   GVariantIter *iter;
   gchar *key = NULL, *val = NULL;
 
+  mail_uri = g_strconcat ("mailto:";, email, NULL);
   select = g_string_new (NULL);
   g_string_append_printf (select, 
-                          "SELECT ?urn WHERE { ?urn a nco:EmailAddress . "
-                          "?urn nco:emailAddress ?mail . "
-                          "FILTER ( ?mail = \"%s\" ) }", email);
+                          "SELECT ?urn WHERE { ?urn a nco:Contact . "
+                          "?urn nco:hasEmailAddress ?mail . "
+                          "FILTER (fn:contains(?mail, \"%s\" )) }", mail_uri);
 
   cursor = tracker_sparql_connection_query (connection,
                                             select->str,
@@ -154,7 +155,6 @@ _tracker_utils_ensure_contact_resource (TrackerSparqlConnection *connection,
 
   /* not found, create the resource */
   insert = g_string_new (NULL);
-  mail_uri = g_strconcat ("mailto:";, email, NULL);
 
   g_string_append_printf (insert, 
                           "INSERT { <%s> a nco:EmailAddress ; nco:emailAddress \"%s\" . "



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]