Commit 744360b75c90dc9372ce3c757a9f88f999b4769c
1 parent
b0a61386
Exists in
master
and in
21 other branches
Added failing test
Showing
2 changed files
with
12 additions
and
9 deletions
Show diff stats
lib/searchkick.rb
... | ... | @@ -53,7 +53,7 @@ module Searchkick |
53 | 53 | should do |
54 | 54 | match fields, term, boost: 10, operator: "and", analyzer: "searchkick_search" |
55 | 55 | end |
56 | - should do | |
56 | + must do | |
57 | 57 | match fields, term, use_dis_max: false, fuzziness: 0.7, max_expansions: 1, prefix_length: 1, operator: "and", analyzer: "searchkick_search" |
58 | 58 | end |
59 | 59 | if conversions |
... | ... | @@ -86,15 +86,15 @@ module Searchkick |
86 | 86 | }, |
87 | 87 | searchkick: { |
88 | 88 | type: "custom", |
89 | - tokenizer: "standard", | |
89 | + tokenizer: "whitespace", | |
90 | 90 | # synonym should come last, after stemming and shingle |
91 | 91 | # shingle must come before snowball |
92 | - filter: ["standard", "lowercase", "asciifolding", "stop", "snowball", "searchkick_index_shingle"] | |
92 | + filter: ["lowercase", "asciifolding", "stop", "snowball", "searchkick_index_shingle"] | |
93 | 93 | }, |
94 | 94 | searchkick_search: { |
95 | 95 | type: "custom", |
96 | - tokenizer: "standard", | |
97 | - filter: ["standard", "lowercase", "asciifolding", "stop", "snowball", "searchkick_search_shingle"] | |
96 | + tokenizer: "whitespace", | |
97 | + filter: ["lowercase", "asciifolding", "stop", "snowball", "searchkick_search_shingle"] | |
98 | 98 | } |
99 | 99 | }, |
100 | 100 | filter: { | ... | ... |
test/searchkick_test.rb
... | ... | @@ -57,6 +57,11 @@ class TestSearchkick < Minitest::Unit::TestCase |
57 | 57 | assert_search "pepperjack cheese", ["Pepper Jack Cheese"] |
58 | 58 | end |
59 | 59 | |
60 | + def test_middle_token | |
61 | + store_names ["Dish Washer Soap"] | |
62 | + assert_search "dish soap", ["Dish Washer Soap"] | |
63 | + end | |
64 | + | |
60 | 65 | # ascii |
61 | 66 | |
62 | 67 | def test_jalapenos |
... | ... | @@ -97,13 +102,11 @@ class TestSearchkick < Minitest::Unit::TestCase |
97 | 102 | |
98 | 103 | def test_conversions |
99 | 104 | store [ |
100 | - {name: "Tomato Sauce", conversions: [{query: "tomato sauce", count: 100}, {query: "tomato", count: 2}]}, | |
105 | + {name: "Tomato Sauce", conversions: [{query: "tomato sauce", count: 5}, {query: "tomato", count: 200}]}, | |
101 | 106 | {name: "Tomato Paste", conversions: []}, |
102 | 107 | {name: "Tomatoes", conversions: [{query: "tomato", count: 100}, {query: "tomato sauce", count: 2}]} |
103 | 108 | ] |
104 | - assert_search "tomato sauce", ["Tomato Sauce", "Tomatoes"] #, "Tomato Paste"] | |
105 | - assert_search "tomato", ["Tomatoes", "Tomato Sauce", "Tomato Paste"] | |
106 | - assert_search "tomato paste", ["Tomato Paste"] #, "Tomatoes", "Tomato Sauce"] | |
109 | + assert_search "tomato", ["Tomato Sauce", "Tomatoes", "Tomato Paste"] | |
107 | 110 | end |
108 | 111 | |
109 | 112 | def test_conversions_stemmed | ... | ... |