module Filemaker::Elasticsearch::FilemakerAdapter::Records

Public Instance Methods

records() click to toggle source
# File lib/filemaker/elasticsearch/filemaker_adapter.rb, line 5
def records
  criteria = klass.in(klass.identity.name => ids)

  criteria.instance_exec(response.response['hits']['hits']) do |hits|
    define_singleton_method :to_a do
      entries.sort_by do |e|
        hits.index { |hit| hit['_id'].to_s == e.id.to_s }
      end
    end
  end

  criteria
end