Module: Elasticsearch::Model::Adapter::Mongoid::Records
- Defined in:
- lib/elasticsearch/model/adapters/mongoid.rb
Instance Method Summary collapse
-
#records ⇒ Object
Return a ‘Mongoid::Criteria` instance.
Instance Method Details
#records ⇒ Object
Return a ‘Mongoid::Criteria` instance
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/elasticsearch/model/adapters/mongoid.rb', line 38 def records criteria = klass.where(:id.in => ids) criteria.instance_exec(response.response['hits']['hits']) do |hits| define_singleton_method :to_a do self.entries.sort_by { |e| hits.index { |hit| hit['_id'].to_s == e.id.to_s } } end end criteria end |