File tree 1 file changed +6
-6
lines changed
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -13,8 +13,7 @@ import { DataTypeStringEnum } from '../collections/Types';
13
13
import { generateVector } from '../../utils/Common' ;
14
14
15
15
import {
16
- FLOAT_INDEX_CONFIG ,
17
- BINARY_INDEX_CONFIG ,
16
+ INDEX_CONFIG ,
18
17
DEFAULT_SEARCH_PARAM_VALUE_MAP ,
19
18
} from '../../consts/Milvus' ;
20
19
@@ -96,10 +95,11 @@ const Preview: FC<{
96
95
const vectors = [ generateVector ( dim ) ] ;
97
96
// get search params
98
97
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 ;
103
103
const searchParamKey = indexConfig . search [ 0 ] ;
104
104
const searchParamValue = DEFAULT_SEARCH_PARAM_VALUE_MAP [ searchParamKey ] ;
105
105
const searchParam = { [ searchParamKey ] : searchParamValue } ;
You can’t perform that action at this time.
0 commit comments