Commit ec4fedb26c1237d24adf5ea1e26b2f80a91d7e82
1 parent
1fec9ae0
Exists in
master
and in
19 other branches
Fixed bug with text values longer than 256 characters and _all field
Showing
3 changed files
with
22 additions
and
4 deletions
Show diff stats
CHANGELOG.md
lib/searchkick/index_options.rb
test/index_test.rb
1 | 1 | require_relative "test_helper" |
2 | 2 | |
3 | 3 | class IndexTest < Minitest::Test |
4 | + def setup | |
5 | + super | |
6 | + Region.destroy_all | |
7 | + end | |
8 | + | |
4 | 9 | def test_clean_indices |
5 | 10 | old_index = Searchkick::Index.new("products_test_20130801000000000") |
6 | 11 | different_index = Searchkick::Index.new("items_test_20130801000000000") |
... | ... | @@ -127,8 +132,20 @@ class IndexTest < Minitest::Test |
127 | 132 | |
128 | 133 | def test_large_value |
129 | 134 | skip if nobrainer? |
135 | + large_value = 1000.times.map { "hello" }.join(" ") | |
136 | + store [{name: "Product A", text: large_value}], Region | |
137 | + assert_search "product", ["Product A"], {}, Region | |
138 | + assert_search "hello", ["Product A"], {fields: [:name, :text]}, Region | |
139 | + assert_search "hello", ["Product A"], {}, Region | |
140 | + end | |
141 | + | |
142 | + def test_very_large_value | |
143 | + skip if nobrainer? | |
130 | 144 | large_value = 10000.times.map { "hello" }.join(" ") |
131 | - store [{name: "Product A", alt_description: large_value}] | |
132 | - assert_search "product", ["Product A"] | |
145 | + store [{name: "Product A", text: large_value}], Region | |
146 | + assert_search "product", ["Product A"], {}, Region | |
147 | + assert_search "hello", ["Product A"], {fields: [:name, :text]}, Region | |
148 | + # values that exceed ignore_above are not included in _all field :( | |
149 | + # assert_search "hello", ["Product A"], {}, Region | |
133 | 150 | end |
134 | 151 | end | ... | ... |