Skip to content

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

Update for process_remove_field_for_embedding_fields

ozanarmagancdbe63747b0d
diff --git a/include/collection.h b/include/collection.h
index 8cc8b15a..caaf897f 100644
--- a/include/collection.h
+++ b/include/collection.h
@@ -162,7 +162,7 @@ private:
void remove_document(const nlohmann::json & document, const uint32_t seq_id, bool remove_from_store);
- std::vector<field> process_remove_field_for_embedding_fields(const field& the_field);
+ void process_remove_field_for_embedding_fields(const field& the_field, std::vector<field>& garbage_fields);
void curate_results(string& actual_query, const string& filter_query, bool enable_overrides, bool already_segmented,
const std::map<size_t, std::vector<std::string>>& pinned_hits,
diff --git a/src/collection.cpp b/src/collection.cpp
index 457e155d..a4e1a2d7 100644
--- a/src/collection.cpp
+++ b/src/collection.cpp
@@ -3765,9 +3765,7 @@ Option<bool> Collection::batch_alter_data(const std::vector<field>& alter_fields
default_sorting_field = "";
}
- auto garbage_embedding_fields = process_remove_field_for_embedding_fields(del_field);
- garbage_embedding_fields_vec.insert(garbage_embedding_fields_vec.end(), garbage_embedding_fields.begin(),
- garbage_embedding_fields.end());
+ process_remove_field_for_embedding_fields(del_field, garbage_embedding_fields_vec);
}
index->refresh_schemas({}, del_fields);
@@ -4745,8 +4743,7 @@ Option<bool> Collection::populate_include_exclude_fields_lk(const spp::sparse_ha
}
// Removes the dropped field from embed_from of all embedding fields.
-std::vector<field> Collection::process_remove_field_for_embedding_fields(const field& the_field) {
- std::vector<field> garbage_fields;
+void Collection::process_remove_field_for_embedding_fields(const field& the_field, std::vector<field>& garbage_fields) {
for(auto& field : fields) {
if(field.embed_from.empty()) {
continue;
@@ -4763,6 +4760,4 @@ std::vector<field> Collection::process_remove_field_for_embedding_fields(const f
}
}
- // return garbage embedding fields
- return garbage_fields;
}
\ No newline at end of file