Commit 90724820b18894d9eb23dac7e4deed92a5199954

Authored by Andrew Kane
1 parent a45b3d0c

Test exact

lib/searchkick.rb
@@ -114,7 +114,7 @@ module Searchkick @@ -114,7 +114,7 @@ module Searchkick
114 end 114 end
115 115
116 options = options.merge(block: block) if block 116 options = options.merge(block: block) if block
117 - if relation || (relation.nil? && Searchick.relation) 117 + if relation || (relation.nil? && Searchkick.relation)
118 Searchkick::Relation.new(klass, term, **options) 118 Searchkick::Relation.new(klass, term, **options)
119 else 119 else
120 query = Searchkick::Query.new(klass, term, **options) 120 query = Searchkick::Query.new(klass, term, **options)
test/autocomplete_test.rb
@@ -74,6 +74,7 @@ class AutocompleteTest < Minitest::Test @@ -74,6 +74,7 @@ class AutocompleteTest < Minitest::Test
74 def test_exact 74 def test_exact
75 store_names ["hi@example.org"] 75 store_names ["hi@example.org"]
76 assert_search "hi@example.org", ["hi@example.org"], fields: [{name: :exact}] 76 assert_search "hi@example.org", ["hi@example.org"], fields: [{name: :exact}]
  77 + assert_search_relation ["hi@example.org"], Product.search("hi@example.org", relation: true).fields(name: :exact)
77 end 78 end
78 79
79 def test_exact_case 80 def test_exact_case
test/test_helper.rb
@@ -14,7 +14,7 @@ Searchkick.client.transport.logger = $logger @@ -14,7 +14,7 @@ Searchkick.client.transport.logger = $logger
14 Searchkick.search_timeout = 5 14 Searchkick.search_timeout = 5
15 Searchkick.index_suffix = ENV["TEST_ENV_NUMBER"] # for parallel tests 15 Searchkick.index_suffix = ENV["TEST_ENV_NUMBER"] # for parallel tests
16 16
17 -Searchkick.relation = ENV["RELATION"] 17 +# Searchkick.relation = ENV["RELATION"]
18 18
19 # add to elasticsearch-7.0.0/config/ 19 # add to elasticsearch-7.0.0/config/
20 Searchkick.wordnet_path = "wn_s.pl" if ENV["WORDNET"] 20 Searchkick.wordnet_path = "wn_s.pl" if ENV["WORDNET"]