diff --git a/CHANGELOG.md b/CHANGELOG.md index eb93e74..fa97eaf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## 2.2.1 [unreleased] - Added `avg`, `cardinality`, `max`, `min`, and `sum` aggregations +- Added `load: {dumpable: true}` option - Accept string for `exclude` option ## 2.2.0 diff --git a/lib/searchkick/results.rb b/lib/searchkick/results.rb index 3815500..d3e1a7c 100644 --- a/lib/searchkick/results.rb +++ b/lib/searchkick/results.rb @@ -33,7 +33,7 @@ module Searchkick # sort hits.map do |hit| result = results[hit["_type"]][hit["_id"].to_s] - if result + if result && !(options[:load].is_a?(Hash) && options[:load][:dumpable]) unless result.respond_to?(:search_hit) result.define_singleton_method(:search_hit) do hit diff --git a/test/marshal_test.rb b/test/marshal_test.rb new file mode 100644 index 0000000..7b56441 --- /dev/null +++ b/test/marshal_test.rb @@ -0,0 +1,8 @@ +require_relative "test_helper" + +class MarshalTest < Minitest::Test + def test_marshal + store_names ["Product A"] + assert Marshal.dump(Product.search("*", load: {dumpable: true}).results) + end +end -- libgit2 0.21.0