[gnome-photos/wip/uajain/de_dup: 2/2] WIP - Attempt to stop duplication but quite buggy. Mode detection isn't normal.
- From: Umang Jain <uajain src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/uajain/de_dup: 2/2] WIP - Attempt to stop duplication but quite buggy. Mode detection isn't normal.
- Date: Mon, 8 Aug 2016 20:59:04 +0000 (UTC)
commit 586ec60672dabff84f4eb0886be3aa686d282f7c
Author: Umang Jain <mailumangjain gmail com>
Date: Mon Aug 8 20:44:28 2016 +0530
WIP - Attempt to stop duplication but quite buggy. Mode detection isn't normal.
src/photos-query-builder.c | 32 +++++++++++++++++++++++++++-----
src/photos-search-type-manager.c | 3 +++
2 files changed, 30 insertions(+), 5 deletions(-)
---
diff --git a/src/photos-query-builder.c b/src/photos-query-builder.c
index 80f82e2..4843bb7 100644
--- a/src/photos-query-builder.c
+++ b/src/photos-query-builder.c
@@ -34,6 +34,7 @@
#include "photos-search-match-manager.h"
#include "photos-search-type-manager.h"
#include "photos-utils.h"
+#include "photos-item-manager.h"
static const gchar *TRACKER_SCHEMA = "org.freedesktop.Tracker.Miner.Files";
@@ -47,19 +48,40 @@ photos_query_builder_filter (PhotosSearchContextState *state, gint flags)
gchar *src_mngr_filter;
gchar *srch_mtch_mngr_filter;
gchar *srch_typ_mngr_filter;
+ gchar *dup_filter;
+ PhotosWindowMode mode;
src_mngr_filter = photos_base_manager_get_filter (state->src_mngr, flags);
srch_mtch_mngr_filter = photos_base_manager_get_filter (state->srch_mtch_mngr, flags);
srch_typ_mngr_filter = photos_base_manager_get_filter (state->srch_typ_mngr, flags);
- sparql = g_strdup_printf ("FILTER (%s && %s && %s)",
- src_mngr_filter,
- srch_mtch_mngr_filter,
- srch_typ_mngr_filter);
+ dup_filter = g_strdup ("! BOUND (nie:relatedTo(?urn))");
+ mode = photos_mode_controller_get_window_mode (PHOTOS_MODE_CONTROLLER (state->mode_cntrlr));
+ printf("the window mode here is : %d\n", mode);
+ if ((mode == PHOTOS_WINDOW_MODE_COLLECTIONS) || (mode == PHOTOS_WINDOW_MODE_SEARCH))
+ {
+ sparql = g_strdup_printf ("FILTER (%s && %s && %s)",
+ src_mngr_filter,
+ srch_mtch_mngr_filter,
+ srch_typ_mngr_filter);
+ }
+ else
+ {
+ mode = photos_mode_controller_get_window_mode (PHOTOS_MODE_CONTROLLER (state->mode_cntrlr));
+ printf("the newer mode here is : %d\n", mode);
+
+ sparql = g_strdup_printf ("FILTER (%s && %s && %s && %s)",
+ src_mngr_filter,
+ srch_mtch_mngr_filter,
+ srch_typ_mngr_filter,
+ dup_filter);
+ }
+
g_free (srch_typ_mngr_filter);
g_free (srch_mtch_mngr_filter);
g_free (src_mngr_filter);
+ g_free (dup_filter);
return sparql;
}
@@ -125,7 +147,7 @@ photos_query_builder_where (PhotosSearchContextState *state, gboolean global, gi
where_sparql,
optional,
(filter != NULL) ? filter : "");
-
+ printf("sparql_of_outer_where: %s\n\n\n", sparql);
g_free (filter);
g_free (optional);
g_free (where_sparql);
diff --git a/src/photos-search-type-manager.c b/src/photos-search-type-manager.c
index 73cd8d8..53a3270 100644
--- a/src/photos-search-type-manager.c
+++ b/src/photos-search-type-manager.c
@@ -98,6 +98,9 @@ photos_search_type_manager_init (PhotosSearchTypeManager *self)
gchar *all_filter;
gchar *col_filter;
gchar *gif_filter;
+ gchar *dup_filter;
+
+ dup_filter = g_strdup ("! BOUND (nie:relatedTo(?urn))");
gif_filter = g_strdup ("nie:mimeType(?urn) != 'image/gif'");
item_filter = g_strdup_printf ("(fn:contains (?type, 'nmm#Photo') && %s)", gif_filter);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]