Commit 5b19c959149ed42df51ce75d9a6ea99573f408f5
1 parent
3d902522
Exists in
relation
and in
1 other branch
Delegate [skip ci]
Showing
2 changed files
with
5 additions
and
1 deletions
Show diff stats
lib/searchkick/relation.rb
@@ -11,6 +11,8 @@ module Searchkick | @@ -11,6 +11,8 @@ module Searchkick | ||
11 | :offset_value, :previous_page, :prev_page, :next_page, :first_page?, :last_page?, | 11 | :offset_value, :previous_page, :prev_page, :next_page, :first_page?, :last_page?, |
12 | :out_of_range?, :hits, :response, :to_a, :first, :highlights | 12 | :out_of_range?, :hits, :response, :to_a, :first, :highlights |
13 | 13 | ||
14 | + def_delegators :query, :body, :params | ||
15 | + | ||
14 | def initialize(klass, term = "*", **options) | 16 | def initialize(klass, term = "*", **options) |
15 | unknown_keywords = options.keys - [:aggs, :block, :body, :body_options, :boost, | 17 | unknown_keywords = options.keys - [:aggs, :block, :body, :body_options, :boost, |
16 | :boost_by, :boost_by_distance, :boost_by_recency, :boost_where, :conversions, :conversions_term, :debug, :emoji, :exclude, :execute, :explain, | 18 | :boost_by, :boost_by_distance, :boost_by_recency, :boost_where, :conversions, :conversions_term, :debug, :emoji, :exclude, :execute, :explain, |
test/query_test.rb
@@ -21,15 +21,17 @@ class QueryTest < Minitest::Test | @@ -21,15 +21,17 @@ class QueryTest < Minitest::Test | ||
21 | 21 | ||
22 | def test_default_timeout | 22 | def test_default_timeout |
23 | assert_equal "6s", Product.search("*", execute: false).body[:timeout] | 23 | assert_equal "6s", Product.search("*", execute: false).body[:timeout] |
24 | + assert_equal "6s", Product.search("*", relation: true).body[:timeout] | ||
24 | end | 25 | end |
25 | 26 | ||
26 | def test_timeout_override | 27 | def test_timeout_override |
27 | assert_equal "1s", Product.search("*", body_options: {timeout: "1s"}, execute: false).body[:timeout] | 28 | assert_equal "1s", Product.search("*", body_options: {timeout: "1s"}, execute: false).body[:timeout] |
29 | + assert_equal "1s", Product.search("*", relation: true).body_options(timeout: "1s").body[:timeout] | ||
28 | end | 30 | end |
29 | 31 | ||
30 | def test_request_params | 32 | def test_request_params |
31 | assert_equal "dfs_query_then_fetch", Product.search("*", request_params: {search_type: "dfs_query_then_fetch"}, execute: false).params[:search_type] | 33 | assert_equal "dfs_query_then_fetch", Product.search("*", request_params: {search_type: "dfs_query_then_fetch"}, execute: false).params[:search_type] |
32 | - assert_equal "dfs_query_then_fetch", Product.search("*", relation: true).request_params(search_type: "dfs_query_then_fetch").query.params[:search_type] | 34 | + assert_equal "dfs_query_then_fetch", Product.search("*", relation: true).request_params(search_type: "dfs_query_then_fetch").params[:search_type] |
33 | end | 35 | end |
34 | 36 | ||
35 | def test_debug | 37 | def test_debug |