@@ -200,7 +200,6 @@ class TieredSVSIndex : public VecSimTieredIndex<DataType, float> {
200
200
auto batch_res = new VecSimQueryReply (allocator);
201
201
auto [from_svs, from_flat] =
202
202
merge_results<false >(batch_res->results , svs_results, flat_results, n_res);
203
- merge_results<false >(batch_res->results , svs_results, flat_results, n_res);
204
203
205
204
// We're on a single-value index, update the set of results returned from the FLAT index
206
205
// before popping them, to prevent them to be returned from the SVS index in later
@@ -536,10 +535,7 @@ class TieredSVSIndex : public VecSimTieredIndex<DataType, float> {
536
535
{
537
536
std::scoped_lock lock (this ->flatIndexGuard , this ->mainIndexGuard , this ->journal_mutex );
538
537
ret = this ->frontendIndex ->addVector (blob, label);
539
- ret -= svs_index->deleteVectors (&label, 1 );
540
- // The case when exists in both indicies (ret = 0-1) should not happen
541
- // elsewhere search queries may return wrong result.
542
- assert (ret >= 0 && " addVector: vector duplication in both indices" );
538
+ ret = std::max (ret - svs_index->deleteVectors (&label, 1 ), 0 );
543
539
journal.emplace_back (label, true );
544
540
index_update_needed = this ->backendIndex ->indexSize () > 0 ||
545
541
this ->journal .size () >= this ->updateJobThreshold ;
0 commit comments