[tracker-miners: 2/3] Add indexing roots to content specific graphs for availability info
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners: 2/3] Add indexing roots to content specific graphs for availability info
- Date: Sun, 19 Dec 2021 19:30:05 +0000 (UTC)
commit 179bbb80cabec37489812eb6152b8227f6000a69
Author: Pekka Vuorela <pekka vuorela jolla com>
Date: Tue Dec 14 13:38:11 2021 +0200
Add indexing roots to content specific graphs for availability info
With external storage devices indexed but then unmounted, the graphs
will list content that is known but currently not available.
So far filtering those out was needing access to tracker:FileSystem
to check tracker:available on the data source.
Adding here the indexing roots to also the content specific graphs.
Though to note only on newly indexed ones. The external storage devices
might be rare enough configuration to handle where it's needed.
Related: https://gitlab.gnome.org/GNOME/tracker/-/issues/304
src/miners/fs/tracker-miner-files.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
---
diff --git a/src/miners/fs/tracker-miner-files.c b/src/miners/fs/tracker-miner-files.c
index b090a10eb..629a39127 100644
--- a/src/miners/fs/tracker-miner-files.c
+++ b/src/miners/fs/tracker-miner-files.c
@@ -856,6 +856,17 @@ set_up_mount_point (TrackerMinerFiles *miner,
" OPTIONAL { ?u tracker:unmountDate ?date } "
"}",
uri);
+ /* Update plain tracker:available state on content specific graphs */
+ g_string_append_printf (queries,
+ "DELETE { GRAPH ?g { ?uri tracker:available %s } } "
+ "INSERT { GRAPH ?g { ?uri tracker:available %s } } "
+ "WHERE { GRAPH ?g { ?uri a tracker:IndexedFolder ; "
+ " nie:isStoredAs <%s> . } "
+ " FILTER (?g != tracker:FileSystem) "
+ "}",
+ mounted ? "false" : "true",
+ mounted ? "true" : "false",
+ uri);
g_free (uri);
if (accumulator) {
@@ -2164,6 +2175,20 @@ miner_files_process_file (TrackerMinerFS *fs,
file,
mime_type,
create);
+ /* Add indexing roots also to content specific graphs to provide the availability information
*/
+ if (tracker_indexing_tree_file_is_root (indexing_tree, file)) {
+ const gchar *special_graphs[] = {
+ "tracker:Audio",
+ "tracker:Documents",
+ "tracker:Pictures",
+ "tracker:Software",
+ "tracker:Video"
+ };
+
+ for (gint i = 0; i < G_N_ELEMENTS (special_graphs); i++) {
+ tracker_sparql_buffer_push (buffer, file, special_graphs[i], folder_resource);
+ }
+ }
}
miner_files_add_to_datasource (TRACKER_MINER_FILES (fs), file, resource, folder_resource);
@@ -2185,6 +2210,7 @@ miner_files_process_file (TrackerMinerFS *fs,
tracker_resource_set_int64 (graph_file, "nfo:fileSize",
g_file_info_get_size (file_info));
+ miner_files_add_to_datasource (TRACKER_MINER_FILES (fs), file, graph_file, NULL);
}
if (delete_properties_sparql)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]