test/index_test.rb in searchkick-1.3.4 vs test/index_test.rb in searchkick-1.3.5
- old
+ new
@@ -90,11 +90,11 @@
def test_missing_index
assert_raises(Searchkick::MissingIndexError) { Product.search "test", index_name: "not_found" }
end
def test_unsupported_version
- raises_exception = ->(_) { raise Elasticsearch::Transport::Transport::Error.new("[500] No query registered for [multi_match]") }
+ raises_exception = ->(_) { raise Elasticsearch::Transport::Transport::Error, "[500] No query registered for [multi_match]" }
Searchkick.client.stub :search, raises_exception do
assert_raises(Searchkick::UnsupportedVersionError) { Product.search("test") }
end
end
@@ -110,9 +110,17 @@
end
assert_search "product", []
end
def test_analyzed_only
+ # skip for 5.0 since it throws
+ # Cannot search on field [alt_description] since it is not indexed.
+ skip unless elasticsearch_below50?
+ store [{name: "Product A", alt_description: "Hello"}]
+ assert_search "*", [], where: {alt_description: "Hello"}
+ end
+
+ def test_analyzed_only_large_value
skip if nobrainer?
large_value = 10000.times.map { "hello" }.join(" ")
store [{name: "Product A", alt_description: large_value}]
assert_search "product", ["Product A"]
end