Merge branch 'master' into 3296-user-profile
[arvados.git] / apps / workbench / app / controllers / search_controller.rb
index 2b0ad7e57aac5bbf935caac978aad1c864439021..31c66638db69986ddb578740896f67f3be841351 100644 (file)
@@ -1,6 +1,17 @@
 class SearchController < ApplicationController
   def find_objects_for_index
-    @objects = Group.contents(limit: @limit, offset: @offset, filters: @filters)
+    search_what = Group
+    if params[:project_uuid]
+      # Special case for "search all things in project":
+      @filters = @filters.select do |attr, operator, operand|
+        not (attr == 'owner_uuid' and operator == '=')
+      end
+      search_what = Group.find(params[:project_uuid])
+    end
+    @objects = search_what.contents(limit: @limit,
+                                    offset: @offset,
+                                    filters: @filters,
+                                    include_linked: true)
     super
   end