Module: CloudSearchRails::Search::ClassMethods
- Defined in:
- lib/cloud_search_rails/search.rb
Instance Method Summary collapse
-
#cloud_search(*args) ⇒ Object
return a scope with the subset of ids.
Instance Method Details
#cloud_search(*args) ⇒ Object
return a scope with the subset of ids
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/cloud_search_rails/search.rb', line 43 def cloud_search(*args) opts = { :page => 1, :per_page => 20 } opts = opts.merge(args.) query = args.first response = self.cloud_search_response(args.first, opts) ids = response.hits.collect{|h| h["id"]} proxy = self.cloud_search_rails_scope(ids) proxy.per_page = opts[:per_page] proxy.current_page = opts[:page] proxy.total_entries = response.found proxy end |