Created
March 5, 2014 20:14
-
-
Save jelder/9375649 to your computer and use it in GitHub Desktop.
Prevent deleted objects in ElasticSearch from causing problems
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Tire | |
module Results | |
class Collection | |
def __find_records_by_ids(klass, ids) | |
records = @options[:load] === true ? klass.where(klass.primary_key => ids) : klass.find(ids, @options[:load]) | |
@response['hits']['hits'].keep_if { |hit| records.map(&:id).include? hit["_id"].to_i } | |
records | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment