[folks/wip/nielsdg/simple-query-fixes: 2/2] simple-query: Also give a match if the suffix works



commit 661c77d52e94839fa30790e657da17c9b8753220
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Sun Dec 8 10:53:42 2019 +0100

    simple-query: Also give a match if the suffix works
    
    Fixes https://gitlab.gnome.org/GNOME/gnome-contacts/issues/146

 folks/simple-query.vala | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/folks/simple-query.vala b/folks/simple-query.vala
index f168f97e..f311c689 100644
--- a/folks/simple-query.vala
+++ b/folks/simple-query.vala
@@ -499,7 +499,9 @@ public class Folks.SimpleQuery : Folks.Query
         {
           if (str_token == token)
               return 3;
-          else if (str_token.has_prefix (token))
+          if (str_token.has_prefix (token))
+              return 2;
+          if (str_token.has_suffix (token))
               return 2;
         }
 
@@ -507,7 +509,9 @@ public class Folks.SimpleQuery : Folks.Query
         {
           if (str_token == token)
               return 2;
-          else if (str_token.has_prefix (token))
+          if (str_token.has_prefix (token))
+              return 1;
+          if (str_token.has_suffix (token))
               return 1;
         }
 


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