Commit 7316b617a7df5d76a657918190e30f8fbdc62eb8
1 parent
a8592a9b
Exists in
master
and in
21 other branches
Removed stop words in favor of common terms - closes #105
Showing
3 changed files
with
10 additions
and
4 deletions
Show diff stats
lib/searchkick/reindex.rb
... | ... | @@ -101,17 +101,17 @@ module Searchkick |
101 | 101 | tokenizer: "standard", |
102 | 102 | # synonym should come last, after stemming and shingle |
103 | 103 | # shingle must come before snowball |
104 | - filter: ["standard", "lowercase", "asciifolding", "stop", "searchkick_index_shingle", "snowball"] | |
104 | + filter: ["standard", "lowercase", "asciifolding", "searchkick_index_shingle", "snowball"] | |
105 | 105 | }, |
106 | 106 | searchkick_search: { |
107 | 107 | type: "custom", |
108 | 108 | tokenizer: "standard", |
109 | - filter: ["standard", "lowercase", "asciifolding", "stop", "searchkick_search_shingle", "snowball"] | |
109 | + filter: ["standard", "lowercase", "asciifolding", "searchkick_search_shingle", "snowball"] | |
110 | 110 | }, |
111 | 111 | searchkick_search2: { |
112 | 112 | type: "custom", |
113 | 113 | tokenizer: "standard", |
114 | - filter: ["standard", "lowercase", "asciifolding", "stop", "snowball"] | |
114 | + filter: ["standard", "lowercase", "asciifolding", "snowball"] | |
115 | 115 | }, |
116 | 116 | # https://github.com/leschenko/elasticsearch_autocomplete/blob/master/lib/elasticsearch_autocomplete/analyzers.rb |
117 | 117 | searchkick_autocomplete_index: { | ... | ... |
lib/searchkick/search.rb
... | ... | @@ -77,7 +77,8 @@ module Searchkick |
77 | 77 | fields: [field], |
78 | 78 | query: term, |
79 | 79 | use_dis_max: false, |
80 | - operator: operator | |
80 | + operator: operator, | |
81 | + cutoff_frequency: 0.001 | |
81 | 82 | } |
82 | 83 | queries.concat [ |
83 | 84 | {multi_match: shared_options.merge(boost: 10, analyzer: "searchkick_search")}, | ... | ... |
test/match_test.rb
... | ... | @@ -139,4 +139,9 @@ class TestMatch < Minitest::Unit::TestCase |
139 | 139 | assert_search "*", ["Product A", "Product B"] |
140 | 140 | end |
141 | 141 | |
142 | + def test_to_be_or_not_to_be | |
143 | + store_names ["to be or not to be"] | |
144 | + assert_search "to be", ["to be or not to be"] | |
145 | + end | |
146 | + | |
142 | 147 | end | ... | ... |