Sha256: 06b8bebdde230085089de8ff22d9b8483dcb47126da44a2d6f8921582bf820a6

Contents?: true

Size: 1.34 KB

Versions: 23

Compression:

Stored size: 1.34 KB

Contents

module Rhoconnect
  module Handler
    module Search
      module ExecuteMethods
        def execute_search_handler(route_handler)
          content_type :json
          return [].to_json unless params[:sources]
          res = []
          params[:sources].each do |source_params|
            s = Source.load(source_params['name'],{:app_id => current_client.app_id,
              :user_id => current_client.user_id})
            current_client.source_name = source_params['name']
            @model = Rhoconnect::Model::Base.create(s)

            params[:token] = source_params['token'] if source_params['token']
            if not s.is_pass_through?
              @handler = Rhoconnect::Handler::Search::Runner.new(@model, current_client, route_handler, params)
            else
              @handler = Rhoconnect::Handler::Search::PassThroughRunner.new(@model, current_client, route_handler, params)
            end
            @model = @handler.engine.model
            search_res = @handler.run
            res << search_res if search_res
          end
          response.headers[Rhoconnect::PAGE_TOKEN_HEADER] = res[0][1]['token'] if res[0][1] and res[0][1]['token']
          response.headers[Rhoconnect::PAGE_OBJECT_COUNT_HEADER] = res[0][3]['count'].to_s if res[0][3] and res[0][3]['count']
          res.to_json     
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
rhoconnect-7.6.0 lib/rhoconnect/handler/search/execute_methods.rb
rhoconnect-7.5.1 lib/rhoconnect/handler/search/execute_methods.rb
rhoconnect-7.4.1 lib/rhoconnect/handler/search/execute_methods.rb
rhoconnect-7.1.17 lib/rhoconnect/handler/search/execute_methods.rb
rhoconnect-6.2.0 lib/rhoconnect/handler/search/execute_methods.rb
rhoconnect-6.0.11 lib/rhoconnect/handler/search/execute_methods.rb
rhoconnect-5.5.18 lib/rhoconnect/handler/search/execute_methods.rb
rhoconnect-5.5.17 lib/rhoconnect/handler/search/execute_methods.rb
rhoconnect-5.5.15 lib/rhoconnect/handler/search/execute_methods.rb
rhoconnect-5.5.0.22 lib/rhoconnect/handler/search/execute_methods.rb
rhoconnect-5.5.2 lib/rhoconnect/handler/search/execute_methods.rb
rhoconnect-5.5.0.7 lib/rhoconnect/handler/search/execute_methods.rb
rhoconnect-5.5.0.3 lib/rhoconnect/handler/search/execute_methods.rb
rhoconnect-5.5.0 lib/rhoconnect/handler/search/execute_methods.rb
rhoconnect-5.1.1 lib/rhoconnect/handler/search/execute_methods.rb
rhoconnect-4.0.4 lib/rhoconnect/handler/search/execute_methods.rb
rhoconnect-4.0.3 lib/rhoconnect/handler/search/execute_methods.rb
rhoconnect-4.0.2 lib/rhoconnect/handler/search/execute_methods.rb
rhoconnect-4.0.1 lib/rhoconnect/handler/search/execute_methods.rb
rhoconnect-4.0.0 lib/rhoconnect/handler/search/execute_methods.rb