Commit 03ea015f6a9cffcce933f92915f64e30803e1e51

Authored by Andrew Kane
1 parent 9ce7eaef

Fixed missing methods with multi_search - #1518

1 ## 4.6.1 (unreleased) 1 ## 4.6.1 (unreleased)
2 2
3 - Added `ilike` operator for Elasticsearch 7.10+ 3 - Added `ilike` operator for Elasticsearch 7.10+
  4 +- Fixed missing methods with `multi_search`
4 5
5 ## 4.6.0 (2021-08-22) 6 ## 4.6.0 (2021-08-22)
6 7
lib/searchkick/query.rb
1 module Searchkick 1 module Searchkick
2 class Query 2 class Query
  3 + include Enumerable
3 extend Forwardable 4 extend Forwardable
4 5
5 @@metric_aggs = [:avg, :cardinality, :max, :min, :sum] 6 @@metric_aggs = [:avg, :cardinality, :max, :min, :sum]
@@ -13,7 +14,7 @@ module Searchkick @@ -13,7 +14,7 @@ module Searchkick
13 :current_page, :per_page, :limit_value, :padding, :total_pages, :num_pages, 14 :current_page, :per_page, :limit_value, :padding, :total_pages, :num_pages,
14 :offset_value, :offset, :previous_page, :prev_page, :next_page, :first_page?, :last_page?, 15 :offset_value, :offset, :previous_page, :prev_page, :next_page, :first_page?, :last_page?,
15 :out_of_range?, :hits, :response, :to_a, :first, :scroll, :highlights, :with_highlights, 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 def initialize(klass, term = "*", **options) 19 def initialize(klass, term = "*", **options)
19 unknown_keywords = options.keys - [:aggs, :block, :body, :body_options, :boost, 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,6 +11,12 @@ class MultiSearchTest < Minitest::Test
11 assert_equal ["Store A"], stores.map(&:name) 11 assert_equal ["Store A"], stores.map(&:name)
12 end 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 def test_error 20 def test_error
15 store_names ["Product A"] 21 store_names ["Product A"]
16 products = Product.search("*", execute: false) 22 products = Product.search("*", execute: false)