[ARVADOS] created: cad4856b84ff09f8d66faf16cc02ce68ef87995f

Git user git at public.curoverse.com
Thu Mar 2 17:55:38 EST 2017


        at  cad4856b84ff09f8d66faf16cc02ce68ef87995f (commit)


commit cad4856b84ff09f8d66faf16cc02ce68ef87995f
Author: radhika <radhika at curoverse.com>
Date:   Thu Mar 2 17:53:12 2017 -0500

    11017: Use count='none' for full text search on workbench.
    Update groups.load_searchable_objects which is used by contents method
    to work with multiple class types when count='none' is used.

diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index ee3ac4d..23b8788 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -232,11 +232,18 @@ class ApplicationController < ActionController::Base
       objects = @objects
     end
     if objects.respond_to?(:result_offset) and
-        objects.respond_to?(:result_limit) and
-        objects.respond_to?(:items_available)
+        objects.respond_to?(:result_limit)
       next_offset = objects.result_offset + objects.result_limit
-      if next_offset < objects.items_available
+      if objects.respond_to?(:items_available) and (next_offset < objects.items_available)
         next_offset
+      elsif @objects.results.size > 0 and (params[:count] == 'none' or
+           (params[:controller] == 'search' and params[:action] == 'choose'))
+        last_object_class = @objects.last.class
+        if params['last_object_class'].nil? or params['last_object_class'] == last_object_class.to_s
+          next_offset
+        else
+          @objects.select{|obj| obj.class == last_object_class}.size
+        end
       else
         nil
       end
diff --git a/apps/workbench/app/controllers/search_controller.rb b/apps/workbench/app/controllers/search_controller.rb
index 447f416..2511ab0 100644
--- a/apps/workbench/app/controllers/search_controller.rb
+++ b/apps/workbench/app/controllers/search_controller.rb
@@ -15,6 +15,8 @@ class SearchController < ApplicationController
     end
     @objects = search_what.contents(limit: @limit,
                                     offset: @offset,
+                                    count: 'none',
+                                    last_object_class: params["last_object_class"],
                                     filters: @filters)
     super
   end
@@ -22,6 +24,7 @@ class SearchController < ApplicationController
   def next_page_href with_params={}
     super with_params.merge(last_object_class: @objects.last.class.to_s,
                             project_uuid: params[:project_uuid],
+                            count: 'none',
                             filters: @filters.to_json)
   end
 end
diff --git a/services/api/app/controllers/arvados/v1/groups_controller.rb b/services/api/app/controllers/arvados/v1/groups_controller.rb
index 5d91a81..1b74af7 100644
--- a/services/api/app/controllers/arvados/v1/groups_controller.rb
+++ b/services/api/app/controllers/arvados/v1/groups_controller.rb
@@ -91,9 +91,22 @@ class Arvados::V1::GroupsController < ApplicationController
       end
     end
 
+    seen_last_class = false
     klasses.each do |klass|
+      @offset = 0 if seen_last_class  # reset offset for the new type being processed
+
+      # if current klass is same as params['last_object_class'], mark that fact
+      seen_last_class = true if params['count'] == 'none' and (params['last_object_class'].empty? or params['last_object_class'] == klass.to_s)
+
+      # if a klasses are specified, skip all other klass types
       next if wanted_klasses.any? and !wanted_klasses.include?(klass.to_s)
 
+      # don't reprocess klass types that were already seen
+      next if params['count'] == 'none' and !seen_last_class
+
+      # don't process rest of object types if we already have needed number of objects
+      break ifparams['count'] == 'none' and @objects.size == @limit
+
       # If the currently requested orders specifically match the
       # table_name for the current klass, apply that order.
       # Otherwise, order by recency.

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list