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

Commit

Permalink
Add existence&type check for K (#603)
Browse files Browse the repository at this point in the history
Signed-off-by: liliu-z <[email protected]>

Signed-off-by: liliu-z <[email protected]>
  • Loading branch information
liliu-z authored Dec 14, 2022
1 parent d0b0c4b commit dfdaafa
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions knowhere/index/vector_index/ConfAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ ConfAdapter::CheckTrain(Config& cfg, const IndexMode mode) {

bool
ConfAdapter::CheckSearch(Config& cfg, const IndexType type, const IndexMode mode) {
std::string key = meta::TOPK;
if (!cfg.contains(key)) {
KNOWHERE_THROW_FORMAT("Param '%s' not exist", key.data());
}
if (!cfg[key].is_number_integer()) {
KNOWHERE_THROW_FORMAT("Param '%s' should be an integer", key.data());
}
return true;
}

Expand All @@ -102,8 +109,8 @@ ConfAdapter::CheckRangeSearch(Config& cfg, const IndexType type, const IndexMode
float low_bound = GetValueFromConfig<float>(cfg, meta::RADIUS_LOW_BOUND);
float high_bound = GetValueFromConfig<float>(cfg, meta::RADIUS_HIGH_BOUND);
if (low_bound >= high_bound) {
KNOWHERE_THROW_FORMAT("Param 'RADIUS_LOW_BOUND'(%f) must be smaller than 'RADIUS_HIGH_BOUND'(%f)",
low_bound, high_bound);
KNOWHERE_THROW_FORMAT("Param 'RADIUS_LOW_BOUND'(%f) must be smaller than 'RADIUS_HIGH_BOUND'(%f)", low_bound,
high_bound);
}
return true;
}
Expand Down

0 comments on commit dfdaafa

Please sign in to comment.