Browse Source

fix search

Signed-off-by: ruiyi.jiang <ruiyi.jiang@zilliz.com>
ruiyi.jiang 2 years ago
parent
commit
d5c195fc89

+ 3 - 3
client/src/http/Collection.ts

@@ -3,10 +3,10 @@ import {
   CollectionView,
   DeleteEntitiesReq,
   InsertDataParam,
-  LoadSampleParam,
-  LoadRelicaReq,
+  LoadReplicaReq,
   Replica,
 } from '../pages/collections/Types';
+import { LoadSampleParam } from '../pages/dialogs/Types';
 import { Field } from '../pages/schema/Types';
 import { VectorSearchParam } from '../types/SearchTypes';
 import { QueryParam } from '../pages/query/Types';
@@ -70,7 +70,7 @@ export class CollectionHttp extends BaseModel implements CollectionView {
     return super.delete({ path: `${this.COLLECTIONS_URL}/${collectionName}` });
   }
 
-  static loadCollection(collectionName: string, param?: LoadRelicaReq) {
+  static loadCollection(collectionName: string, param?: LoadReplicaReq) {
     return super.update({
       path: `${this.COLLECTIONS_URL}/${collectionName}/load`,
       data: param,

+ 1 - 1
client/src/pages/collections/Types.ts

@@ -136,7 +136,7 @@ export interface AliasesProps {
   onDelete?: Function;
 }
 
-export interface LoadRelicaReq {
+export interface LoadReplicaReq {
   replica_number: number;
 }
 

+ 1 - 1
client/src/pages/overview/collectionCard/CollectionCard.tsx

@@ -128,7 +128,7 @@ const CollectionCard: FC<CollectionCardProps> = ({
         <RightArrowIcon classes={{ root: classes.icon }} />
       </Link>
       <ul className={classes.content}>
-        {_replicas.length > 1 ? (
+        {_replicas && _replicas.length > 1 ? (
           <li>
             <Typography>{collectionTrans('replicaNum')}</Typography>:
             <Typography className={classes.rowCount}>

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

@@ -202,6 +202,17 @@ const SearchParams: FC<SearchParamsProps> = ({
             handleInputChange('ef', Number(value));
           },
         },
+        level: {
+          label: 'level',
+          key: 'level',
+          value: searchParamsForm['level'] || '',
+          min: 1,
+          max: 3,
+          isInt: true,
+          handleChange: value => {
+            handleInputChange('level', Number(value));
+          },
+        },
         search_k: {
           label: 'search_k',
           key: 'search_k',

+ 8 - 5
server/src/collections/collections.service.ts

@@ -173,11 +173,14 @@ export class CollectionsService {
           ? '-1'
           : loadCollection.loadedPercentage;
 
-        const replicas: any = loadCollection
-          ? await this.getReplicas({
-              collectionID: collectionInfo.collectionID,
-            })
-          : [];
+        let replicas;
+        try {
+          replicas = loadCollection
+            ? await this.getReplicas({
+                collectionID: collectionInfo.collectionID,
+              })
+            : replicas;
+        } catch (e) {}
 
         data.push({
           aliases: collectionInfo.aliases,