@@ -189,6 +189,7 @@ void estimators_from_tables_generic(
189189 dt += index.ksub ;
190190 }
191191 }
192+
192193 if (C::cmp (heap_dis[0 ], dis)) {
193194 heap_pop<C>(k, heap_dis, heap_ids);
194195 heap_push<C>(k, heap_dis, heap_ids, dis, j);
@@ -203,17 +204,18 @@ ResultHandlerCompare<C, false>* make_knn_handler(
203204 idx_t k,
204205 size_t ntotal,
205206 float * distances,
206- idx_t * labels) {
207+ idx_t * labels,
208+ const IDSelector* sel = nullptr ) {
207209 using HeapHC = HeapHandler<C, false >;
208210 using ReservoirHC = ReservoirHandler<C, false >;
209211 using SingleResultHC = SingleResultHandler<C, false >;
210212
211213 if (k == 1 ) {
212- return new SingleResultHC (n, ntotal, distances, labels);
214+ return new SingleResultHC (n, ntotal, distances, labels, sel );
213215 } else if (impl % 2 == 0 ) {
214- return new HeapHC (n, ntotal, k, distances, labels);
216+ return new HeapHC (n, ntotal, k, distances, labels, sel );
215217 } else /* if (impl % 2 == 1) */ {
216- return new ReservoirHC (n, ntotal, k, 2 * k, distances, labels);
218+ return new ReservoirHC (n, ntotal, k, 2 * k, distances, labels, sel );
217219 }
218220}
219221
0 commit comments