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
Don't do embedding generation on load collection.
Kishore Nallan50d193919d55
diff --git a/include/collection.h b/include/collection.hindex 641692f9..abe812e6 100644--- a/include/collection.h+++ b/include/collection.h@@ -398,7 +398,8 @@ public:nlohmann::json get_summary_json() const;- size_t batch_index_in_memory(std::vector<index_record>& index_records, const size_t remote_embedding_batch_size = 200, const bool generate_embeddings = true);+ size_t batch_index_in_memory(std::vector<index_record>& index_records, const size_t remote_embedding_batch_size,+ const bool generate_embeddings);Option<nlohmann::json> add(const std::string & json_str,const index_operation_t& operation=CREATE, const std::string& id="",@@ -407,7 +408,8 @@ public:nlohmann::json add_many(std::vector<std::string>& json_lines, nlohmann::json& document,const index_operation_t& operation=CREATE, const std::string& id="",const DIRTY_VALUES& dirty_values=DIRTY_VALUES::COERCE_OR_REJECT,- const bool& return_doc=false, const bool& return_id=false, const size_t remote_embedding_batch_size=200);+ const bool& return_doc=false, const bool& return_id=false,+ const size_t remote_embedding_batch_size=200);Option<nlohmann::json> update_matching_filter(const std::string& filter_query,const std::string & json_str,diff --git a/src/collection.cpp b/src/collection.cppindex 738157fe..362088ef 100644--- a/src/collection.cpp+++ b/src/collection.cpp@@ -505,7 +505,7 @@ bool Collection::is_exceeding_memory_threshold() const {void Collection::batch_index(std::vector<index_record>& index_records, std::vector<std::string>& json_out,size_t &num_indexed, const bool& return_doc, const bool& return_id, const size_t remote_embedding_batch_size) {- batch_index_in_memory(index_records, remote_embedding_batch_size);+ batch_index_in_memory(index_records, remote_embedding_batch_size, true);// store only documents that were indexed in-memory successfullyfor(auto& index_record: index_records) {diff --git a/src/collection_manager.cpp b/src/collection_manager.cppindex 059af6a8..2155f2f5 100644--- a/src/collection_manager.cpp+++ b/src/collection_manager.cpp@@ -1385,7 +1385,7 @@ Option<bool> CollectionManager::load_collection(const nlohmann::json &collection// batch must match atleast the number of shardsif(exceeds_batch_mem_threshold || (num_valid_docs % batch_size == 0) || last_record) {size_t num_records = index_records.size();- size_t num_indexed = collection->batch_index_in_memory(index_records, false);+ size_t num_indexed = collection->batch_index_in_memory(index_records, 200, false);batch_doc_str_size = 0;if(num_indexed != num_records) {diff --git a/src/core_api.cpp b/src/core_api.cppindex 9918ed12..b67b6465 100644--- a/src/core_api.cpp+++ b/src/core_api.cpp@@ -943,7 +943,8 @@ bool post_add_document(const std::shared_ptr<http_req>& req, const std::shared_pnlohmann::json document;std::vector<std::string> json_lines = {req->body};- const nlohmann::json& inserted_doc_op = collection->add_many(json_lines, document, operation, "", dirty_values, false, false);+ const nlohmann::json& inserted_doc_op = collection->add_many(json_lines, document, operation, "", dirty_values,+ false, false);if(!inserted_doc_op["success"].get<bool>()) {nlohmann::json res_doc;