summaryrefslogtreecommitdiff
path: root/libnautilus-private
diff options
context:
space:
mode:
Diffstat (limited to 'libnautilus-private')
-rw-r--r--libnautilus-private/nautilus-debug.c1
-rw-r--r--libnautilus-private/nautilus-debug.h1
-rw-r--r--libnautilus-private/nautilus-search-engine-simple.c9
-rw-r--r--libnautilus-private/nautilus-search-engine.c12
-rw-r--r--libnautilus-private/nautilus-search-hit.c4
5 files changed, 27 insertions, 0 deletions
diff --git a/libnautilus-private/nautilus-debug.c b/libnautilus-private/nautilus-debug.c
index 9297b8950..dd6b552cf 100644
--- a/libnautilus-private/nautilus-debug.c
+++ b/libnautilus-private/nautilus-debug.c
@@ -49,6 +49,7 @@ static GDebugKey keys[] = {
{ "Places", NAUTILUS_DEBUG_PLACES },
{ "Previewer", NAUTILUS_DEBUG_PREVIEWER },
{ "Search", NAUTILUS_DEBUG_SEARCH },
+ { "SearchHit", NAUTILUS_DEBUG_SEARCH_HIT },
{ "Smclient", NAUTILUS_DEBUG_SMCLIENT },
{ "Window", NAUTILUS_DEBUG_WINDOW },
{ "Undo", NAUTILUS_DEBUG_UNDO },
diff --git a/libnautilus-private/nautilus-debug.h b/libnautilus-private/nautilus-debug.h
index f1c8b2881..59c5eaac7 100644
--- a/libnautilus-private/nautilus-debug.h
+++ b/libnautilus-private/nautilus-debug.h
@@ -48,6 +48,7 @@ typedef enum {
NAUTILUS_DEBUG_WINDOW = 1 << 13,
NAUTILUS_DEBUG_UNDO = 1 << 14,
NAUTILUS_DEBUG_SEARCH = 1 << 15,
+ NAUTILUS_DEBUG_SEARCH_HIT = 1 << 16,
} DebugFlags;
void nautilus_debug_set_flags (DebugFlags flags);
diff --git a/libnautilus-private/nautilus-search-engine-simple.c b/libnautilus-private/nautilus-search-engine-simple.c
index dc6ed8ad0..1bed07b82 100644
--- a/libnautilus-private/nautilus-search-engine-simple.c
+++ b/libnautilus-private/nautilus-search-engine-simple.c
@@ -26,6 +26,8 @@
#include "nautilus-search-provider.h"
#include "nautilus-search-engine-simple.h"
#include "nautilus-ui-utilities.h"
+#define DEBUG_FLAG NAUTILUS_DEBUG_SEARCH
+#include "nautilus-debug.h"
#include <string.h>
#include <glib.h>
@@ -136,6 +138,8 @@ search_thread_done_idle (gpointer user_data)
SearchThreadData *data = user_data;
NautilusSearchEngineSimple *engine = data->engine;
+ DEBUG ("Simple engine done");
+
engine->details->active_search = NULL;
nautilus_search_provider_finished (NAUTILUS_SEARCH_PROVIDER (engine));
@@ -155,6 +159,8 @@ search_thread_add_hits_idle (gpointer user_data)
{
SearchHitsData *data = user_data;
+ DEBUG ("Simple engine add hits");
+
if (!g_cancellable_is_cancelled (data->thread_data->cancellable)) {
nautilus_search_provider_hits_added (NAUTILUS_SEARCH_PROVIDER (data->thread_data->engine),
data->hits);
@@ -340,6 +346,8 @@ nautilus_search_engine_simple_start (NautilusSearchProvider *provider)
if (simple->details->active_search != NULL) {
return;
}
+
+ DEBUG ("Simple engine start");
data = search_thread_data_new (simple, simple->details->query);
@@ -357,6 +365,7 @@ nautilus_search_engine_simple_stop (NautilusSearchProvider *provider)
simple = NAUTILUS_SEARCH_ENGINE_SIMPLE (provider);
if (simple->details->active_search != NULL) {
+ DEBUG ("Simple engine stop");
g_cancellable_cancel (simple->details->active_search->cancellable);
simple->details->active_search = NULL;
}
diff --git a/libnautilus-private/nautilus-search-engine.c b/libnautilus-private/nautilus-search-engine.c
index 91e6616cd..461a80e18 100644
--- a/libnautilus-private/nautilus-search-engine.c
+++ b/libnautilus-private/nautilus-search-engine.c
@@ -81,6 +81,8 @@ search_engine_start_real (NautilusSearchEngine *engine)
engine->details->restart = FALSE;
+ DEBUG ("Search engine start real");
+
#ifdef ENABLE_TRACKER
nautilus_search_provider_start (NAUTILUS_SEARCH_PROVIDER (engine->details->tracker));
engine->details->providers_running++;
@@ -100,6 +102,8 @@ nautilus_search_engine_start (NautilusSearchProvider *provider)
NautilusSearchEngine *engine = NAUTILUS_SEARCH_ENGINE (provider);
gint num_finished;
+ DEBUG ("Search engine start");
+
num_finished = engine->details->providers_error + engine->details->providers_finished;
if (engine->details->running) {
@@ -124,6 +128,9 @@ static void
nautilus_search_engine_stop (NautilusSearchProvider *provider)
{
NautilusSearchEngine *engine = NAUTILUS_SEARCH_ENGINE (provider);
+
+ DEBUG ("Search engine stop");
+
#ifdef ENABLE_TRACKER
nautilus_search_provider_stop (NAUTILUS_SEARCH_PROVIDER (engine->details->tracker));
#endif
@@ -143,6 +150,8 @@ search_provider_hits_added (NautilusSearchProvider *provider,
GList *l;
if (!engine->details->running || engine->details->restart) {
+ DEBUG ("Ignoring hits-added, since engine is %s",
+ !engine->details->running ? "not running" : "waiting to restart");
return;
}
@@ -205,9 +214,11 @@ check_providers_status (NautilusSearchEngine *engine)
g_object_ref (engine);
if (num_finished == engine->details->providers_error) {
+ DEBUG ("Search engine error");
nautilus_search_provider_error (NAUTILUS_SEARCH_PROVIDER (engine),
_("Unable to complete the requested search"));
} else {
+ DEBUG ("Search engine finished");
nautilus_search_provider_finished (NAUTILUS_SEARCH_PROVIDER (engine));
}
@@ -216,6 +227,7 @@ check_providers_status (NautilusSearchEngine *engine)
g_object_unref (engine);
if (engine->details->restart) {
+ DEBUG ("Restarting engine");
nautilus_search_engine_start (NAUTILUS_SEARCH_PROVIDER (engine));
}
}
diff --git a/libnautilus-private/nautilus-search-hit.c b/libnautilus-private/nautilus-search-hit.c
index c4b31d95b..2ac865355 100644
--- a/libnautilus-private/nautilus-search-hit.c
+++ b/libnautilus-private/nautilus-search-hit.c
@@ -26,6 +26,8 @@
#include "nautilus-search-hit.h"
#include "nautilus-query.h"
+#define DEBUG_FLAG NAUTILUS_DEBUG_SEARCH_HIT
+#include "nautilus-debug.h"
struct NautilusSearchHitDetails
{
@@ -117,6 +119,8 @@ nautilus_search_hit_compute_scores (NautilusSearchHit *hit,
}
hit->details->relevance = recent_bonus + proximity_bonus + match_bonus;
+ DEBUG ("Hit %s computed relevance %.2f (%.2f + %.2f + %.2f)", hit->details->uri, hit->details->relevance,
+ proximity_bonus, recent_bonus, match_bonus);
g_date_time_unref (now);
}