diff --git a/src/vector/vector_index_flat.cc b/src/vector/vector_index_flat.cc index 4668a81c7..0d76bedef 100644 --- a/src/vector/vector_index_flat.cc +++ b/src/vector/vector_index_flat.cc @@ -51,10 +51,11 @@ bvar::LatencyRecorder g_flat_range_search_latency("dingo_flat_range_search_laten bvar::LatencyRecorder g_flat_delete_latency("dingo_flat_delete_latency"); bvar::LatencyRecorder g_flat_load_latency("dingo_flat_load_latency"); -template std::vector VectorIndexFlat::GetRepeatedIds(const std::unique_ptr& ids, - size_t size); +template std::vector VectorIndexFlat::GetExistVectorIds(const std::unique_ptr& ids, + size_t size); -template std::vector VectorIndexFlat::GetRepeatedIds(const std::vector& ids, size_t size); +template std::vector VectorIndexFlat::GetExistVectorIds(const std::vector& ids, + size_t size); VectorIndexFlat::VectorIndexFlat(int64_t id, const pb::common::VectorIndexParameter& vector_index_parameter, const pb::common::RegionEpoch& epoch, const pb::common::Range& range, @@ -106,7 +107,7 @@ butil::Status VectorIndexFlat::AddOrUpsert(const std::vectorrev_map.empty()) { - std::vector internal_ids = GetRepeatedIds(ids, vector_with_ids.size()); + std::vector internal_ids = GetExistVectorIds(ids, vector_with_ids.size()); if (!internal_ids.empty()) { faiss::IDSelectorBatch sel(internal_ids.size(), internal_ids.data()); @@ -139,7 +140,7 @@ butil::Status VectorIndexFlat::Delete(const std::vector& delete_ids) { // delete id exists. if (!index_id_map2_->rev_map.empty()) { - std::vector internal_ids = GetRepeatedIds(delete_ids, delete_ids.size()); + std::vector internal_ids = GetExistVectorIds(delete_ids, delete_ids.size()); if (!internal_ids.empty()) { faiss::IDSelectorBatch sel(internal_ids.size(), internal_ids.data()); @@ -266,9 +267,7 @@ butil::Status VectorIndexFlat::Save(const std::string& path) { try { faiss::write_index(index_id_map2_.get(), path.c_str()); } catch (std::exception& e) { - DINGO_LOG(ERROR) << fmt::format("[vector_index.flat][id({})] write index failed, exception: {} path: {}", Id(), - e.what(), path); - return butil::Status(pb::error::Errno::EINTERNAL, fmt::format("write index exception: ", e.what())); + return butil::Status(pb::error::Errno::EINTERNAL, fmt::format("write index exception: {}", e.what())); } return butil::Status(); @@ -287,7 +286,7 @@ butil::Status VectorIndexFlat::Load(const std::string& path) { internal_raw_index = faiss::read_index(path.c_str(), 0); } catch (std::exception& e) { delete internal_raw_index; - return butil::Status(pb::error::Errno::EINTERNAL, fmt::format("read index exception: {}", path, e.what())); + return butil::Status(pb::error::Errno::EINTERNAL, fmt::format("read index exception: {} {}", path, e.what())); } faiss::IndexIDMap2* internal_index = dynamic_cast(internal_raw_index); @@ -437,7 +436,7 @@ void VectorIndexFlat::DoRangeSearch(faiss::idx_t n, const faiss::Index::componen } template -std::vector VectorIndexFlat::GetRepeatedIds(const T& ids, size_t size) { +std::vector VectorIndexFlat::GetExistVectorIds(const T& ids, size_t size) { std::vector internal_ids; internal_ids.reserve(size); for (int i = 0; i < size; i++) { diff --git a/src/vector/vector_index_flat.h b/src/vector/vector_index_flat.h index 0e5d2b7c2..e4464076d 100644 --- a/src/vector/vector_index_flat.h +++ b/src/vector/vector_index_flat.h @@ -122,7 +122,7 @@ class VectorIndexFlat : public VectorIndex { faiss::RangeSearchResult* result, std::vector> filters); template - std::vector GetRepeatedIds(const T& ids, size_t size); + std::vector GetExistVectorIds(const T& ids, size_t size); // Dimension of the elements faiss::idx_t dimension_; diff --git a/src/vector/vector_index_ivf_flat.cc b/src/vector/vector_index_ivf_flat.cc index d1e728c89..22d3dba62 100644 --- a/src/vector/vector_index_ivf_flat.cc +++ b/src/vector/vector_index_ivf_flat.cc @@ -315,9 +315,7 @@ butil::Status VectorIndexIvfFlat::Save(const std::string& path) { try { faiss::write_index(index_.get(), path.c_str()); } catch (std::exception& e) { - DINGO_LOG(ERROR) << fmt::format("[vector_index.ivf_flat][id({})] write index failed, exception: {} path: {}", Id(), - e.what(), path); - return butil::Status(pb::error::Errno::EINTERNAL, fmt::format("write index exception: ", e.what())); + return butil::Status(pb::error::Errno::EINTERNAL, fmt::format("write index exception: {}", e.what())); } return butil::Status(); diff --git a/src/vector/vector_index_ivf_pq.cc b/src/vector/vector_index_ivf_pq.cc index 435dba706..0f5d9031c 100644 --- a/src/vector/vector_index_ivf_pq.cc +++ b/src/vector/vector_index_ivf_pq.cc @@ -521,8 +521,6 @@ bool VectorIndexIvfPq::IsTrainedImpl() { is_trained = false; } - DINGO_LOG(DEBUG) << fmt::format("[vector_index.ivf_pq][id({})] is train {}", Id(), is_trained); - return is_trained; } diff --git a/src/vector/vector_index_raw_ivf_pq.cc b/src/vector/vector_index_raw_ivf_pq.cc index c04056c5f..cbf185c6e 100644 --- a/src/vector/vector_index_raw_ivf_pq.cc +++ b/src/vector/vector_index_raw_ivf_pq.cc @@ -238,8 +238,7 @@ butil::Status VectorIndexRawIvfPq::RangeSearch(const std::vector(internal_raw_index); @@ -578,7 +575,6 @@ bool VectorIndexRawIvfPq::IsTrainedImpl() { ? index_->is_trained : false; - DINGO_LOG(DEBUG) << fmt::format("[vector_index.raw_ivf_pq][id({})] is train {}", Id(), is_trained); return is_trained; }