Skip to content

Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences

Test for edge case of finding no query tokens in the array.

kishorencd2dba44e5ea5
diff --git a/test/collection_test.cpp b/test/collection_test.cpp
index 3df4847c..a684da5b 100644
--- a/test/collection_test.cpp
+++ b/test/collection_test.cpp
@@ -669,6 +669,12 @@ TEST_F(CollectionTest, ArrayStringFieldHighlight) {
ASSERT_STREQ(results["hits"][0]["highlights"][1]["snippet"].get<std::string>().c_str(),
"<mark>Amazing</mark> Spiderman is <mark>amazing</mark>"); // should highlight duplicating tokens
+ // when query tokens are not found in an array field they should be ignored
+ results = coll_array_text->search("winds", query_fields, "", facets, sort_fields, 0, 10, 1, FREQUENCY,
+ false, 0).get();
+ ASSERT_EQ(1, results["hits"].size());
+ ASSERT_EQ(1, results["hits"][0]["highlights"].size());
+
collectionManager.drop_collection("coll_array_text");
}