[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdepim] libkdepim: Speed up the pure-nepomuk address completion.
From:       Till Adam <adam () kde ! org>
Date:       2013-01-23 21:38:22
Message-ID: 20130123213822.B9218A6091 () git ! kde ! org
[Download RAW message or body]

Git commit fb7298afc77257ac1180df469b56be6a433b40fa by Till Adam.
Committed on 23/01/2013 at 22:33.
Pushed by tilladam into branch 'master'.

Speed up the pure-nepomuk address completion.

This avoids unions and regexps, like we do in the akonadi contact search
job now, thus speeding up the (large) queries considerably.

Reviewed and sparql-foo'd by vHanda and cmollekopf. Thanks, guys.

M  +14   -10   libkdepim/addresseelineedit.cpp

http://commits.kde.org/kdepim/fb7298afc77257ac1180df469b56be6a433b40fa

diff --git a/libkdepim/addresseelineedit.cpp b/libkdepim/addresseelineedit.cpp
index 36aa01f..80bab84 100644
--- a/libkdepim/addresseelineedit.cpp
+++ b/libkdepim/addresseelineedit.cpp
@@ -349,16 +349,20 @@ void AddresseeLineEdit::Private::stopLDAPLookup()
 
 
 static const char* sparqlquery =
-    //"select distinct ?email where { ?r a nco:Contact . ?r nco:hasEmailAddress ?v . \
                ?v nco:emailAddress ?email . FILTER regex(str(?email), \"\\\\b%1\", \
                \"i\")}";
-    "select distinct ?email ?fullname where { ?r a nco:Contact . ?r \
                nco:hasEmailAddress ?v .  ?v nco:emailAddress ?email . "
-    "{ FILTER regex( str(?email), \"\\\\b%1\", \"i\") . ?r nco:fullname ?fullname } \
                "
-    "union "
-    "{ ?r nco:fullname ?fullname . FILTER regex( str(?fullname), \"\\\\b%1\", \"i\") \
                } "
-    "union "
-    "{ ?r nco:fullname ?fullname . ?r nco:nameFamily ?family . FILTER regex( \
                str(?family), \"\\\\b%1\", \"i\") } "
-    "union "
-    "{ ?r nco:fullname ?fullname . ?r nco:nameGiven ?given . FILTER regex( \
                str(?given), \"\\\\b%1\", \"i\") } "
-    "} ";
+    "select distinct ?email ?fullname where {"
+    "{"
+        "?r nco:hasEmailAddress   ?em ."
+        "?em nco:emailAddress ?email ."
+        "?r ?p ?fullname ."
+        "FILTER( ?p in (nco:fullname, nco:nameFamily, nco:nameGiven)  )."
+        "FILTER( bif:contains(?fullname, \"'%1*'\")  )."
+    "} UNION {"
+        "?r nco:hasEmailAddress   ?em ."
+        "?em nco:emailAddress ?email ."
+        "FILTER( bif:contains(?email, \"'%1*'\")  )."
+        "?r nco:fullname ?fullname ."
+    "}"
+    "}";
 
 void AddresseeLineEdit::Private::startNepomukSearch()
 {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic