Skip to content

Commit

Permalink
Added load: {dumpable: true} option - closes #887
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Apr 9, 2017
1 parent 70b0ffd commit 45be88e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions 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
Expand Down
2 changes: 1 addition & 1 deletion lib/searchkick/results.rb
Expand Up @@ -33,7 +33,7 @@ def results
# 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
Expand Down
8 changes: 8 additions & 0 deletions 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

0 comments on commit 45be88e

Please sign in to comment.