Browse Source

resolve conflict

tumao 4 years ago
parent
commit
b5e295bd46

+ 13 - 6
client/src/consts/Milvus.tsx

@@ -55,7 +55,7 @@ export type indexConfigType = {
     create: string[];
     search: searchKeywordsType[];
   };
-}
+};
 
 // index
 export const FLOAT_INDEX_CONFIG: indexConfigType = {
@@ -91,9 +91,10 @@ export const FLOAT_INDEX_CONFIG: indexConfigType = {
   //   create: ['out_degree', 'candidate_pool_size', 'search_length', 'knng'],
   //   search: ['search_length'],
   // },}
-}
+};
 
 export const BINARY_INDEX_CONFIG: indexConfigType = {
+  // },
   BIN_FLAT: {
     create: ['nlist'],
     search: ['nprobe'],
@@ -120,8 +121,14 @@ export const m_OPTIONS = [
 ];
 
 export const INDEX_OPTIONS_MAP = {
-  FLOAT_INDEX: Object.keys(FLOAT_INDEX_CONFIG).map(v => ({ label: v, value: v })),
-  BINARY_INDEX: Object.keys(BINARY_INDEX_CONFIG).map(v => ({ label: v, value: v })),
+  FLOAT_INDEX: Object.keys(FLOAT_INDEX_CONFIG).map(v => ({
+    label: v,
+    value: v,
+  })),
+  BINARY_INDEX: Object.keys(BINARY_INDEX_CONFIG).map(v => ({
+    label: v,
+    value: v,
+  })),
 };
 
 export const PRIMARY_KEY_FIELD = 'INT64 (Primary key)';
@@ -180,11 +187,11 @@ export const DEFAULT_SEARCH_PARAM_VALUE_MAP: {
   [key in searchKeywordsType]: number;
 } = {
   // range: [top_k, 32768]
-  ef: 50,
+  ef: 250,
   // range: [1, nlist]
   nprobe: 1,
   // range: {-1} ∪ [top_k, n × n_trees]
-  search_k: 50,
+  search_k: 250,
   // range: [10, 300]
   search_length: 10,
 };

+ 6 - 1
client/src/pages/connect/Connect.tsx

@@ -4,7 +4,12 @@ import { ITextfieldConfig } from '../../components/customInput/Types';
 import icons from '../../components/icons/Icons';
 import ConnectContainer from './ConnectContainer';
 import CustomInput from '../../components/customInput/CustomInput';
-import { useContext, useEffect, useMemo, useState } from 'react';
+import {
+  useContext,
+  // useEffect,
+  useMemo,
+  useState,
+} from 'react';
 import { formatForm } from '../../utils/Form';
 import { useFormValidation } from '../../hooks/Form';
 import CustomButton from '../../components/customButton/CustomButton';

+ 3 - 3
client/src/pages/seach/VectorSearch.tsx

@@ -98,7 +98,7 @@ const VectorSearch = () => {
       const selectedFieldInfo = fieldOptions.find(
         f => f.value === selectedField
       );
-
+      console.log('===== selected field info', selectedFieldInfo);
       const index = selectedFieldInfo?.indexInfo;
 
       const embeddingType =
@@ -107,13 +107,13 @@ const VectorSearch = () => {
           : EmbeddingTypeEnum.float;
 
       const metric =
-        index!._metricType || DEFAULT_METRIC_VALUE_MAP[embeddingType];
+        index?._metricType || DEFAULT_METRIC_VALUE_MAP[embeddingType];
 
       const indexParams = index?._indexParameterPairs || [];
 
       return {
         metricType: metric,
-        indexType: index!._indexType,
+        indexType: index?._indexType || 'FLAT',
         indexParams,
         fieldType: DataTypeEnum[selectedFieldInfo?.fieldType!],
       };

+ 5 - 0
client/src/utils/search.ts

@@ -1,3 +1,4 @@
+import { IndexType } from '../pages/schema/Types';
 import { SearchResult, SearchResultView } from '../pages/seach/Types';
 
 export const transferSearchResult = (
@@ -13,3 +14,7 @@ export const transferSearchResult = (
 
   return resultView;
 };
+
+// export const getDefaultIndexType = (fieldType: ): IndexType => {
+
+// }