Skip to content

Commit

Permalink
Merge pull request #275 from zilliztech/scalar_index
Browse files Browse the repository at this point in the history
fix scalar index creation
  • Loading branch information
shanghaikid authored Sep 20, 2023
2 parents c7b8a7e + 1efa3ef commit f1802e3
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 27 deletions.
18 changes: 17 additions & 1 deletion client/src/consts/Milvus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@ export const MILVUS_URL =

export const DYNAMIC_FIELD = `$meta`;

export enum INDEX_TYPES_ENUM {
AUTO_INDEX = 'AUTO_INDEX',
IVF_FLAT = 'IVF_FLAT',
IVF_PQ = 'IVF_PQ',
IVF_SQ8 = 'IVF_SQ8',
IVF_SQ8_HYBRID = 'IVF_SQ8_HYBRID',
FLAT = 'FLAT',
HNSW = 'HNSW',
ANNOY = 'ANNOY',
RNSG = 'RNSG',
BIN_IVF_FLAT = 'BIN_IVF_FLAT',
BIN_FLAT = 'BIN_FLAT',
SORT = 'STL_SORT',
MARISA_TRIE = 'Trie',
}

export enum METRIC_TYPES_VALUES {
L2 = 'L2',
IP = 'IP',
Expand Down Expand Up @@ -158,7 +174,7 @@ export const INDEX_OPTIONS_MAP = {
[DataTypeEnum.VarChar]: [
{
label: 'marisa-trie',
value: 'marisa-trie',
value: INDEX_TYPES_ENUM.MARISA_TRIE
},
],
};
Expand Down
5 changes: 3 additions & 2 deletions client/src/pages/schema/Create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
INDEX_CONFIG,
INDEX_OPTIONS_MAP,
METRIC_TYPES_VALUES,
INDEX_TYPES_ENUM,
} from '@/consts';
import { useFormValidation } from '@/hooks';
import { getCreateIndexJSCode } from '@/utils/code/Js';
Expand All @@ -23,7 +24,7 @@ import {
import { DataTypeEnum, DataTypeStringEnum } from '../collections/Types';
import CreateForm from './CreateForm';
import SizingInfo from './SizingInfo';
import { IndexType, IndexExtraParam, INDEX_TYPES_ENUM } from './Types';
import { IndexType, IndexExtraParam } from './Types';

const CreateIndex = (props: {
collectionName: string;
Expand Down Expand Up @@ -140,7 +141,7 @@ const CreateIndex = (props: {
return INDEX_OPTIONS_MAP[DataTypeEnum.VarChar];

default:
return [{ label: 'Ascending', value: 'sort' }];
return [{ label: 'STL sort', value: INDEX_TYPES_ENUM.SORT }];
}
}, [fieldType]);

Expand Down
18 changes: 1 addition & 17 deletions client/src/pages/schema/Types.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,7 @@
import { ReactElement } from 'react';
import { MetricType } from '@/consts';
import { MetricType, INDEX_TYPES_ENUM } from '@/consts';
import { DataTypeStringEnum } from '../collections/Types';

export enum INDEX_TYPES_ENUM {
AUTO_INDEX = 'AUTO_INDEX',
IVF_FLAT = 'IVF_FLAT',
IVF_PQ = 'IVF_PQ',
IVF_SQ8 = 'IVF_SQ8',
IVF_SQ8_HYBRID = 'IVF_SQ8_HYBRID',
FLAT = 'FLAT',
HNSW = 'HNSW',
ANNOY = 'ANNOY',
RNSG = 'RNSG',
BIN_IVF_FLAT = 'BIN_IVF_FLAT',
BIN_FLAT = 'BIN_FLAT',
SORT = 'sort',
MARISA_TRIE = 'marisa-trie',
}

export interface Field {
data_type: DataTypeStringEnum;
fieldID: string;
Expand Down
3 changes: 2 additions & 1 deletion client/src/utils/SizingTool.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { INDEX_TYPES_ENUM, SIZE_STATUS } from '../pages/schema/Types';
import { SIZE_STATUS } from '../pages/schema/Types';
import { INDEX_TYPES_ENUM } from '@/consts';

const commonValueCalculator = (
vector: number,
Expand Down
8 changes: 2 additions & 6 deletions client/src/utils/search.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { Field } from '../components/advancedSearch/Types';
import { DataTypeEnum, DataTypeStringEnum } from '../pages/collections/Types';
import {
FieldData,
IndexType,
IndexView,
INDEX_TYPES_ENUM,
} from '../pages/schema/Types';
import { FieldData, IndexType, IndexView } from '../pages/schema/Types';
import { INDEX_TYPES_ENUM } from '@/consts';
import { FieldOption } from '../types/SearchTypes';

/**
Expand Down

0 comments on commit f1802e3

Please sign in to comment.