test/index_test.rb in searchkick-0.7.8 vs test/index_test.rb in searchkick-0.7.9
- old
+ new
@@ -33,9 +33,23 @@
store_names ["Dollar Tree"], Store
assert_equal [], Store.search(query: {match: {name: "dollar"}}).map(&:name)
assert_equal ["Dollar Tree"], Store.search(query: {match: {name: "Dollar Tree"}}).map(&:name)
end
+ def test_json
+ store_names ["Dollar Tree"], Store
+ assert_equal [], Store.search(query: {match: {name: "dollar"}}).map(&:name)
+ assert_equal ["Dollar Tree"], Store.search(json: {query: {match: {name: "Dollar Tree"}}}, load: false).map(&:name)
+ end
+
+ def test_tokens
+ assert_equal ["dollar", "dollartre", "tree"], Product.searchkick_index.tokens("Dollar Tree")
+ end
+
+ def test_tokens_analyzer
+ assert_equal ["dollar", "tree"], Product.searchkick_index.tokens("Dollar Tree", analyzer: "searchkick_search2")
+ end
+
def test_record_not_found
store_names ["Product A", "Product B"]
Product.where(name: "Product A").delete_all
assert_search "product", ["Product B"]
end