[tracker] libtracker-sparql: Print resources referenced in cardinality>1 properties
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-sparql: Print resources referenced in cardinality>1 properties
- Date: Wed, 18 Jan 2017 11:10:54 +0000 (UTC)
commit e48de2e80c51ac53b0abea4587c887a8b484af78
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Jan 5 19:25:03 2017 +0100
libtracker-sparql: Print resources referenced in cardinality>1 properties
Those were not being printed, just referenced in the parent resource.
Fixes properties like slo:location being lost on newly indexed photos.
https://bugzilla.gnome.org/show_bug.cgi?id=776723
src/libtracker-sparql/tracker-resource.c | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-sparql/tracker-resource.c b/src/libtracker-sparql/tracker-resource.c
index f18d001..ebafc13 100644
--- a/src/libtracker-sparql/tracker-resource.c
+++ b/src/libtracker-sparql/tracker-resource.c
@@ -1293,6 +1293,32 @@ generate_sparql_relation_inserts_foreach (gpointer key,
generate_sparql_insert_pattern (relation, data);
data->done_list = g_list_prepend (data->done_list, relation);
}
+ } else if (G_VALUE_HOLDS (value, G_TYPE_PTR_ARRAY)) {
+ GPtrArray *array = g_value_get_boxed (value);
+ const GValue *array_value;
+ TrackerResource *relation;
+ gint i;
+
+ for (i = 0; i < array->len; i++) {
+ array_value = g_ptr_array_index (array, i);
+
+ if (!G_VALUE_HOLDS (array_value, TRACKER_TYPE_RESOURCE))
+ continue;
+
+ relation = g_value_get_object (array_value);
+
+ /* We don't need to produce inserts for builtin classes */
+ if (is_builtin_class (tracker_resource_get_identifier (relation),
+ data->namespaces))
+ continue;
+
+ if (g_list_find_custom (data->done_list, relation,
+ (GCompareFunc) tracker_resource_compare) != NULL)
+ continue;
+
+ generate_sparql_insert_pattern (relation, data);
+ data->done_list = g_list_prepend (data->done_list, relation);
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]