[nautilus] shell-search-provider: Use indexed search on nautilus launch only if disabled



commit 2d9bd2c1e8f8d7a2e632defa06d0e8590c0c3142
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Fri Jul 20 18:46:11 2018 +0200

    shell-search-provider: Use indexed search on nautilus launch only if disabled
    
    In case we're searching something from the overview, we expect the same results
    to be opened in nautilus, whatever the user set on the options regarding how he
    wants to perform the search.
    
    At the same way we don't want to block simple-search to run in this case if the
    user has enabled recursive search, since this action is something that is
    explicitly requested.

 src/nautilus-shell-search-provider.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
---
diff --git a/src/nautilus-shell-search-provider.c b/src/nautilus-shell-search-provider.c
index 7dbcc7c9f..14a8cc322 100644
--- a/src/nautilus-shell-search-provider.c
+++ b/src/nautilus-shell-search-provider.c
@@ -437,7 +437,6 @@ shell_query_new (gchar **terms)
     home = g_file_new_for_path (g_get_home_dir ());
 
     query = nautilus_query_new ();
-    nautilus_query_set_recursive (query, NAUTILUS_QUERY_RECURSIVE_INDEXED_ONLY);
     nautilus_query_set_text (query, terms_joined);
     nautilus_query_set_location (query, home);
 
@@ -463,6 +462,7 @@ execute_search (NautilusShellSearchProvider  *self,
     }
 
     query = shell_query_new (terms);
+    nautilus_query_set_recursive (query, NAUTILUS_QUERY_RECURSIVE_INDEXED_ONLY);
     nautilus_query_set_show_hidden_files (query, FALSE);
 
     pending_search = g_slice_new0 (PendingSearch);
@@ -723,6 +723,20 @@ handle_launch_search (NautilusShellSearchProvider2  *skeleton,
     GApplication *app = g_application_get_default ();
     g_autoptr (NautilusQuery) query = shell_query_new (terms);
 
+    if (location_settings_search_get_recursive () == NAUTILUS_QUERY_RECURSIVE_NEVER)
+    {
+        /*
+         * If no recursive search is enabled, we still want to be able to
+         * show the same results we presented in the overview when nautilus
+         * is explicitly launched to access to more results, and thus we perform
+         * a query showing results coming from index-based search engines.
+         * Otherwise we just respect the user settings.
+         * See: https://gitlab.gnome.org/GNOME/nautilus/merge_requests/249
+         */
+        nautilus_query_set_recursive (query,
+                                      NAUTILUS_QUERY_RECURSIVE_INDEXED_ONLY);
+    }
+
     nautilus_application_search (NAUTILUS_APPLICATION (app), query);
 
     nautilus_shell_search_provider2_complete_launch_search (skeleton, invocation);


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