Skip to content

Commit 8bc7804

Browse files
junjieqifacebook-github-bot
authored andcommitted
Let IndexShards Pass down SearchParams (#4387)
Summary: Pull Request resolved: #4387 IndexShards could come in handy for index delta update. But currently it doesn't support search params, which looks like a decision from the beginning. From the implementation of IndexShards, it looks like there' no issue passing params down? Reviewed By: mdouze Differential Revision: D74765843 fbshipit-source-id: bf471490ba1c2d848475b0e3832348af5143bc80
1 parent 8c1b745 commit 8bc7804

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

faiss/IndexShards.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,6 @@ void IndexShardsTemplate<IndexT>::search(
199199
distance_t* distances,
200200
idx_t* labels,
201201
const SearchParameters* params) const {
202-
FAISS_THROW_IF_NOT_MSG(
203-
!params, "search params not supported for this index");
204202
FAISS_THROW_IF_NOT(k > 0);
205203

206204
int64_t nshard = this->count();
@@ -219,7 +217,7 @@ void IndexShardsTemplate<IndexT>::search(
219217
}
220218
}
221219

222-
auto fn = [n, k, x, &all_distances, &all_labels, &translations](
220+
auto fn = [n, k, x, params, &all_distances, &all_labels, &translations](
223221
int no, const IndexT* index) {
224222
if (index->verbose) {
225223
printf("begin query shard %d on %" PRId64 " points\n", no, n);
@@ -230,7 +228,8 @@ void IndexShardsTemplate<IndexT>::search(
230228
x,
231229
k,
232230
all_distances.data() + no * k * n,
233-
all_labels.data() + no * k * n);
231+
all_labels.data() + no * k * n,
232+
params);
234233

235234
translate_labels(
236235
n * k, all_labels.data() + no * k * n, translations[no]);

0 commit comments

Comments
 (0)