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
Fix locking test failures.
Kishore Nallan3071389648b4
diff --git a/src/collection_manager.cpp b/src/collection_manager.cppindex 70f0b998..9bc35caf 100644--- a/src/collection_manager.cpp+++ b/src/collection_manager.cpp@@ -441,9 +441,12 @@ Option<Collection*> CollectionManager::create_collection(const std::string& namereturn Option<Collection*>(fields_json_op.code(), fields_json_op.error());}+ uint32_t new_coll_id = next_collection_id;+ next_collection_id++;+nlohmann::json collection_meta;collection_meta[Collection::COLLECTION_NAME_KEY] = name;- collection_meta[Collection::COLLECTION_ID_KEY] = next_collection_id.load();+ collection_meta[Collection::COLLECTION_ID_KEY] = new_coll_id;collection_meta[Collection::COLLECTION_SEARCH_FIELDS_KEY] = fields_json;collection_meta[Collection::COLLECTION_DEFAULT_SORTING_FIELD_KEY] = default_sorting_field;collection_meta[Collection::COLLECTION_CREATED] = created_at;@@ -453,13 +456,6 @@ Option<Collection*> CollectionManager::create_collection(const std::string& namecollection_meta[Collection::COLLECTION_SEPARATORS] = token_separators;collection_meta[Collection::COLLECTION_ENABLE_NESTED_FIELDS] = enable_nested_fields;- Collection* new_collection = new Collection(name, next_collection_id, created_at, 0, store, fields,- default_sorting_field,- this->max_memory_ratio, fallback_field_type,- symbols_to_index, token_separators,- enable_nested_fields);- next_collection_id++;-rocksdb::WriteBatch batch;batch.Put(Collection::get_next_seq_id_key(name), StringUtils::serialize_uint32_t(0));batch.Put(Collection::get_meta_key(name), collection_meta.dump());@@ -471,8 +467,17 @@ Option<Collection*> CollectionManager::create_collection(const std::string& name}lock.unlock();++ Collection* new_collection = new Collection(name, new_coll_id, created_at, 0, store, fields,+ default_sorting_field,+ this->max_memory_ratio, fallback_field_type,+ symbols_to_index, token_separators,+ enable_nested_fields);+add_to_collections(new_collection);+ lock.lock();+if (referenced_in_backlog.count(name) > 0) {new_collection->add_referenced_ins(referenced_in_backlog.at(name));referenced_in_backlog.erase(name);@@ -1867,6 +1872,8 @@ Option<bool> CollectionManager::load_collection(const nlohmann::json &collectionLOG(INFO) << "Indexed " << num_indexed_docs << "/" << num_found_docs<< " documents into collection " << collection->get_name();+ collection->_get_index()->log_insert_time = true;+ collection->_get_index()->_get_facet_index()->log_insert_time = true;return Option<bool>(true);}