[rygel/rygel-0-18] media-export: Fix fall-back search recursion



commit c3393ba40bb47e444286f0c17301a527810af107
Author: Jens Georg <jensg openismus com>
Date:   Sat Aug 17 09:37:29 2013 +0200

    media-export: Fix fall-back search recursion
    
    https://bugzilla.gnome.org/show_bug.cgi?id=706058

 .../rygel-media-export-leaf-query-container.vala   |    9 ++--
 .../rygel-media-export-query-container.vala        |   43 ++++---------------
 2 files changed, 14 insertions(+), 38 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-leaf-query-container.vala 
b/src/plugins/media-export/rygel-media-export-leaf-query-container.vala
index 7d97c5b..f39acc2 100644
--- a/src/plugins/media-export/rygel-media-export-leaf-query-container.vala
+++ b/src/plugins/media-export/rygel-media-export-leaf-query-container.vala
@@ -36,12 +36,13 @@ internal class Rygel.MediaExport.LeafQueryContainer : QueryContainer {
                                          Cancellable? cancellable)
                                          throws GLib.Error {
         uint total_matches;
-        var children = yield this.search (null,
+        var children = this.media_db.get_objects_by_search_expression
+                                         (this.expression,
+                                          "0",
+                                          sort_criteria,
                                           offset,
                                           max_count,
-                                          out total_matches,
-                                          sort_criteria,
-                                          cancellable);
+                                          out total_matches);
         foreach (var child in children) {
             var container_id = QueryContainer.ITEM_PREFIX +
                                this.id.replace (QueryContainer.PREFIX, "");
diff --git a/src/plugins/media-export/rygel-media-export-query-container.vala 
b/src/plugins/media-export/rygel-media-export-query-container.vala
index 520cdc0..f26af50 100644
--- a/src/plugins/media-export/rygel-media-export-query-container.vala
+++ b/src/plugins/media-export/rygel-media-export-query-container.vala
@@ -48,41 +48,16 @@ internal abstract class Rygel.MediaExport.QueryContainer : DBContainer {
                                                 string            sort_criteria,
                                                 Cancellable?      cancellable)
                                                 throws GLib.Error {
-        MediaObjects children = null;
-
-        SearchExpression combined_expression;
-
-        if (expression == null) {
-            combined_expression = this.expression;
-        } else {
-            var local_expression = new LogicalExpression ();
-            local_expression.operand1 = this.expression;
-            local_expression.op = LogicalOperator.AND;
-            local_expression.operand2 = expression;
-            combined_expression = local_expression;
-        }
-
-        try {
-            children = this.media_db.get_objects_by_search_expression
-                                        (combined_expression,
-                                         null,
-                                         sort_criteria,
+        debug ("Running search %s on query container %s",
+               expression == null ? "null" : expression.to_string (),
+               this.id);
+        // Override DBContainer search to always use fall-back search.
+        return yield this.simple_search (expression,
                                          offset,
                                          max_count,
-                                         out total_matches);
-        } catch (MediaCacheError error) {
-            if (error is MediaCacheError.UNSUPPORTED_SEARCH) {
-                return yield this.simple_search (expression,
-                                                 offset,
-                                                 max_count,
-                                                 out total_matches,
-                                                 sort_criteria,
-                                                 cancellable);
-            } else {
-                throw error;
-            }
-        }
-
-        return children;
+                                         out total_matches,
+                                         sort_criteria,
+                                         cancellable);
     }
+
 }


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