Skip to content

Commit 123d763

Browse files
committed
fix issue
1 parent 20136de commit 123d763

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/index.cpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2473,23 +2473,29 @@ std::pair<uint32_t, uint32_t> Index<T, TagT, LabelT>::search_with_filters(const
24732473
_data_store->preprocess_query(query, scratch);
24742474
auto retval = iterate_to_fixed_point(scratch, L, init_ids, true, filter_vec, true, maxLperSeller);
24752475

2476-
auto best_L_nodes = scratch->best_l_nodes();
2476+
NeighborPriorityQueueBase* best_L_nodes;
2477+
if (!_diverse_index) {
2478+
best_L_nodes = &(scratch->best_l_nodes());
2479+
}
2480+
else {
2481+
best_L_nodes = &(scratch->best_diverse_nodes());
2482+
}
24772483

24782484
size_t pos = 0;
2479-
for (size_t i = 0; i < best_L_nodes.size(); ++i)
2485+
for (size_t i = 0; i < best_L_nodes->size(); ++i)
24802486
{
2481-
if (best_L_nodes[i].id < _max_points)
2487+
if ((*best_L_nodes)[i].id < _max_points)
24822488
{
2483-
indices[pos] = (IdType)best_L_nodes[i].id;
2489+
indices[pos] = (IdType)(*best_L_nodes)[i].id;
24842490

24852491
if (distances != nullptr)
24862492
{
24872493
#ifdef EXEC_ENV_OLS
24882494
// DLVS expects negative distances
2489-
distances[pos] = best_L_nodes[i].distance;
2495+
distances[pos] = (*best_L_nodes)[i].distance;
24902496
#else
2491-
distances[pos] = _dist_metric == diskann::Metric::INNER_PRODUCT ? -1 * best_L_nodes[i].distance
2492-
: best_L_nodes[i].distance;
2497+
distances[pos] = _dist_metric == diskann::Metric::INNER_PRODUCT ? -1 * (*best_L_nodes)[i].distance
2498+
: (*best_L_nodes)[i].distance;
24932499
#endif
24942500
}
24952501
pos++;

0 commit comments

Comments
 (0)