[tracker-miners/wip/carlosg/parallel-installable: 28/34] tracker: Drop HAVE_TRACKER_FTS define usage in "tracker search" CLI command



commit 101d88390bc71e4fa52de79b9a67fd757f1aac7c
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Feb 24 01:30:37 2020 +0100

    tracker: Drop HAVE_TRACKER_FTS define usage in "tracker search" CLI command
    
    This is not defined properly for the tracker-miners repo. Instead make it
    generic, and rely on --disable-fts being passed to the command line tool.
    Also drop the stop words check as is a bit of a layering break that is no
    longer possible with miner-related CLI commands living in tracker-miners.

 src/tracker/tracker-search.c | 57 --------------------------------------------
 1 file changed, 57 deletions(-)
---
diff --git a/src/tracker/tracker-search.c b/src/tracker/tracker-search.c
index fbf2b818e..4a5bc76fe 100644
--- a/src/tracker/tracker-search.c
+++ b/src/tracker/tracker-search.c
@@ -196,7 +196,6 @@ static gchar *
 get_fts_string (GStrv    search_words,
                 gboolean use_or_operator)
 {
-#if HAVE_TRACKER_FTS
        GString *fts;
        gint i, len;
 
@@ -232,10 +231,6 @@ get_fts_string (GStrv    search_words,
        }
 
        return g_string_free (fts, FALSE);
-#else
-       /* If FTS support not enabled, always do non-fts searches */
-       return NULL;
-#endif
 }
 
 static inline void
@@ -1520,58 +1515,6 @@ search_run (void)
                disable_snippets = TRUE;
        }
 
-#if HAVE_TRACKER_FTS
-       /* Only check stopwords if FTS is enabled */
-       if (terms) {
-               TrackerLanguage *language;
-               gboolean stop_words_found;
-               gchar **p;
-
-               /* Check terms don't have additional quotes */
-               for (p = terms; *p; p++) {
-                       gchar *term = *p;
-                       gint end = strlen (term) - 1;
-
-                       if ((term[0] == '"' && term[end] == '"') ||
-                           (term[0] == '\'' && term[end] == '\'')) {
-                               /* We never have a quote JUST at the end */
-                               term[0] = term[end] = ' ';
-                               g_strstrip (term);
-                       }
-               }
-
-               /* Check if terms are stopwords, and warn if so */
-               language = tracker_language_new (NULL);
-               stop_words_found = FALSE;
-               for (p = terms; *p; p++) {
-                       gchar *down;
-
-                       down = g_utf8_strdown (*p, -1);
-
-                       if (tracker_language_is_stop_word (language, down)) {
-                               g_printerr (_("Search term ā€œ%sā€ is a stop word."),
-                                           down);
-                               g_printerr ("\n");
-
-                               stop_words_found = TRUE;
-                       }
-
-                       g_free (down);
-               }
-
-               if (stop_words_found) {
-                       g_printerr (_("Stop words are common words which "
-                                     "may be ignored during the indexing "
-                                     "process."));
-                       g_printerr ("\n\n");
-               }
-
-               g_object_unref (language);
-       }
-#else
-       disable_snippets = TRUE;
-#endif
-
        connection = tracker_sparql_connection_bus_new ("org.freedesktop.Tracker3.Miner.Files",
                                                        NULL, NULL, &error);
 


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