Skip to content

Commit

Permalink
[fix][index] Fixed the issue that the next time you start load, the w…
Browse files Browse the repository at this point in the history
…rong metric type

is used.
  • Loading branch information
yuhaijun999 authored and ketor committed Nov 11, 2024
1 parent c147e35 commit 0d4c576
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/diskann/diskann_core.cc
Original file line number Diff line number Diff line change
Expand Up @@ -672,11 +672,12 @@ butil::Status DiskANNCore::DoLoad(const pb::common::LoadDiskAnnParam& load_param
count = count_;
metric_type = metric_type_;
dim = dimension_;
metric = metric_;
}

// garbage diskann interface. I modify diskann interface.
reader = std::make_shared<LinuxAlignedFileReader>();
flash_index = std::make_unique<diskann::PQFlashIndex<float>>(reader, metric_);
flash_index = std::make_unique<diskann::PQFlashIndex<float>>(reader, metric);

try {
index_path_prefix = index_path_prefix_;
Expand Down Expand Up @@ -813,8 +814,8 @@ butil::Status DiskANNCore::DoLoad(const pb::common::LoadDiskAnnParam& load_param
}

butil::Status DiskANNCore::DoPrepareTryLoad(const pb::common::CreateDiskAnnParam& diskann_parameter,
diskann::Metric& metric, pb::common::MetricType& metric_type, size_t& count,
size_t& dim, bool& build_with_mem_index) {
diskann::Metric& metric, const pb::common::MetricType& metric_type,
size_t& count, size_t& dim, bool& build_with_mem_index) {
auto value_type = diskann_parameter.value_type();
if (value_type == pb::common::ValueType::INT8_T) {
std::string s = "diskann value_type not support int8";
Expand Down
2 changes: 1 addition & 1 deletion src/diskann/diskann_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class DiskANNCore {
butil::Status DoLoad(const pb::common::LoadDiskAnnParam& load_param, DiskANNCoreState old_state,
DiskANNCoreState& state, bool is_try_load);
butil::Status DoPrepareTryLoad(const pb::common::CreateDiskAnnParam& diskann_parameter, diskann::Metric& metric,
pb::common::MetricType& metric_type, size_t& count, size_t& dim,
const pb::common::MetricType& metric_type, size_t& count, size_t& dim,
bool& build_with_mem_index);
butil::Status FillSearchResult(uint32_t topk, const std::vector<std::vector<float>>& distances,
const std::vector<std::vector<uint64_t>>& labels,
Expand Down

0 comments on commit 0d4c576

Please sign in to comment.