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
temp.
Harpreet Sangar94add54c4354
diff --git a/include/collection.h b/include/collection.hindex f0c16236..ab847a4c 100644--- a/include/collection.h+++ b/include/collection.h@@ -466,8 +466,8 @@ public:Option<std::string> get_reference_field(const std::string & collection_name) const;Option<bool> get_reference_filter_ids(const std::string & filter_query,- const std::string & collection_name,- std::pair<uint32_t, uint32_t*>& reference_index_ids) const;+ filter_result_t& filter_result,+ const std::string & collection_name) const;Option<bool> validate_reference_filter(const std::string& filter_query) const;diff --git a/include/index.h b/include/index.hindex 92b9f7af..0ce10daf 100644--- a/include/index.h+++ b/include/index.h@@ -702,14 +702,6 @@ public:const std::string& collection_name,const std::string& reference_helper_field_name) const;- Option<bool> do_reference_filtering_with_lock(filter_node_t* const filter_tree_root,- filter_result_t& filter_result,- const std::string & reference_helper_field_name) const;-- void do_reference_filtering_with_lock(std::pair<uint32_t, uint32_t*>& reference_index_ids,- filter_node_t* filter_tree_root,- const std::string& reference_helper_field_name) const;-void refresh_schemas(const std::vector<field>& new_fields, const std::vector<field>& del_fields);// the following methods are not synchronized because their parent calls are synchronized or they are const/staticdiff --git a/src/collection.cpp b/src/collection.cppindex 1026bb54..45ae966a 100644--- a/src/collection.cpp+++ b/src/collection.cpp@@ -2601,8 +2601,8 @@ Option<std::string> Collection::get_reference_field(const std::string & collecti}Option<bool> Collection::get_reference_filter_ids(const std::string & filter_query,- const std::string & collection_name,- std::pair<uint32_t, uint32_t*>& reference_index_ids) const {+ filter_result_t& filter_result,+ const std::string & collection_name) const {auto reference_field_op = get_reference_field(collection_name);if (!reference_field_op.ok()) {return Option<bool>(reference_field_op.code(), reference_field_op.error());@@ -2612,15 +2612,18 @@ Option<bool> Collection::get_reference_filter_ids(const std::string & filter_queconst std::string doc_id_prefix = std::to_string(collection_id) + "_" + DOC_ID_PREFIX + "_";filter_node_t* filter_tree_root = nullptr;- Option<bool> filter_op = filter::parse_filter_query(filter_query, search_schema,- store, doc_id_prefix, filter_tree_root);- if(!filter_op.ok()) {- return filter_op;+ Option<bool> parse_op = filter::parse_filter_query(filter_query, search_schema,+ store, doc_id_prefix, filter_tree_root);+ if(!parse_op.ok()) {+ return parse_op;}// Reference helper field has the sequence id of other collection's documents.auto field_name = reference_field_op.get() + REFERENCE_HELPER_FIELD_SUFFIX;- index->do_reference_filtering_with_lock(reference_index_ids, filter_tree_root, field_name);+ auto filter_op = index->do_reference_filtering_with_lock(filter_tree_root, filter_result, field_name);+ if (!filter_op.ok()) {+ return filter_op;+ }delete filter_tree_root;return Option<bool>(true);@@ -3999,8 +4002,6 @@ Option<bool> Collection::prune_doc(nlohmann::json& doc,reference_docs.push_back(ref_doc);}- delete[] documents[0].second;-for (const auto &ref_doc: reference_docs) {doc.update(ref_doc);}