Browse Source

ragne filter part1

Signed-off-by: ruiyi.jiang <ruiyi.jiang@zilliz.com>
ruiyi.jiang 1 year ago
parent
commit
82182c4ddd
2 changed files with 38 additions and 4 deletions
  1. 5 1
      client/src/consts/Milvus.ts
  2. 33 3
      client/src/pages/search/SearchParams.tsx

+ 5 - 1
client/src/consts/Milvus.ts

@@ -66,7 +66,9 @@ export type searchKeywordsType =
   | 'search_length'
   | 'round_decimal'
   | 'level'
-  | 'search_list';
+  | 'search_list'
+  | 'range'
+  | 'range_filter';
 
 export type indexConfigType = {
   [x: string]: {
@@ -222,6 +224,8 @@ export const DEFAULT_SEARCH_PARAM_VALUE_MAP: {
   round_decimal: -1,
   level: 1,
   search_list: 20,
+  range: 20,
+  range_filter: 10
 };
 
 export const DEFAULT_NLIST_VALUE = 1024;

+ 33 - 3
client/src/pages/search/SearchParams.tsx

@@ -66,9 +66,15 @@ const SearchParams: FC<SearchParamsProps> = ({
           'warning'
         );
     }
+
+    const commonParams: searchKeywordsType[] = [
+      'range',
+      'range_filter',
+      'round_decimal',
+    ];
     return indexType !== '' && isSupportedType
-      ? [...INDEX_CONFIG[indexType].search, 'round_decimal']
-      : ['round_decimal'];
+      ? [...INDEX_CONFIG[indexType].search, ...commonParams]
+      : commonParams;
   }, [indexType, openSnackBar, warningTrans]);
 
   const handleInputChange = useCallback(
@@ -168,7 +174,7 @@ const SearchParams: FC<SearchParamsProps> = ({
         [key in searchKeywordsType]: SearchParamInputConfig;
       } = {
         round_decimal: {
-          label: 'Round Decimals',
+          label: 'Round',
           key: 'round_decimal',
           value: searchParamsForm['round_decimal'] || '',
           min: -1,
@@ -191,6 +197,30 @@ const SearchParams: FC<SearchParamsProps> = ({
           },
           className: classes.inlineInput,
         },
+        range: {
+          label: 'range',
+          key: 'range',
+          value: searchParamsForm['range'] || '',
+          min: 1,
+          max: 500,
+          isInt: false,
+          handleChange: value => {
+            handleInputChange('range', Number(value));
+          },
+          className: classes.inlineInput,
+        },
+        range_filter: {
+          label: 'range_filter',
+          key: 'range_filter',
+          value: searchParamsForm['range_filter'] || '',
+          min: 1,
+          max: 500,
+          isInt: false,
+          handleChange: value => {
+            handleInputChange('range_filter', Number(value));
+          },
+          className: classes.inlineInput,
+        },
         ef: {
           label: 'ef',
           key: 'ef',