-
Notifications
You must be signed in to change notification settings - Fork 0
add enable brute force search #7
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
base: main
Are you sure you want to change the base?
Changes from all commits
df2100b
6424911
b2ea426
0c3a1db
d5dcd3d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,6 +39,14 @@ WhetherPerformBruteForceSearch(const faiss::Index* index, const BaseConfig& cfg, | |
| return std::nullopt; | ||
| } | ||
|
|
||
| // an explicit user request to force brute force overrides the heuristics below | ||
| const auto* hnsw_cfg = dynamic_cast<const BaseHnswConfig*>(&cfg); | ||
| if (hnsw_cfg != nullptr && hnsw_cfg->force_brute_force.value_or(false)) { | ||
| LOG_KNOWHERE_INFO_ << "force_brute_force enabled: bypassing HNSW graph traversal for exhaustive search (k=" | ||
| << cfg.k.value() << ", ntotal=" << index->ntotal << ")"; | ||
|
Comment on lines
+45
to
+46
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we may not want to log info for every request. maybe debug?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is only when brute force is enabled with the flag. I can set to debug after some more testing |
||
| return true; | ||
| } | ||
|
|
||
| // decide | ||
| const auto k = cfg.k.value(); | ||
|
|
||
|
|
@@ -72,6 +80,14 @@ WhetherPerformBruteForceRangeSearch(const faiss::Index* index, const FaissHnswCo | |
| return std::nullopt; | ||
| } | ||
|
|
||
| // an explicit user request to force brute force overrides the heuristics below | ||
| if (cfg.force_brute_force.has_value() && cfg.force_brute_force.value_or(false)) { | ||
| LOG_KNOWHERE_INFO_ | ||
| << "force_brute_force enabled: bypassing HNSW graph traversal for exhaustive range search (ef=" | ||
| << cfg.ef.value() << ", ntotal=" << index->ntotal << ")"; | ||
| return true; | ||
| } | ||
|
|
||
| // decide | ||
| const auto ef = cfg.ef.value(); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe debug? but up to you