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
Merge branch 'v0.25-join' into v0.26-facets
Kishore Nallan7ac12c03576a
diff --cc include/collection.hindex b101a818,cb816e25..bc949e61--- a/include/collection.h+++ b/include/collection.h@@@ -649,30 -580,7 +650,32 @@@ publicOption<bool> truncate_after_top_k(const std::string& field_name, size_t k);+ void reference_populate_sort_mapping(int* sort_order, std::vector<size_t>& geopoint_indices,+ std::vector<sort_by>& sort_fields_std,+ std::array<spp::sparse_hash_map<uint32_t, int64_t, Hasher32>*, 3>& field_values) const;++ int64_t reference_string_sort_score(const std::string& field_name, const uint32_t& seq_id) const;++ bool is_referenced_in(const std::string& collection_name) const;++ void add_referenced_in(const reference_pair& pair);++ void add_referenced_ins(const std::set<reference_pair>& pairs);++ void add_referenced_in(const std::string& collection_name, const std::string& field_name);++ Option<std::string> get_referenced_in_field_with_lock(const std::string& collection_name) const;++ Option<bool> get_related_ids_with_lock(const std::string& field_name, const uint32_t& seq_id,+ std::vector<uint32_t>& result) const;++ Option<uint32_t> get_sort_index_value_with_lock(const std::string& field_name, const uint32_t& seq_id) const;++ static void hide_credential(nlohmann::json& json, const std::string& credential_name);++ friend class filter_result_iterator_t;+++ std::shared_mutex& get_lifecycle_mutex();};template<class T>diff --cc include/raft_server.hindex 0c0035ec,98f77d4d..6dbd2eb8--- a/include/raft_server.h+++ b/include/raft_server.h@@@ -241,8 -239,8 +241,10 @@@ publicstd::string get_leader_url() const;+ static Option<bool> handle_gzip(const std::shared_ptr<http_req>& request);++ void decr_pending_writes();+private:friend class ReplicationClosure;diff --cc src/collection.cppindex 694ea1bb,f18adb03..592344fe--- a/src/collection.cpp+++ b/src/collection.cpp@@@ -6202,66 -5195,10 +6202,71 @@@ Option<bool> Collection::truncate_afterreturn Option<bool>(true);}++<<<<<<< HEAD+void Collection::reference_populate_sort_mapping(int *sort_order, std::vector<size_t> &geopoint_indices,+ std::vector<sort_by> &sort_fields_std,+ std::array<spp::sparse_hash_map<uint32_t, int64_t, Hasher32> *, 3> &field_values)+ const {+ std::shared_lock lock(mutex);+ index->populate_sort_mapping_with_lock(sort_order, geopoint_indices, sort_fields_std, field_values);+}++int64_t Collection::reference_string_sort_score(const string &field_name, const uint32_t& seq_id) const {+ std::shared_lock lock(mutex);+ return index->reference_string_sort_score(field_name, seq_id);+}++bool Collection::is_referenced_in(const std::string& collection_name) const {+ std::shared_lock lock(mutex);+ return referenced_in.count(collection_name) > 0;+}++void Collection::add_referenced_in(const reference_pair& pair) {+ return add_referenced_in(pair.collection, pair.field);+}++void Collection::add_referenced_ins(const std::set<reference_pair>& pairs) {+ std::shared_lock lock(mutex);+ for (const auto &pair: pairs) {+ referenced_in.emplace(pair.collection, pair.field);+ }+}++void Collection::add_referenced_in(const std::string& collection_name, const std::string& field_name) {+ std::shared_lock lock(mutex);+ referenced_in.emplace(collection_name, field_name);+}++Option<std::string> Collection::get_referenced_in_field_with_lock(const std::string& collection_name) const {+ std::shared_lock lock(mutex);+ return get_referenced_in_field(collection_name);+}++Option<std::string> Collection::get_referenced_in_field(const std::string& collection_name) const {+ if (referenced_in.count(collection_name) == 0) {+ return Option<std::string>(400, "Could not find any field in `" + name + "` referencing the collection `"+ + collection_name + "`.");+ }++ return Option<std::string>(referenced_in.at(collection_name));+}++Option<bool> Collection::get_related_ids_with_lock(const std::string& field_name, const uint32_t& seq_id,+ std::vector<uint32_t>& result) const {+ std::shared_lock lock(mutex);+ return index->get_related_ids(name, field_name, seq_id, result);+}++Option<uint32_t> Collection::get_sort_index_value_with_lock(const std::string& field_name,+ const uint32_t& seq_id) const {+ std::shared_lock lock(mutex);+ return index->get_sort_index_value_with_lock(name, field_name, seq_id);+}++ std::shared_mutex& Collection::get_lifecycle_mutex() {+ return lifecycle_mutex;+ }+void Collection::remove_embedding_field(const std::string& field_name) {if(embedding_fields.find(field_name) == embedding_fields.end()) {return;diff --cc src/collection_manager.cppindex 5739953e,971072eb..70f0b998--- a/src/collection_manager.cpp+++ b/src/collection_manager.cpp@@@ -470,13 -420,9 +470,14 @@@ Option<Collection*> CollectionManager::return Option<Collection*>(500, "Could not write to on-disk storage.");}+ lock.unlock();add_to_collections(new_collection);+ if (referenced_in_backlog.count(name) > 0) {+ new_collection->add_referenced_ins(referenced_in_backlog.at(name));+ referenced_in_backlog.erase(name);+ }+return Option<Collection*>(new_collection);}