Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

Change the Ef limit for HNSW when topk is large #809

Merged
merged 1 commit into from
Apr 13, 2023
Merged
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
9 changes: 8 additions & 1 deletion knowhere/index/vector_index/ConfAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,14 @@ HNSWConfAdapter::CheckTrain(Config& cfg, const IndexMode mode) {

bool
HNSWConfAdapter::CheckSearch(Config& cfg, const IndexType type, const IndexMode mode) {
CheckIntegerRange(cfg, indexparam::EF, GetMetaTopk(cfg), HNSW_MAX_EF);
auto topk = GetMetaTopk(cfg);
if (topk < HNSW_MAX_EF) {
// normal case if topk is not large
CheckIntegerRange(cfg, indexparam::EF, GetMetaTopk(cfg), HNSW_MAX_EF);
} else {
// if topk is large
CheckIntegerRange(cfg, indexparam::EF, topk, topk * 2);
}
return ConfAdapter::CheckSearch(cfg, type, mode);
}

Expand Down