Browse Source

set default nlist as const and update collection selector label

tumao 4 years ago
parent
commit
4690e26537

+ 2 - 0
client/src/consts/Milvus.tsx

@@ -192,3 +192,5 @@ export const DEFAULT_SEARCH_PARAM_VALUE_MAP: {
   // range: [10, 300]
   search_length: 10,
 };
+
+export const DEFAULT_NLIST_VALUE = 1024;

+ 2 - 1
client/src/pages/seach/SearchParams.tsx

@@ -6,6 +6,7 @@ import { ITextfieldConfig } from '../../components/customInput/Types';
 import CustomSelector from '../../components/customSelector/CustomSelector';
 import { Option } from '../../components/customSelector/Types';
 import {
+  DEFAULT_NLIST_VALUE,
   DEFAULT_SEARCH_PARAM_VALUE_MAP,
   INDEX_CONFIG,
   METRIC_OPTIONS_MAP,
@@ -139,7 +140,7 @@ const SearchParams: FC<SearchParamsProps> = ({
     (paramKey: searchKeywordsType): ITextfieldConfig => {
       const nlist = Number(
         // nlist range is [1, 65536], if user didn't create index, we set 1024 as default nlist value
-        indexParams.find(p => p.key === 'nlist')?.value || 1024
+        indexParams.find(p => p.key === 'nlist')?.value || DEFAULT_NLIST_VALUE
       );
 
       const configParamMap: {

+ 3 - 5
client/src/pages/seach/VectorSearch.tsx

@@ -295,11 +295,9 @@ const VectorSearch = () => {
             options={collectionOptions}
             wrapperClass={classes.selector}
             variant="filled"
-            label={
-              collectionOptions.length === 0
-                ? searchTrans('noCollection')
-                : searchTrans('collection')
-            }
+            label={searchTrans(
+              collectionOptions.length === 0 ? 'noCollection' : 'collection'
+            )}
             disabled={collectionOptions.length === 0}
             value={selectedCollection}
             onChange={(e: { target: { value: unknown } }) => {