Skip to content

Commit c9b768a

Browse files
committed
Merge branch 'main' of github.com:zilliztech/attu
2 parents 5eccad6 + 7a8c218 commit c9b768a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

client/src/pages/preview/Preview.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ import { DataTypeStringEnum } from '../collections/Types';
1313
import { generateVector } from '../../utils/Common';
1414

1515
import {
16-
FLOAT_INDEX_CONFIG,
17-
BINARY_INDEX_CONFIG,
16+
INDEX_CONFIG,
1817
DEFAULT_SEARCH_PARAM_VALUE_MAP,
1918
} from '../../consts/Milvus';
2019

@@ -96,10 +95,11 @@ const Preview: FC<{
9695
const vectors = [generateVector(dim)];
9796
// get search params
9897
const indexesInfo = await IndexHttp.getIndexInfo(collectionName);
99-
const indexConfig =
100-
BINARY_INDEX_CONFIG[indexesInfo[0]._indexType] ||
101-
FLOAT_INDEX_CONFIG[indexesInfo[0]._indexType];
102-
const metric_type = indexesInfo[0]._metricType;
98+
const indexType =
99+
indexesInfo.length == 0 ? 'FLAT' : indexesInfo[0]._indexType;
100+
const indexConfig = INDEX_CONFIG[indexType];
101+
const metric_type =
102+
indexesInfo.length === 0 ? 'L2' : indexesInfo[0]._metricType;
103103
const searchParamKey = indexConfig.search[0];
104104
const searchParamValue = DEFAULT_SEARCH_PARAM_VALUE_MAP[searchParamKey];
105105
const searchParam = { [searchParamKey]: searchParamValue };

0 commit comments

Comments
 (0)