|
@@ -24,6 +24,14 @@ const getStyles = makeStyles((theme: Theme) => ({
|
|
input: {
|
|
input: {
|
|
marginTop: theme.spacing(2),
|
|
marginTop: theme.spacing(2),
|
|
},
|
|
},
|
|
|
|
+ inlineInput: {
|
|
|
|
+ marginTop: theme.spacing(2),
|
|
|
|
+ width: '48%',
|
|
|
|
+ },
|
|
|
|
+ inlineInputWrapper: {
|
|
|
|
+ display: 'flex',
|
|
|
|
+ justifyContent: 'space-between',
|
|
|
|
+ },
|
|
}));
|
|
}));
|
|
|
|
|
|
const SearchParams: FC<SearchParamsProps> = ({
|
|
const SearchParams: FC<SearchParamsProps> = ({
|
|
@@ -46,7 +54,10 @@ const SearchParams: FC<SearchParamsProps> = ({
|
|
// search params key list, depends on index type
|
|
// search params key list, depends on index type
|
|
// e.g. ['nprobe']
|
|
// e.g. ['nprobe']
|
|
const searchParams = useMemo(
|
|
const searchParams = useMemo(
|
|
- () => (indexType !== '' ? INDEX_CONFIG[indexType].search : []),
|
|
|
|
|
|
+ (): searchKeywordsType[] =>
|
|
|
|
+ indexType !== ''
|
|
|
|
+ ? [...INDEX_CONFIG[indexType].search, 'round_decimal']
|
|
|
|
+ : ['round_decimal'],
|
|
[indexType]
|
|
[indexType]
|
|
);
|
|
);
|
|
|
|
|
|
@@ -83,7 +94,7 @@ const SearchParams: FC<SearchParamsProps> = ({
|
|
onChange: value => {
|
|
onChange: value => {
|
|
handleChange(value);
|
|
handleChange(value);
|
|
},
|
|
},
|
|
- className: classes.input,
|
|
|
|
|
|
+ className: classes.inlineInput,
|
|
variant: 'filled',
|
|
variant: 'filled',
|
|
type: 'number',
|
|
type: 'number',
|
|
value,
|
|
value,
|
|
@@ -133,7 +144,7 @@ const SearchParams: FC<SearchParamsProps> = ({
|
|
}
|
|
}
|
|
return config;
|
|
return config;
|
|
},
|
|
},
|
|
- [warningTrans, classes.input]
|
|
|
|
|
|
+ [classes.inlineInput, warningTrans]
|
|
);
|
|
);
|
|
|
|
|
|
const getSearchInputConfig = useCallback(
|
|
const getSearchInputConfig = useCallback(
|
|
@@ -146,6 +157,18 @@ const SearchParams: FC<SearchParamsProps> = ({
|
|
const configParamMap: {
|
|
const configParamMap: {
|
|
[key in searchKeywordsType]: SearchParamInputConfig;
|
|
[key in searchKeywordsType]: SearchParamInputConfig;
|
|
} = {
|
|
} = {
|
|
|
|
+ round_decimal: {
|
|
|
|
+ label: 'round_decimal',
|
|
|
|
+ key: 'round_decimal',
|
|
|
|
+ value: searchParamsForm['round_decimal'] || '',
|
|
|
|
+ min: -1,
|
|
|
|
+ max: 10,
|
|
|
|
+ isInt: true,
|
|
|
|
+ handleChange: value => {
|
|
|
|
+ handleInputChange('round_decimal', value);
|
|
|
|
+ },
|
|
|
|
+ className: classes.inlineInput,
|
|
|
|
+ },
|
|
nprobe: {
|
|
nprobe: {
|
|
label: 'nprobe',
|
|
label: 'nprobe',
|
|
key: 'nprobe',
|
|
key: 'nprobe',
|
|
@@ -156,7 +179,9 @@ const SearchParams: FC<SearchParamsProps> = ({
|
|
handleChange: value => {
|
|
handleChange: value => {
|
|
handleInputChange('nprobe', value);
|
|
handleInputChange('nprobe', value);
|
|
},
|
|
},
|
|
|
|
+ className: classes.inlineInput,
|
|
},
|
|
},
|
|
|
|
+
|
|
ef: {
|
|
ef: {
|
|
label: 'ef',
|
|
label: 'ef',
|
|
key: 'ef',
|
|
key: 'ef',
|
|
@@ -198,8 +223,9 @@ const SearchParams: FC<SearchParamsProps> = ({
|
|
},
|
|
},
|
|
[
|
|
[
|
|
indexParams,
|
|
indexParams,
|
|
- topK,
|
|
|
|
searchParamsForm,
|
|
searchParamsForm,
|
|
|
|
+ classes.inlineInput,
|
|
|
|
+ topK,
|
|
getNumberInputConfig,
|
|
getNumberInputConfig,
|
|
handleInputChange,
|
|
handleInputChange,
|
|
]
|
|
]
|
|
@@ -244,17 +270,18 @@ const SearchParams: FC<SearchParamsProps> = ({
|
|
// readOnly can't avoid all events, so we use disabled instead
|
|
// readOnly can't avoid all events, so we use disabled instead
|
|
disabled={true}
|
|
disabled={true}
|
|
/>
|
|
/>
|
|
-
|
|
|
|
- {/* dynamic params, now every type only has one param except metric type */}
|
|
|
|
- {searchParams.map(param => (
|
|
|
|
- <CustomInput
|
|
|
|
- key={param}
|
|
|
|
- type="text"
|
|
|
|
- textConfig={getSearchInputConfig(param)}
|
|
|
|
- checkValid={checkIsValid}
|
|
|
|
- validInfo={validation}
|
|
|
|
- />
|
|
|
|
- ))}
|
|
|
|
|
|
+ <div className={classes.inlineInputWrapper}>
|
|
|
|
+ {/* dynamic params, now every type only has one param except metric type */}
|
|
|
|
+ {searchParams.map(param => (
|
|
|
|
+ <CustomInput
|
|
|
|
+ key={param}
|
|
|
|
+ type="text"
|
|
|
|
+ textConfig={getSearchInputConfig(param)}
|
|
|
|
+ checkValid={checkIsValid}
|
|
|
|
+ validInfo={validation}
|
|
|
|
+ />
|
|
|
|
+ ))}
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
);
|
|
);
|
|
};
|
|
};
|