From 5da64f6d5a618f72214fee6326eedb05658135c1 Mon Sep 17 00:00:00 2001 From: Patrick Weizhi Xu Date: Thu, 29 Aug 2024 14:07:01 +0800 Subject: [PATCH] feat: [2.4] support range search pagination retains order (#35739) issue: https://github.com/milvus-io/milvus/issues/35464 pr: https://github.com/milvus-io/milvus/pull/35738 --- internal/core/src/common/Consts.h | 1 + internal/core/src/index/VectorDiskIndex.cpp | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/internal/core/src/common/Consts.h b/internal/core/src/common/Consts.h index e5ee8d6765ba7..18261a0bd542b 100644 --- a/internal/core/src/common/Consts.h +++ b/internal/core/src/common/Consts.h @@ -44,6 +44,7 @@ const char OFFSET_MAPPING_NAME[] = "offset_mapping"; const char NUM_CLUSTERS[] = "num_clusters"; const char KMEANS_CLUSTER[] = "KMEANS"; const char VEC_OPT_FIELDS[] = "opt_fields"; +const char PAGE_RETAIN_ORDER[] = "page_retain_order"; const char DEFAULT_PLANNODE_ID[] = "0"; const char DEAFULT_QUERY_ID[] = "0"; diff --git a/internal/core/src/index/VectorDiskIndex.cpp b/internal/core/src/index/VectorDiskIndex.cpp index 73f8cb8b86204..c834db4451281 100644 --- a/internal/core/src/index/VectorDiskIndex.cpp +++ b/internal/core/src/index/VectorDiskIndex.cpp @@ -383,6 +383,14 @@ VectorDiskAnnIndex::Query(const DatasetPtr dataset, search_config[RANGE_FILTER], GetMetricType()); } + + auto page_retain_order = GetValueFromConfig( + search_info.search_params_, PAGE_RETAIN_ORDER); + if (page_retain_order.has_value()) { + search_config[knowhere::meta::RETAIN_ITERATOR_ORDER] = + page_retain_order.value(); + } + auto res = index_.RangeSearch(dataset, search_config, bitset); if (!res.has_value()) {