Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AnyBuildLogs/latest.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20260110-171520-4f890e5e
20260116-140907-2cca51ce
46 changes: 23 additions & 23 deletions src/index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -611,27 +611,27 @@ void Index<T, TagT, LabelT>::load(const IndexLoadParams & load_params)

size_t tags_file_num_pts = 0, graph_num_pts = 0, data_file_num_pts = 0, label_num_pts = 0;

// Use file paths from load_params if provided, otherwise derive from index_file_path
std::string labels_file = load_params.labels_file_path.empty()
? filename + "_labels.txt" : load_params.labels_file_path;
std::string labels_to_medoids = load_params.labels_to_medoids_file_path.empty()
? filename + "_labels_to_medoids.txt" : load_params.labels_to_medoids_file_path;
std::string labels_map_file = load_params.labels_map_file_path.empty()
? filename + "_labels_map.txt" : load_params.labels_map_file_path;
// Use file paths from load_params if provided and file exists, otherwise derive from index_file_path
std::string labels_file = (!load_params.labels_file_path.empty() && file_exists(load_params.labels_file_path))
? load_params.labels_file_path : filename + "_labels.txt";
std::string labels_to_medoids = (!load_params.labels_to_medoids_file_path.empty() && file_exists(load_params.labels_to_medoids_file_path))
? load_params.labels_to_medoids_file_path : filename + "_labels_to_medoids.txt";
std::string labels_map_file = (!load_params.labels_map_file_path.empty() && file_exists(load_params.labels_map_file_path))
? load_params.labels_map_file_path : filename + "_labels_map.txt";

if (!_save_as_one_file)
{
// For DLVS Store, we will not support saving the index in multiple
// files.
#ifndef EXEC_ENV_OLS
std::string data_file = load_params.data_file_path.empty()
? filename + ".data" : load_params.data_file_path;
std::string tags_file = load_params.tags_file_path.empty()
? filename + ".tags" : load_params.tags_file_path;
std::string delete_set_file = load_params.delete_set_file_path.empty()
? filename + ".del" : load_params.delete_set_file_path;
std::string graph_file = load_params.graph_file_path.empty()
? filename : load_params.graph_file_path;
std::string data_file = (!load_params.data_file_path.empty() && file_exists(load_params.data_file_path))
? load_params.data_file_path : filename + ".data";
std::string tags_file = (!load_params.tags_file_path.empty() && file_exists(load_params.tags_file_path))
? load_params.tags_file_path : filename + ".tags";
std::string delete_set_file = (!load_params.delete_set_file_path.empty() && file_exists(load_params.delete_set_file_path))
? load_params.delete_set_file_path : filename + ".del";
std::string graph_file = (!load_params.graph_file_path.empty() && file_exists(load_params.graph_file_path))
? load_params.graph_file_path : filename;
data_file_num_pts = load_data(data_file);
this->_table_stats.node_count = data_file_num_pts;
this->_table_stats.node_mem_usage = this->_data_store->get_data_size();
Expand Down Expand Up @@ -666,8 +666,8 @@ void Index<T, TagT, LabelT>::load(const IndexLoadParams & load_params)
throw diskann::ANNException(stream.str(), -1, __FUNCSIG__, __FILE__, __LINE__);
}

std::string index_seller_file = load_params.seller_file_path.empty()
? filename + "_sellers.bin" : load_params.seller_file_path;
std::string index_seller_file = (!load_params.seller_file_path.empty() && file_exists(load_params.seller_file_path))
? load_params.seller_file_path : filename + "_sellers.bin";
std::string old_index_seller_file = filename + "_sellers.txt";
if (file_exists(index_seller_file))
{
Expand Down Expand Up @@ -699,10 +699,10 @@ void Index<T, TagT, LabelT>::load(const IndexLoadParams & load_params)
_diverse_index = true;
}

std::string bitmask_label_file = load_params.bitmask_label_file_path.empty()
? filename + "_bitmask_labels.bin" : load_params.bitmask_label_file_path;
std::string integer_label_file = load_params.integer_label_file_path.empty()
? filename + "_integer_labels.bin" : load_params.integer_label_file_path;
std::string bitmask_label_file = (!load_params.bitmask_label_file_path.empty() && file_exists(load_params.bitmask_label_file_path))
? load_params.bitmask_label_file_path : filename + "_bitmask_labels.bin";
std::string integer_label_file = (!load_params.integer_label_file_path.empty() && file_exists(load_params.integer_label_file_path))
? load_params.integer_label_file_path : filename + "_integer_labels.bin";
if (file_exists(labels_file)
|| file_exists(bitmask_label_file)
|| file_exists(integer_label_file))
Expand Down Expand Up @@ -764,8 +764,8 @@ void Index<T, TagT, LabelT>::load(const IndexLoadParams & load_params)
_label_to_start_id.clear();
label_helper().load_label_medoids(labels_to_medoids, _label_to_start_id);

std::string universal_label_file = load_params.universal_label_file_path.empty()
? filename + "_universal_label.txt" : load_params.universal_label_file_path;
std::string universal_label_file = (!load_params.universal_label_file_path.empty() && file_exists(load_params.universal_label_file_path))
? load_params.universal_label_file_path : filename + "_universal_label.txt";
if (file_exists(universal_label_file))
{
std::ifstream universal_label_reader(universal_label_file);
Expand Down
Loading