Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hnsw search params for bounded queue option #3748

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion faiss/impl/HNSW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,9 @@ HNSWStats HNSW::search(
}
int k = extract_k_from_ResultHandler(res);

bool bounded_queue =
params ? params->bounded_queue : this->search_bounded_queue;

if (upper_beam == 1) {
// greedy search on upper levels
storage_idx_t nearest = entry_point;
Expand All @@ -857,7 +860,7 @@ HNSWStats HNSW::search(
}

int ef = std::max(params ? params->efSearch : efSearch, k);
if (search_bounded_queue) { // this is the most common branch
if (bounded_queue) { // this is the most common branch
MinimaxHeap candidates(ef);

candidates.push(nearest, d_nearest);
Expand Down
1 change: 1 addition & 0 deletions faiss/impl/HNSW.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ struct ResultHandler;
struct SearchParametersHNSW : SearchParameters {
int efSearch = 16;
bool check_relative_distance = true;
bool bounded_queue = true;

~SearchParametersHNSW() {}
};
Expand Down