Limit disk index search list range (#20104)

Signed-off-by: xige-16 <xi.ge@zilliz.com>

Signed-off-by: xige-16 <xi.ge@zilliz.com>
pull/20112/head
xige-16 2022-10-26 21:03:31 +08:00 committed by GitHub
parent 976e9940bf
commit 14968685a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -27,6 +27,9 @@ namespace milvus::index {
#ifdef BUILD_DISK_ANN
#define kSearchListMaxValue1 200 // used if tok <= 20
#define kSearchListMaxValue2 65535 // used for topk > 20
template <typename T>
VectorDiskAnnIndex<T>::VectorDiskAnnIndex(const IndexType& index_type,
const MetricType& metric_type,
@ -110,8 +113,9 @@ VectorDiskAnnIndex<T>::Query(const DatasetPtr dataset, const SearchInfo& search_
query_config.search_list_size = search_list_size.value();
AssertInfo(query_config.search_list_size > topk, "search_list should be greater than topk");
AssertInfo(query_config.search_list_size < std::min(uint32_t(topk * 10), uint32_t(65535)),
"search_list should less than min(topk*10, 65535)");
AssertInfo(query_config.search_list_size <= std::max(uint32_t(topk * 10), uint32_t(kSearchListMaxValue1)) &&
query_config.search_list_size <= uint32_t(kSearchListMaxValue2),
"search_list should be less than max(topk*10, 200) and less than 65535");
// set beamwidth
query_config.beamwidth = search_beamwidth_;