[tracker/needle: 34/41] tracker-needle: Fixed music query to include title/artist/albums



commit c6f1a85ba7f0269f07e245f1d56728e86fe132e8
Author: Martyn Russell <martyn lanedo com>
Date:   Wed Sep 8 23:58:48 2010 +0100

    tracker-needle: Fixed music query to include title/artist/albums

 src/tracker-needle/tracker-query.vala |   30 +++++++++++++++++++-----------
 1 files changed, 19 insertions(+), 11 deletions(-)
---
diff --git a/src/tracker-needle/tracker-query.vala b/src/tracker-needle/tracker-query.vala
index 5889a39..00421aa 100644
--- a/src/tracker-needle/tracker-query.vala
+++ b/src/tracker-needle/tracker-query.vala
@@ -92,20 +92,28 @@ public class Tracker.Query {
 		case Type.MUSIC:
 			query = @"
 			        SELECT
-			          ?urn 
-			          nie:url(?urn) 
-			          tracker:coalesce(nie:title(?urn), nfo:fileName(?urn), \"Unknown\") 
-			          fn:string-join((?performer, ?album), \" - \") 
-			          nfo:duration(?urn)
+			          ?song
+			          nie:url(?song)
+			          tracker:coalesce(nie:title(?song), nfo:fileName(?song), \"Unknown\")
+			          fn:string-join((?performer, ?album), \" - \")
+			          nfo:duration(?song)
 			          ?tooltip
 			        WHERE {
-			          ?urn a nfo:Audio ;
-			          nmm:performer [ nmm:artistName ?performer ] ;
-			          nmm:musicAlbum [ nie:title ?album ] ;
-			          nfo:belongsToContainer [ nie:url ?tooltip ] .
-			          ?urn fts:match \"$criteria_escaped\" 
+			          ?match fts:match \"$criteria_escaped\"
+			          {
+			            ?song nmm:musicAlbum ?match
+			          } UNION {
+			            ?song nmm:performer ?match
+			          } UNION {
+			            ?song a nfo:Audio .
+			            ?match a nfo:Audio
+			            FILTER (?song = ?match)
+			          }
+			          ?song nmm:performer [ nmm:artistName ?performer ] ;
+			                nmm:musicAlbum [ nie:title ?album ] ;
+			                nfo:belongsToContainer [ nie:url ?tooltip ]
 			        }
-			        ORDER BY DESC(fts:rank(?urn)) DESC(nie:title(?urn)) 
+			        ORDER BY DESC(fts:rank(?song)) DESC(nie:title(?song))
 			        OFFSET $offset LIMIT $limit
 			        ";
 			break;



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