lib/searchkick/index.rb in searchkick-3.0.3 vs lib/searchkick/index.rb in searchkick-3.1.0
- old
+ new
@@ -157,13 +157,12 @@
def similar_record(record, **options)
like_text = retrieve(record).to_hash
.keep_if { |k, _| !options[:fields] || options[:fields].map(&:to_s).include?(k) }
.values.compact.join(" ")
- # TODO deep merge method
options[:where] ||= {}
options[:where][:_id] ||= {}
- options[:where][:_id][:not] = record.id.to_s
+ options[:where][:_id][:not] = Array(options[:where][:_id][:not]) + [record.id.to_s]
options[:per_page] ||= 10
options[:similar] = true
# TODO use index class instead of record class
Searchkick.search(like_text, model: record.class, **options)