From kde-commits Wed Jan 23 21:43:49 2013 From: Till Adam Date: Wed, 23 Jan 2013 21:43:49 +0000 To: kde-commits Subject: [kdepim/KDE/4.10] libkdepim: Speed up the pure-nepomuk address completion. Message-Id: <20130123214349.D7CBCA6091 () git ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=135897744124296 Git commit 7abd8111b9e38ad7520f7188c954e6b2ae0cded1 by Till Adam. Committed on 23/01/2013 at 22:33. Pushed by tilladam into branch 'KDE/4.10'. 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/7abd8111b9e38ad7520f7188c954e6b2ae0cded1 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 =3D - //"select distinct ?email where { ?r a nco:Contact . ?r nco:hasEmailAd= dress ?v . ?v nco:emailAddress ?email . FILTER regex(str(?email), \"\\\\b%1= \", \"i\")}"; - "select distinct ?email ?fullname where { ?r a nco:Contact . ?r nco:ha= sEmailAddress ?v . ?v nco:emailAddress ?email . " - "{ FILTER regex( str(?email), \"\\\\b%1\", \"i\") . ?r nco:fullname ?f= ullname } " - "union " - "{ ?r nco:fullname ?fullname . FILTER regex( str(?fullname), \"\\\\b%1= \", \"i\") } " - "union " - "{ ?r nco:fullname ?fullname . ?r nco:nameFamily ?family . FILTER rege= x( 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() {