Commit 3868a25e154d7f72f987a7b07b821add4e3579e8
1 parent
d4b3b2c6
Exists in
master
and in
21 other branches
Longer phrase matching
Showing
2 changed files
with
7 additions
and
3 deletions
Show diff stats
lib/searchkick/reindex.rb
... | ... | @@ -83,7 +83,7 @@ module Searchkick |
83 | 83 | searchkick_suggest_index: { |
84 | 84 | type: "custom", |
85 | 85 | tokenizer: "standard", |
86 | - filter: ["lowercase", "asciifolding", "shingle"] | |
86 | + filter: ["lowercase", "asciifolding", "searchkick_suggest_shingle"] | |
87 | 87 | } |
88 | 88 | }, |
89 | 89 | filter: { |
... | ... | @@ -97,6 +97,10 @@ module Searchkick |
97 | 97 | token_separator: "", |
98 | 98 | output_unigrams: false, |
99 | 99 | output_unigrams_if_no_shingles: true |
100 | + }, | |
101 | + searchkick_suggest_shingle: { | |
102 | + type: "shingle", | |
103 | + max_shingle_size: 5 | |
100 | 104 | } |
101 | 105 | }, |
102 | 106 | tokenizer: { | ... | ... |
test/suggest_test.rb
... | ... | @@ -13,8 +13,8 @@ class TestSuggest < Minitest::Unit::TestCase |
13 | 13 | end |
14 | 14 | |
15 | 15 | def test_phrase |
16 | - store_names ["Tiger Shark", "Sharp Teeth", "Sharp Mind"] | |
17 | - assert_suggest "How to catch a tiger shar", "how to catch a tiger shark" | |
16 | + store_names ["Big Tiger Shark", "Tiger Sharp Teeth", "Tiger Sharp Mind"] | |
17 | + assert_suggest "How to catch a big tiger shar", "how to catch a big tiger shark" | |
18 | 18 | end |
19 | 19 | |
20 | 20 | def test_without_option | ... | ... |