[gnome-books/wip/carlosg/tracker3] query: Make nfo:fileName extraction more reliable



commit 83acb08b46ee03558d3a8f9c0bf27bbb7117e2ac
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Feb 16 18:42:48 2021 +0100

    query: Make nfo:fileName extraction more reliable
    
    Nesting properties with multiple cardinality don't result in the
    desired effect here. Get the nfo:FileDataObject inside the WHERE
    block, and use it in the select clause for this.

 src/query.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/src/query.js b/src/query.js
index 3600f1c4..f753d3ae 100644
--- a/src/query.js
+++ b/src/query.js
@@ -79,6 +79,7 @@ var QueryBuilder = new Lang.Class({
 
     _buildOptional: function() {
         let sparql =
+            'OPTIONAL { ?urn nie:isStoredAs ?file . } ';
             'OPTIONAL { ?urn nco:creator ?creator . } ' +
             'OPTIONAL { ?urn nco:publisher ?publisher . } ';
 
@@ -145,7 +146,7 @@ var QueryBuilder = new Lang.Class({
     _buildQueryInternal: function(global, flags, offsetController, sortBy) {
        let selectClauses =
             '    (nie:isStoredAs(?urn) AS ?uri) ' +
-            '    (COALESCE (nfo:fileName(nie:isStoredAs(?urn)), 
tracker:string-from-filename(nie:isStoredAs(?urn))) AS ?filename) ' +
+            '    (COALESCE (nfo:fileName(?file), tracker:string-from-filename(nie:isStoredAs(?urn))) AS 
?filename) ' +
             '    (nie:mimeType(?urn) AS ?mimetype) ' +
             '    (nie:title(?urn) AS ?title) ' +
             '    (tracker:coalesce(nco:fullname(?creator), nco:fullname(?publisher), \'\') AS ?author) ' +


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]