summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2017-01-05 19:25:03 +0100
committerCarlos Garnacho <carlosg@gnome.org>2017-01-16 17:19:00 +0100
commite48de2e80c51ac53b0abea4587c887a8b484af78 (patch)
tree503ea085e6792ba0b4e0e95394ceaf57ada6b482
parent7ef71db27bfd410ac514d1fa5ffe9253d13fe36b (diff)
downloadtracker-e48de2e80c51ac53b0abea4587c887a8b484af78.tar.gz
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
-rw-r--r--src/libtracker-sparql/tracker-resource.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/libtracker-sparql/tracker-resource.c b/src/libtracker-sparql/tracker-resource.c
index f18d0014e..ebafc1328 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);
+ }
}
}