Skip to content
Open
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
6 changes: 3 additions & 3 deletions src/core/algorithm/diskann/diskann_indexer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ int DiskAnnIndexer::cached_beam_search_by_group(DiskAnnContext *ctx) {
group_topk_heap.limit(ctx->group_topk());
}

topk_heap.emplace(id, info);
group_topk_heap.emplace(id, info);
}

// stage 2, expand to reach group num as possible
Expand Down Expand Up @@ -1106,7 +1106,7 @@ int DiskAnnIndexer::cached_beam_search_by_group(DiskAnnContext *ctx) {
group_topk_heap.limit(ctx->group_topk());
}

group_topk_heap.emplace_back(
group_topk_heap.emplace(
std::get<0>(cached_neighbor),
VectorInfo(cur_expanded_dist,
make_vector_copy(node_fp_coords_copy)));
Expand Down Expand Up @@ -1160,7 +1160,7 @@ int DiskAnnIndexer::cached_beam_search_by_group(DiskAnnContext *ctx) {
group_topk_heap.limit(ctx->group_topk());
}

group_topk_heap.emplace_back(
group_topk_heap.emplace(
frontier_neighbor.first,
VectorInfo(cur_expanded_dist, make_vector_copy(data_buf)));

Expand Down
6 changes: 3 additions & 3 deletions src/core/algorithm/hnsw/hnsw_algorithm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ void HnswAlgorithm<EntityType>::expand_neighbors_by_group(
if (topk_heap.empty()) {
topk_heap.limit(ctx->group_topk());
}
topk_heap.emplace_back(id, score);
topk_heap.emplace(id, score);
}

// stage 2, expand to reach group num as possible
Expand All @@ -492,7 +492,7 @@ void HnswAlgorithm<EntityType>::expand_neighbors_by_group(
float score = topk[i].second;

visit.set_visited(id);
candidates.emplace_back(id, score);
candidates.emplace(id, score);
}

// do expand
Expand Down Expand Up @@ -551,7 +551,7 @@ void HnswAlgorithm<EntityType>::expand_neighbors_by_group(
if (topk_heap.empty()) {
topk_heap.limit(ctx->group_topk());
}
topk_heap.emplace_back(node, cur_dist);
topk_heap.emplace(node, cur_dist);

if (group_topk_heaps.size() >= ctx->group_num()) {
break;
Expand Down
6 changes: 3 additions & 3 deletions src/core/algorithm/hnsw/hnsw_streamer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ int HnswStreamer::search_bf_impl(
if (topk_heap.empty()) {
topk_heap.limit(ctx->group_topk());
}
topk_heap.emplace_back(id, dist);
topk_heap.emplace(id, dist);
}
}
ctx->topk_to_result(q);
Expand Down Expand Up @@ -884,7 +884,7 @@ int HnswStreamer::search_bf_by_p_keys_impl(
if (topk_heap.empty()) {
topk_heap.limit(ctx->group_topk());
}
topk_heap.emplace_back(id, dist);
topk_heap.emplace(id, dist);
}
}
}
Expand Down Expand Up @@ -924,4 +924,4 @@ int HnswStreamer::search_bf_by_p_keys_impl(
INDEX_FACTORY_REGISTER_STREAMER(HnswStreamer);

} // namespace core
} // namespace zvec
} // namespace zvec
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ void HnswRabitqQueryAlgorithm::expand_neighbors_by_group(
if (topk_heap.empty()) {
topk_heap.limit(ctx->group_topk());
}
topk_heap.emplace_back(id, score);
topk_heap.emplace(id, score);
}

// stage 2, expand to reach group num as possible
Expand All @@ -245,7 +245,7 @@ void HnswRabitqQueryAlgorithm::expand_neighbors_by_group(
auto score = topk[i].second;

visit.set_visited(id);
candidates.emplace_back(id, score);
candidates.emplace(id, score);
}

// do expand
Expand Down Expand Up @@ -291,7 +291,7 @@ void HnswRabitqQueryAlgorithm::expand_neighbors_by_group(
if (topk_heap.empty()) {
topk_heap.limit(ctx->group_topk());
}
topk_heap.emplace_back(node, ResultRecord(candest));
topk_heap.emplace(node, ResultRecord(candest));

if (group_topk_heaps.size() >= ctx->group_num()) {
break;
Expand Down
4 changes: 2 additions & 2 deletions src/core/algorithm/hnsw_rabitq/hnsw_rabitq_streamer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ int HnswRabitqStreamer::search_bf_impl(
if (topk_heap.empty()) {
topk_heap.limit(ctx->group_topk());
}
topk_heap.emplace_back(id, dist);
topk_heap.emplace(id, dist);
}
}
ctx->topk_to_result(q);
Expand Down Expand Up @@ -950,7 +950,7 @@ int HnswRabitqStreamer::search_bf_by_p_keys_impl(
if (topk_heap.empty()) {
topk_heap.limit(ctx->group_topk());
}
topk_heap.emplace_back(id, dist);
topk_heap.emplace(id, dist);
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/core/algorithm/hnsw_sparse/hnsw_sparse_algorithm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ void HnswSparseAlgorithm::expand_neighbors_by_group(
if (topk_heap.empty()) {
topk_heap.limit(ctx->group_topk());
}
topk_heap.emplace_back(id, score);
topk_heap.emplace(id, score);
}

// stage 2, expand to reach group num as possible
Expand All @@ -325,7 +325,7 @@ void HnswSparseAlgorithm::expand_neighbors_by_group(
float score = topk[i].second;

visit.set_visited(id);
candidates.emplace_back(id, score);
candidates.emplace(id, score);
}

// do expand
Expand Down Expand Up @@ -382,7 +382,7 @@ void HnswSparseAlgorithm::expand_neighbors_by_group(
if (topk_heap.empty()) {
topk_heap.limit(ctx->group_topk());
}
topk_heap.emplace_back(node, cur_dist);
topk_heap.emplace(node, cur_dist);

if (group_topk_heaps.size() >= ctx->group_num()) {
break;
Expand Down Expand Up @@ -521,4 +521,4 @@ void HnswSparseAlgorithm::reverse_update_neighbors(HnswSparseDistCalculator &dc,
}

} // namespace core
} // namespace zvec
} // namespace zvec
4 changes: 2 additions & 2 deletions src/core/algorithm/hnsw_sparse/hnsw_sparse_searcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ int HnswSparseSearcher::search_bf_impl(
if (topk_heap.empty()) {
topk_heap.limit(ctx->group_topk());
}
topk_heap.emplace_back(id, dist);
topk_heap.emplace(id, dist);
}
}
ctx->topk_to_result(q);
Expand Down Expand Up @@ -459,7 +459,7 @@ int HnswSparseSearcher::search_bf_by_p_keys_impl(
if (topk_heap.empty()) {
topk_heap.limit(ctx->group_topk());
}
topk_heap.emplace_back(id, dist);
topk_heap.emplace(id, dist);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/algorithm/hnsw_sparse/hnsw_sparse_streamer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ int HnswSparseStreamer::search_bf_impl(
if (topk_heap.empty()) {
topk_heap.limit(ctx->group_topk());
}
topk_heap.emplace_back(id, dist);
topk_heap.emplace(id, dist);
}
}
ctx->topk_to_result(q);
Expand Down Expand Up @@ -889,7 +889,7 @@ int HnswSparseStreamer::search_bf_by_p_keys_impl(
if (topk_heap.empty()) {
topk_heap.limit(ctx->group_topk());
}
topk_heap.emplace_back(id, dist);
topk_heap.emplace(id, dist);
}
}
}
Expand Down