Module: Tinia::Search::ClassMethods
- Defined in:
- lib/tinia/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
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/tinia/search.rb', line 49 def cloud_search(*args) opts = {:page => 1, :per_page => 20} opts = opts.merge(args.) opts[:page] ||= 1 query = args.first response = self.cloud_search_response(args.first, opts) ids = response.hits.collect{|h| h["id"]} proxy = self.tinia_scope(ids) proxy.per_page = opts[:per_page].to_i proxy.current_page = opts[:page].to_i proxy.total_entries = response.found proxy end |