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

Fuzzy search test - multiple results.

Kishore Nallan9bb24331cc67
diff --git a/test/art_test.cpp b/test/art_test.cpp
index 47294bd8..5d37bb62 100644
--- a/test/art_test.cpp
+++ b/test/art_test.cpp
@@ -664,4 +664,14 @@ TEST(ArtTest, test_art_fuzzy_search) {
art_fuzzy_search(&t, (const unsigned char *) "Sarbruckken", strlen("Sarbruckken") + 1, 2, 10, leaves);
ASSERT_EQ(1, leaves.size());
ASSERT_STREQ("Saarbrucken", (const char *)leaves.at(0)->key);
+
+ // multiple matching results
+ leaves.clear();
+ art_fuzzy_search(&t, (const unsigned char *) "hown", strlen("hown") + 1, 1, 10, leaves);
+ ASSERT_EQ(10, leaves.size());
+
+ std::vector<const char*> words = {"town", "sown", "shown", "own", "mown", "lown", "howl", "howk", "howe", "how"};
+ for(auto leaf_index = 0; leaf_index < leaves.size(); leaf_index++) {
+ ASSERT_STREQ(words.at(leaf_index), (const char *)leaves.at(leaf_index)->key);
+ }
}
\ No newline at end of file