Commit c30567959cff1971f79ecc9886dafa290e64a452
1 parent
6b2d34f5
Exists in
master
and in
17 other branches
Fixed field misspellings for older partial match format - #1194
Showing
3 changed files
with
7 additions
and
1 deletions
Show diff stats
CHANGELOG.md
lib/searchkick/query.rb
... | ... | @@ -281,7 +281,7 @@ module Searchkick |
281 | 281 | prefix_length = (misspellings.is_a?(Hash) && misspellings[:prefix_length]) || 0 |
282 | 282 | default_max_expansions = @misspellings_below ? 20 : 3 |
283 | 283 | max_expansions = (misspellings.is_a?(Hash) && misspellings[:max_expansions]) || default_max_expansions |
284 | - misspellings_fields = misspellings.is_a?(Hash) && misspellings.key?(:fields) && misspellings[:fields].map { |f| "#{f}.#{@match_suffix}" } | |
284 | + misspellings_fields = misspellings.is_a?(Hash) && misspellings.key?(:fields) && misspellings[:fields].map { |f| f.is_a?(Hash) ? f.to_a.join(".") : "#{f}.#{@match_suffix}" } | |
285 | 285 | |
286 | 286 | if misspellings_fields |
287 | 287 | missing_fields = misspellings_fields - fields | ... | ... |
test/misspellings_test.rb
... | ... | @@ -97,4 +97,9 @@ class MisspellingsTest < Minitest::Test |
97 | 97 | assert_search "siracha", ["Sriracha"], {misspellings: {fields: [:name]}} |
98 | 98 | end |
99 | 99 | end |
100 | + | |
101 | + def test_misspellings_field_word_start | |
102 | + store_names ["Sriracha"] | |
103 | + assert_search "siracha", ["Sriracha"], fields: [{name: :word_middle}], misspellings: {fields: [{name: :word_middle}]} | |
104 | + end | |
100 | 105 | end | ... | ... |