Method: Asari::ActiveRecord::ClassMethods#asari_find
- Defined in:
- lib/asari/active_record.rb
#asari_find(term, options = {}) ⇒ Object
Public: method for searching the index for the specified term and
returning all model objects that match.
Returns: a list of all matching AR model objects, or an empty list if no
records are found that match.
Raises: an Asari::SearchException error if there are issues
communicating with the CloudSearch server.
143 144 145 146 147 148 |
# File 'lib/asari/active_record.rb', line 143 def asari_find(term, = {}) records = self.asari_instance.search(term, ) ids = records.map { |id| id.to_i } records.replace(Array(self.where("id in (?)", ids))) end |