From d2dba44e5ea510aab984aa1a77ba9c82012eb97c Mon Sep 17 00:00:00 2001 From: kishorenc Date: Tue, 19 Nov 2019 06:10:38 +0530 Subject: [PATCH] Test for edge case of finding no query tokens in the array. --- test/collection_test.cpp | 6 ++++++ 1 file changed, 6 insertions(+) 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().c_str(), "Amazing Spiderman is amazing"); // 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"); }