[epiphany/mcatanzaro/bookmark-search] suggestion-model: fix searching for bookmarks in top bar



commit d197636872c487c0faacbd035b8be32a7c897d3d
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Wed May 1 12:37:52 2019 -0500

    suggestion-model: fix searching for bookmarks in top bar
    
    Our test to decide whether or not to show a bookmark is not working very
    well. Searching for substrings of the bookmark's title doesn't work, for
    instance. Let's show the bookmark in the search results if the search is
    a substring of the bookmark's title or URL, nice and simple.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1705029

 src/ephy-suggestion-model.c | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)
---
diff --git a/src/ephy-suggestion-model.c b/src/ephy-suggestion-model.c
index 0426add80..0f8661936 100644
--- a/src/ephy-suggestion-model.c
+++ b/src/ephy-suggestion-model.c
@@ -206,23 +206,7 @@ should_add_bookmark_to_model (EphySuggestionModel *self,
                               const char          *title,
                               const char          *location)
 {
-  gboolean ret = TRUE;
-
-  if (self->search_terms) {
-    guint len = g_strv_length (self->search_terms);
-    guint i;
-
-    for (i = 0; i < len; i++) {
-      gchar *str = self->search_terms[i];
-
-      if (!strstr (str, title ? title : "") && !strstr (str, location ? location : "")) {
-        ret = FALSE;
-        break;
-      }
-    }
-  }
-
-  return ret;
+  return strstr (title, search_string) || strstr (location, search_string);
 }
 
 static void


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