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
Return token separators and symbols to index in API.
Kishore Nallan26fbad2c66a8
diff --git a/src/collection.cpp b/src/collection.cppindex 1b09044a..5dace57b 100644--- a/src/collection.cpp+++ b/src/collection.cpp@@ -148,6 +148,16 @@ nlohmann::json Collection::get_summary_json() const {json_response["name"] = name;json_response["num_documents"] = num_documents.load();json_response["created_at"] = created_at.load();+ json_response["token_separators"] = nlohmann::json::array();+ json_response["symbols_to_index"] = nlohmann::json::array();++ for(auto c: symbols_to_index) {+ json_response["symbols_to_index"].push_back(std::string(1, c));+ }++ for(auto c: token_separators) {+ json_response["token_separators"].push_back(std::string(1, c));+ }nlohmann::json fields_arr;diff --git a/test/collection_specific_test.cpp b/test/collection_specific_test.cppindex ccc01647..fb9cd523 100644--- a/test/collection_specific_test.cpp+++ b/test/collection_specific_test.cpp@@ -1032,6 +1032,12 @@ TEST_F(CollectionSpecificTest, CustomSymbolsForIndexing) {"coll1", 1, fields, "points", 0, "", {"+"}, {}).get();+ nlohmann::json coll_summary = coll1->get_summary_json();+ ASSERT_EQ(1, coll_summary["symbols_to_index"].size());+ ASSERT_EQ(0, coll_summary["token_separators"].size());++ ASSERT_EQ("+", coll_summary["symbols_to_index"][0].get<std::string>());+nlohmann::json doc1;doc1["id"] = "0";doc1["name"] = "Yes, C++ is great!";@@ -1115,6 +1121,16 @@ TEST_F(CollectionSpecificTest, CustomSeparatorsHandleQueryVariations) {"coll1", 1, fields, "points", 0, "", {}, {"-", ".", "*", "&", "/"}).get();+ nlohmann::json coll_summary = coll1->get_summary_json();+ ASSERT_EQ(0, coll_summary["symbols_to_index"].size());+ ASSERT_EQ(5, coll_summary["token_separators"].size());++ ASSERT_EQ("-", coll_summary["token_separators"][0].get<std::string>());+ ASSERT_EQ(".", coll_summary["token_separators"][1].get<std::string>());+ ASSERT_EQ("*", coll_summary["token_separators"][2].get<std::string>());+ ASSERT_EQ("&", coll_summary["token_separators"][3].get<std::string>());+ ASSERT_EQ("/", coll_summary["token_separators"][4].get<std::string>());+nlohmann::json doc1;doc1["id"] = "0";doc1["name"] = "1&1 Internet Limited";