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
C++ algoliadatastoreelasticsearchenterprise-searchfacetingfull-text-searchfuzzy-searchgeosearchin-memoryinstantsearchmerchandisingpineconesearchsearch-enginesemantic-searchsimilarity-searchsite-searchsynonymstypo-tolerancevector-search
Test for pagination.
Kishore Nallanbb3ca4211a78
diff --git a/TODO.md b/TODO.mdindex 32344bac..1a483ad9 100644--- a/TODO.md+++ b/TODO.md@@ -66,10 +66,11 @@- ~~test for num_documents~~- ~~test for string filter comparison: title < "foo"~~- ~~Test for sorted_array::indexOf when length is 0~~+- ~~Test for pagination~~- test for token ranking on float field- test for float int field deletion during doc deletion- Test for snippets-- Test for pagination+- Test for replication- Proper logging- https support- Validate before string to int conversion in the http api layerdiff --git a/test/collection_test.cpp b/test/collection_test.cppindex 58fb82f4..d0690e1a 100644--- a/test/collection_test.cpp+++ b/test/collection_test.cpp@@ -352,6 +352,47 @@ TEST_F(CollectionTest, TextContainingAnActualTypo) {}}+TEST_F(CollectionTest, Pagination) {+ nlohmann::json results = collection->search("the", query_fields, "", {}, sort_fields, 0, 3, 1, FREQUENCY, false).get();+ ASSERT_EQ(3, results["hits"].size());+ ASSERT_EQ(7, results["found"].get<uint32_t>());++ std::vector<std::string> ids = {"1", "6", "foo"};++ for(size_t i = 0; i < results["hits"].size(); i++) {+ nlohmann::json result = results["hits"].at(i);+ std::string result_id = result["id"];+ std::string id = ids.at(i);+ ASSERT_STREQ(id.c_str(), result_id.c_str());+ }++ results = collection->search("the", query_fields, "", {}, sort_fields, 0, 3, 2, FREQUENCY, false).get();+ ASSERT_EQ(3, results["hits"].size());+ ASSERT_EQ(7, results["found"].get<uint32_t>());++ ids = {"13", "10", "8"};++ for(size_t i = 0; i < results["hits"].size(); i++) {+ nlohmann::json result = results["hits"].at(i);+ std::string result_id = result["id"];+ std::string id = ids.at(i);+ ASSERT_STREQ(id.c_str(), result_id.c_str());+ }++ results = collection->search("the", query_fields, "", {}, sort_fields, 0, 3, 3, FREQUENCY, false).get();+ ASSERT_EQ(1, results["hits"].size());+ ASSERT_EQ(7, results["found"].get<uint32_t>());++ ids = {"16"};++ for(size_t i = 0; i < results["hits"].size(); i++) {+ nlohmann::json result = results["hits"].at(i);+ std::string result_id = result["id"];+ std::string id = ids.at(i);+ ASSERT_STREQ(id.c_str(), result_id.c_str());+ }+}+TEST_F(CollectionTest, PrefixSearching) {std::vector<std::string> facets;nlohmann::json results = collection->search("ex", query_fields, "", facets, sort_fields, 0, 10, 1, FREQUENCY, true).get();