Browse Source

support cosine and scann

Signed-off-by: shanghaikid <jiangruiyi@gmail.com>
shanghaikid 1 year ago
parent
commit
0c0cee0b2f

+ 14 - 0
client/src/consts/Milvus.ts

@@ -6,6 +6,7 @@ export const MILVUS_URL =
 export enum METRIC_TYPES_VALUES {
   L2 = 'L2',
   IP = 'IP',
+  COSINE = 'COSINE',
   HAMMING = 'HAMMING',
   JACCARD = 'JACCARD',
   TANIMOTO = 'TANIMOTO',
@@ -22,6 +23,10 @@ export const METRIC_TYPES = [
     value: METRIC_TYPES_VALUES.IP,
     label: 'IP',
   },
+  {
+    value: METRIC_TYPES_VALUES.COSINE,
+    label: 'COSINE',
+  },
   {
     value: METRIC_TYPES_VALUES.SUBSTRUCTURE,
     label: 'SUBSTRUCTURE',
@@ -47,6 +52,7 @@ export const METRIC_TYPES = [
 export type MetricType =
   | 'L2'
   | 'IP'
+  | 'COSINE'
   | 'HAMMING'
   | 'SUBSTRUCTURE'
   | 'SUPERSTRUCTURE'
@@ -71,6 +77,10 @@ export type indexConfigType = {
 
 // index
 export const FLOAT_INDEX_CONFIG: indexConfigType = {
+  SCANN: {
+    create: ['nlist'],
+    search: ['nprobe'],
+  },
   IVF_FLAT: {
     create: ['nlist'],
     search: ['nprobe'],
@@ -159,6 +169,10 @@ export const METRIC_OPTIONS_MAP = {
       value: METRIC_TYPES_VALUES.IP,
       label: METRIC_TYPES_VALUES.IP,
     },
+    {
+      value: METRIC_TYPES_VALUES.COSINE,
+      label: METRIC_TYPES_VALUES.COSINE,
+    },
   ],
   [DataTypeEnum.BinaryVector]: [
     {

+ 2 - 0
client/src/pages/search/SearchParams.tsx

@@ -20,6 +20,7 @@ import { SearchParamInputConfig, SearchParamsProps } from './Types';
 const getStyles = makeStyles((theme: Theme) => ({
   selector: {
     width: '100%',
+    display: 'none',
     marginBottom: theme.spacing(2),
   },
   input: {
@@ -294,6 +295,7 @@ const SearchParams: FC<SearchParamsProps> = ({
         label={indexTrans('metric')}
         wrapperClass={classes.selector}
         variant="filled"
+        disabled={true}
         onChange={(e: { target: { value: unknown } }) => {
           const metricType = e.target.value as string;
           handleMetricTypeChange(metricType);

+ 1 - 14
client/src/pages/search/VectorSearch.tsx

@@ -1,11 +1,5 @@
 import { useCallback, useEffect, useMemo, useState, useContext } from 'react';
-import {
-  Typography,
-  Button,
-  Card,
-  CardContent,
-  CardActionArea,
-} from '@material-ui/core';
+import { Typography, Button, Card, CardContent } from '@material-ui/core';
 import { useTranslation } from 'react-i18next';
 import { useLocation } from 'react-router-dom';
 import { ALL_ROUTER_TYPES } from '@/router/Types';
@@ -26,7 +20,6 @@ import SimpleMenu from '@/components/menu/SimpleMenu';
 import { Option } from '@/components/customSelector/Types';
 import Filter from '@/components/advancedSearch';
 import { Field } from '@/components/advancedSearch/Types';
-import { CustomDatePicker } from '@/components/customDatePicker/CustomDatePicker';
 import { CollectionHttp, IndexHttp } from '@/http';
 import {
   parseValue,
@@ -514,12 +507,6 @@ const VectorSearch = () => {
               filterDisabled={selectedField === '' || selectedCollection === ''}
               onSubmit={handleAdvancedFilterChange}
             />
-            <CustomDatePicker
-              label={timeTravelInfo.label}
-              onChange={handleDateTimeChange}
-              date={timeTravel}
-              setDate={setTimeTravel}
-            />
           </div>
           <div className="right">
             <CustomButton className="btn" onClick={handleReset}>

+ 4 - 0
client/src/utils/Form.ts

@@ -33,6 +33,10 @@ export const getMetricOptions = (
       value: METRIC_TYPES_VALUES.IP,
       label: 'IP',
     },
+    {
+      value: METRIC_TYPES_VALUES.COSINE,
+      label: 'COSINE',
+    },
   ];
 
   const baseBinaryOptions = [