Sha256: e13655715aec40958159b8d9f6baaf1a5cc508f11dce5215400fa1aa85d86f49
Contents?: true
Size: 1.31 KB
Versions: 3
Compression:
Stored size: 1.31 KB
Contents
require_relative "test_helper" class QueryTest < Minitest::Test def test_basic store_names ["Milk", "Apple"] query = Product.search("milk", execute: false) # query.body = {query: {match_all: {}}} # query.body = {query: {match: {name: "Apple"}}} query.body[:query] = {match_all: {}} assert_equal ["Apple", "Milk"], query.map(&:name).sort assert_equal ["Apple", "Milk"], query.execute.map(&:name).sort end def test_with_effective_min_score store_names ["Milk", "Milk2"] assert_search "milk", ["Milk"], body_options: {min_score: 1} end def test_with_uneffective_min_score store_names ["Milk", "Milk2"] assert_search "milk", ["Milk", "Milk2"], body_options: {min_score: 0.0001} end def test_default_timeout assert_equal "6s", Product.search("*", execute: false).body[:timeout] end def test_timeout_override assert_equal "1s", Product.search("*", body_options: {timeout: "1s"}, execute: false).body[:timeout] end def test_request_params assert_equal "dfs_query_then_fetch", Product.search("*", request_params: {search_type: "dfs_query_then_fetch"}, execute: false).params[:search_type] end def test_debug store_names ["Milk"] out, _ = capture_io do assert_search "milk", ["Milk"], debug: true end refute_includes out, "Error" end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
searchkick-3.1.0 | test/query_test.rb |
searchkick-3.0.3 | test/query_test.rb |
searchkick_evichat-0.0.2 | test/query_test.rb |