@@ -1426,18 +1426,9 @@ std::pair<uint32_t, uint32_t> Index<T, TagT, LabelT>::iterate_to_fixed_point_cal
14261426 if (!search_invocation)
14271427 {
14281428 if (!use_filter && !use_callback)
1429- {
14301429 expanded_nodes.emplace_back (nbr);
1431- }
1432- else
1433- {
1434- // in filter based indexing, the same point might invoke
1435- // multiple iterate_to_fixed_points, so need to be careful
1436- // not to add the same item to pool multiple times
1437- if (std::find (expanded_nodes.begin (), expanded_nodes.end (), nbr) == expanded_nodes.end ())
1438- {
1439- expanded_nodes.emplace_back (nbr);
1440- }
1430+ else if (std::find (expanded_nodes.begin (), expanded_nodes.end (), nbr) == expanded_nodes.end ()){
1431+ expanded_nodes.emplace_back (nbr);
14411432 }
14421433 }
14431434
@@ -1452,40 +1443,31 @@ std::pair<uint32_t, uint32_t> Index<T, TagT, LabelT>::iterate_to_fixed_point_cal
14521443
14531444 if (use_filter)
14541445 {
1455- // NOTE: NEED TO CHECK IF THIS CORRECT WITH NEW LOCKS.
14561446 if (!detect_common_filters (id, search_invocation, filter_labels))
14571447 continue ;
14581448 }
14591449 if (use_callback)
14601450 {
1461- if ( float temp_distance = _data_store->get_distance (aligned_query, id);
1462- !detect_common_callback (id, temp_distance, callback, callback_terminate))
1451+ float temp_distance = _data_store->get_distance (aligned_query, id);
1452+ if ( !detect_common_callback (id, temp_distance, callback, callback_terminate))
14631453 continue ;
14641454 }
14651455
14661456 if (is_not_visited (id))
1467- {
14681457 id_scratch.push_back (id);
1469- }
14701458 }
14711459 if (_dynamic_index)
14721460 _locks[n].unlock ();
14731461 }
14741462
1475- // Mark nodes visited
14761463 for (auto id : id_scratch)
14771464 {
14781465 if (fast_iterate)
1479- {
14801466 inserted_into_pool_bs[id] = 1 ;
1481- }
14821467 else
1483- {
14841468 inserted_into_pool_rs.insert (id);
1485- }
14861469 }
14871470
1488- // Compute distances to unvisited nodes in the expansion
14891471 if (_pq_dist)
14901472 {
14911473 assert (dist_scratch.capacity () >= id_scratch.size ());
@@ -1497,12 +1479,8 @@ std::pair<uint32_t, uint32_t> Index<T, TagT, LabelT>::iterate_to_fixed_point_cal
14971479 for (size_t m = 0 ; m < id_scratch.size (); ++m)
14981480 {
14991481 uint32_t id = id_scratch[m];
1500-
15011482 if (m + 1 < id_scratch.size ())
1502- {
1503- auto nextn = id_scratch[m + 1 ];
1504- _data_store->prefetch_vector (nextn);
1505- }
1483+ _data_store->prefetch_vector (id_scratch[m + 1 ]);
15061484
15071485 dist_scratch.push_back (_data_store->get_distance (aligned_query, id));
15081486 }
0 commit comments