diff --git a/client/src/consts/Milvus.ts b/client/src/consts/Milvus.ts index a5f674dc..5c106dd4 100644 --- a/client/src/consts/Milvus.ts +++ b/client/src/consts/Milvus.ts @@ -121,7 +121,12 @@ export type searchKeywordsType = | 'radius' | 'range_filter' | 'drop_ratio_search' - | 'filter'; + | 'filter' + | 'itopk_size' + | 'search_width' + | 'min_iterations' + | 'max_iterations' + | 'team_size'; export type indexConfigType = { [x: string]: { @@ -132,9 +137,13 @@ export type indexConfigType = { // index export const FLOAT_INDEX_CONFIG: indexConfigType = { - SCANN: { - create: ['nlist', 'with_raw_data'], - search: ['nprobe'], + AUTOINDEX: { + create: [], + search: ['level'], + }, + HNSW: { + create: ['M', 'efConstruction'], + search: ['ef'], }, IVF_FLAT: { create: ['nlist'], @@ -152,22 +161,50 @@ export const FLOAT_INDEX_CONFIG: indexConfigType = { create: [], search: ['nprobe'], }, - HNSW: { - create: ['M', 'efConstruction'], - search: ['ef'], - }, - AUTOINDEX: { - create: [], - search: ['level'], + SCANN: { + create: ['nlist', 'with_raw_data'], + search: ['nprobe'], }, +}; + +export const DISK_INDEX_CONFIG: indexConfigType = { DISKANN: { create: [], search: ['search_list'], }, }; +export const GPU_INDEX_CONFIG: indexConfigType = { + GPU_CAGRA: { + create: [ + 'intermediate_graph_degree', + 'graph_degree', + 'build_algo', + 'cache_dataset_on_device', + ], + search: [ + 'itopk_size', + 'search_width', + 'min_iterations', + 'max_iterations', + 'team_size', + ], + }, + GPU_IVF_FLAT: { + create: ['nlist'], + search: ['nprobe'], + }, + GPU_IVF_PQ: { + create: ['nlist', 'm', 'nbits'], + search: ['nprobe'], + }, + GPU_BRUTE_FORCE: { + create: [], + search: [], + }, +}; + export const BINARY_INDEX_CONFIG: indexConfigType = { - // }, BIN_FLAT: { create: [], search: [], @@ -193,6 +230,8 @@ export const INDEX_CONFIG: indexConfigType = { ...FLOAT_INDEX_CONFIG, ...BINARY_INDEX_CONFIG, ...SPARSE_INDEX_CONFIG, + ...DISK_INDEX_CONFIG, + ...GPU_INDEX_CONFIG, }; export const COLLECTION_NAME_REGX = /^[0-9,a-z,A-Z$_]+$/; @@ -224,6 +263,14 @@ export const INDEX_OPTIONS_MAP = { value: INDEX_TYPES_ENUM.MARISA_TRIE, }, ], + ['DISK']: Object.keys(DISK_INDEX_CONFIG).map(v => ({ + label: v, + value: v, + })), + ['GPU']: Object.keys(GPU_INDEX_CONFIG).map(v => ({ + label: v, + value: v, + })), }; // search params default value map diff --git a/client/src/i18n/cn/index.ts b/client/src/i18n/cn/index.ts index 86b9274c..d05f0e58 100644 --- a/client/src/i18n/cn/index.ts +++ b/client/src/i18n/cn/index.ts @@ -1,6 +1,10 @@ const indexTrans = { type: '索引类型', param: '索引参数', + inMemory: '内存索引', + disk: '磁盘索引', + gpu: 'GPU索引', + scalar: '标量索引', create: '创建索引', index: '索引', diff --git a/client/src/i18n/en/index.ts b/client/src/i18n/en/index.ts index 3041a948..8645c9f3 100644 --- a/client/src/i18n/en/index.ts +++ b/client/src/i18n/en/index.ts @@ -1,6 +1,10 @@ const indexTrans = { type: 'Index Type', param: 'Index Parameters', + inMemory: 'In-Memory Index', + disk: 'Disk Index', + gpu: 'GPU Index', + scalar: 'Scalar Index', create: 'Create Index', index: 'Index', diff --git a/client/src/pages/databases/collections/overview/CreateForm.tsx b/client/src/pages/databases/collections/overview/CreateForm.tsx index a655741d..7283171b 100644 --- a/client/src/pages/databases/collections/overview/CreateForm.tsx +++ b/client/src/pages/databases/collections/overview/CreateForm.tsx @@ -4,7 +4,8 @@ import { useTranslation } from 'react-i18next'; import { ITextfieldConfig } from '@/components/customInput/Types'; import CustomInput from '@/components/customInput/CustomInput'; import CustomSelector from '@/components/customSelector/CustomSelector'; -import { Option } from '@/components/customSelector/Types'; +import CustomGroupedSelect from '@/components/customSelector/CustomGroupedSelect'; +import { Option, GroupOption } from '@/components/customSelector/Types'; import { FormHelperType } from '../../../../types/Common'; const useStyles = makeStyles((theme: Theme) => ({ @@ -26,7 +27,7 @@ const useStyles = makeStyles((theme: Theme) => ({ const CreateForm = ( props: FormHelperType & { metricOptions: Option[]; - indexOptions: Option[]; + indexOptions: GroupOption[]; indexParams: string[]; indexTypeChange?: (type: string) => void; } @@ -76,6 +77,16 @@ const CreateForm = ( }; if (type === 'number') { + config.validations!.push({ + rule: 'number', + errorText: warningTrans('number', { name: label }), + }); + } + if ( + type === 'number' && + typeof min === 'number' && + typeof max === 'number' + ) { config.validations!.push({ rule: 'range', errorText: warningTrans('range', { min, max }), @@ -157,6 +168,24 @@ const CreateForm = ( key: 'with_raw_data', type: 'bool', }), + intermediate_graph_degree: generateConfig({ + label: 'intermediate_graph_degree', + key: 'intermediate_graph_degree', + }), + graph_degree: generateConfig({ + label: 'graph_degree', + key: 'graph_degree', + }), + build_algo: generateConfig({ + label: 'build_algo', + key: 'build_algo', + type: 'text', + }), + cache_dataset_on_device: generateConfig({ + label: 'cache_dataset_on_device', + key: 'cache_dataset_on_device', + type: 'bool', + }), }; const result: ITextfieldConfig[] = []; @@ -182,10 +211,10 @@ const CreateForm = ( return (