diff --git a/include/collection.h b/include/collection.h index ca14a4d1..32ece94d 100644 --- a/include/collection.h +++ b/include/collection.h @@ -183,7 +183,7 @@ private: bool& found_highlight, bool& found_full_highlight) const; - void remove_document(const nlohmann::json & document, const uint32_t seq_id, bool remove_from_store); + void remove_document(nlohmann::json & document, const uint32_t seq_id, bool remove_from_store); void process_remove_field_for_embedding_fields(const field& del_field, std::vector& garbage_embed_fields); diff --git a/include/index.h b/include/index.h index 5c9d9be3..1b730535 100644 --- a/include/index.h +++ b/include/index.h @@ -706,10 +706,10 @@ public: bool enable_typos_for_alpha_numerical_tokens = true ) const; - void remove_field(uint32_t seq_id, const nlohmann::json& document, const std::string& field_name, + void remove_field(uint32_t seq_id, nlohmann::json& document, const std::string& field_name, const bool is_update); - Option remove(const uint32_t seq_id, const nlohmann::json & document, + Option remove(const uint32_t seq_id, nlohmann::json & document, const std::vector& del_fields, const bool is_update); static void validate_and_preprocess(Index *index, std::vector& iter_batch, diff --git a/src/collection.cpp b/src/collection.cpp index 3c282e67..381239c7 100644 --- a/src/collection.cpp +++ b/src/collection.cpp @@ -4460,7 +4460,7 @@ Option Collection::get(const std::string & id) const { return Option(document); } -void Collection::remove_document(const nlohmann::json & document, const uint32_t seq_id, bool remove_from_store) { +void Collection::remove_document(nlohmann::json & document, const uint32_t seq_id, bool remove_from_store) { const std::string& id = document["id"]; { diff --git a/src/index.cpp b/src/index.cpp index e1751987..074d7084 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -555,16 +555,17 @@ void Index::validate_and_preprocess(Index *index, size_t Index:: batch_memory_index(Index *index, - std::vector& iter_batch, - const std::string & default_sorting_field, - const tsl::htrie_map & actual_search_schema, - const tsl::htrie_map & embedding_fields, - const std::string& fallback_field_type, - const std::vector& token_separators, - const std::vector& symbols_to_index, - const bool do_validation, const size_t remote_embedding_batch_size, - const size_t remote_embedding_timeout_ms, const size_t remote_embedding_num_tries, const bool generate_embeddings, - const bool use_addition_fields, const tsl::htrie_map& addition_fields) { + std::vector& iter_batch, + const std::string & default_sorting_field, + const tsl::htrie_map & actual_search_schema, + const tsl::htrie_map & embedding_fields, + const std::string& fallback_field_type, + const std::vector& token_separators, + const std::vector& symbols_to_index, + const bool do_validation, const size_t remote_embedding_batch_size, + const size_t remote_embedding_timeout_ms, const size_t remote_embedding_num_tries, + const bool generate_embeddings, + const bool use_addition_fields, const tsl::htrie_map& addition_fields) { const size_t concurrency = 4; const size_t num_threads = std::min(concurrency, iter_batch.size()); const size_t window_size = (num_threads == 0) ? 0 : @@ -6733,7 +6734,7 @@ void Index::remove_facet_token(const field& search_field, spp::sparse_hash_map tokens; @@ -6892,7 +6900,7 @@ void Index::remove_field(uint32_t seq_id, const nlohmann::json& document, const } } -Option Index::remove(const uint32_t seq_id, const nlohmann::json & document, +Option Index::remove(const uint32_t seq_id, nlohmann::json & document, const std::vector& del_fields, const bool is_update) { std::unique_lock lock(mutex);