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

List:       kde-commits
Subject:    [kdepimlibs/KDE/4.10] akonadi/contact: Use a faster contains expression for "start of word" matches.
From:       Till Adam <adam () kde ! org>
Date:       2013-01-22 18:12:30
Message-ID: 20130122181230.6F963A6091 () git ! kde ! org
[Download RAW message or body]

Git commit c37f8d7023c3e486762af0379e36708d7eb99cea by Till Adam.
Committed on 22/01/2013 at 18:31.
Pushed by tilladam into branch 'KDE/4.10'.

Use a faster contains expression for "start of word" matches.

For the special case of address completion, we are really only
interested in matching at the start of various parts of the name, first
name, email, etc. So for that case, use bif:contains('foo*') rather than
the much more expensive regexp match. Speeds up addressee completion
something fierce for a minor loss in functionality, namely arbitrary
substring matching.

M  +5    -2    akonadi/contact/contactsearchjob.cpp

http://commits.kde.org/kdepimlibs/c37f8d7023c3e486762af0379e36708d7eb99cea

diff --git a/akonadi/contact/contactsearchjob.cpp b/akonadi/contact/contactsearchjob.cpp
index 7b71b07..7984d88 100644
--- a/akonadi/contact/contactsearchjob.cpp
+++ b/akonadi/contact/contactsearchjob.cpp
@@ -71,8 +71,11 @@ static QString containsQueryString( bool doWholeWordSearch, bool matchWordBounda
   if ( doWholeWordSearch ) {
     return QString::fromLatin1( "?v bif:contains \"'%1'\" . " );
   } else {
-    return QString::fromLatin1( "FILTER regex(str(?v), \"%1\", \"i\")" )
-        .arg( matchWordBoundary? QLatin1String( "\\\\b%1" ) : QLatin1String( "%1" ) );
+      if ( matchWordBoundary ) {
+          return QString::fromLatin1( "?v bif:contains \"'%1*'\" . " );
+      } else {
+          return QString::fromLatin1( "FILTER regex(str(?v), \"%1\", \"i\")" );
+      }
   }
 }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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