Commit 03ea015f6a9cffcce933f92915f64e30803e1e51
1 parent
9ce7eaef
Exists in
master
and in
2 other branches
Fixed missing methods with multi_search - #1518
Showing
3 changed files
with
9 additions
and
1 deletions
Show diff stats
CHANGELOG.md
lib/searchkick/query.rb
1 | 1 | module Searchkick |
2 | 2 | class Query |
3 | + include Enumerable | |
3 | 4 | extend Forwardable |
4 | 5 | |
5 | 6 | @@metric_aggs = [:avg, :cardinality, :max, :min, :sum] |
... | ... | @@ -13,7 +14,7 @@ module Searchkick |
13 | 14 | :current_page, :per_page, :limit_value, :padding, :total_pages, :num_pages, |
14 | 15 | :offset_value, :offset, :previous_page, :prev_page, :next_page, :first_page?, :last_page?, |
15 | 16 | :out_of_range?, :hits, :response, :to_a, :first, :scroll, :highlights, :with_highlights, |
16 | - :with_score, :misspellings?, :scroll_id, :clear_scroll, :missing_records | |
17 | + :with_score, :misspellings?, :scroll_id, :clear_scroll, :missing_records, :with_hit | |
17 | 18 | |
18 | 19 | def initialize(klass, term = "*", **options) |
19 | 20 | unknown_keywords = options.keys - [:aggs, :block, :body, :body_options, :boost, | ... | ... |
test/multi_search_test.rb
... | ... | @@ -11,6 +11,12 @@ class MultiSearchTest < Minitest::Test |
11 | 11 | assert_equal ["Store A"], stores.map(&:name) |
12 | 12 | end |
13 | 13 | |
14 | + def test_methods | |
15 | + result = Product.search("*") | |
16 | + query = Product.search("*", execute: false) | |
17 | + assert_empty(result.methods - query.methods) | |
18 | + end | |
19 | + | |
14 | 20 | def test_error |
15 | 21 | store_names ["Product A"] |
16 | 22 | products = Product.search("*", execute: false) | ... | ... |