From 11ec0c2001d9f57ad785770a639d4096a478a02f Mon Sep 17 00:00:00 2001 From: "ruiyi.jiang" Date: Mon, 16 Oct 2023 19:52:52 +0800 Subject: [PATCH] fix preview not showing after changing index api Signed-off-by: ruiyi.jiang --- client/src/pages/preview/Preview.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/client/src/pages/preview/Preview.tsx b/client/src/pages/preview/Preview.tsx index e93d15e1..67f909d6 100644 --- a/client/src/pages/preview/Preview.tsx +++ b/client/src/pages/preview/Preview.tsx @@ -74,11 +74,12 @@ const Preview: FC<{ ]; // get search params const indexesInfo = await IndexHttp.getIndexInfo(collectionName); - const indexType = - indexesInfo.length == 0 ? 'FLAT' : indexesInfo[0]._indexType; + const vectorIndex = indexesInfo.filter(i => i._fieldName === anns_field)[0]; + + const indexType = indexesInfo.length == 0 ? 'FLAT' : vectorIndex._indexType; const indexConfig = INDEX_CONFIG[indexType]; const metric_type = - indexesInfo.length === 0 ? 'L2' : indexesInfo[0]._metricType; + indexesInfo.length === 0 ? 'L2' : vectorIndex._metricType; const searchParamKey = indexConfig.search[0]; const searchParamValue = DEFAULT_SEARCH_PARAM_VALUE_MAP[searchParamKey]; const searchParam = { [searchParamKey]: searchParamValue };