[recipes] Improve recipe search capabilities



commit 73d0bc7191bee7f7e11fe2697899aa70d5582d03
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Dec 31 11:34:51 2016 -0500

    Improve recipe search capabilities
    
    Make searching by author exact, and add a way to search
    by season. This will be used in future commits when we
    convert the list page to populate asynchronously.

 src/gr-recipe.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/gr-recipe.c b/src/gr-recipe.c
index 7346356..c8b3cad 100644
--- a/src/gr-recipe.c
+++ b/src/gr-recipe.c
@@ -636,7 +636,7 @@ gr_recipe_is_readonly (GrRecipe *recipe)
         return recipe->readonly;
 }
 
-/* term is assumed to be g_utf8_casefold'ed */
+/* term is assumed to be g_utf8_casefold'ed where appropriate */
 gboolean
 gr_recipe_matches (GrRecipe   *recipe,
                    const char *term)
@@ -660,7 +660,13 @@ gr_recipe_matches (GrRecipe   *recipe,
                         continue;
                 }
                 else if (g_str_has_prefix (terms[i], "by:")) {
-                        if (!recipe->author || strstr (recipe->author, terms[i] + 3) == NULL) {
+                        if (!recipe->author || strcmp (recipe->author, terms[i] + 3) != 0) {
+                                return FALSE;
+                        }
+                        continue;
+                }
+                else if (g_str_has_prefix (terms[i], "se:")) {
+                        if (!recipe->season || strcmp (recipe->season , terms[i] + 3) != 0) {
                                 return FALSE;
                         }
                         continue;


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