@@ -453,20 +453,17 @@ def query(
453
453
ids = [ids ]
454
454
455
455
conn = self ._get_connection ()
456
- try :
457
- schema_dict = conn .describe_collection (collection_name , timeout = timeout , ** kwargs )
458
- except Exception as ex :
459
- logger .error ("Failed to describe collection: %s" , collection_name )
460
- raise ex from ex
461
456
462
457
if ids :
458
+ try :
459
+ schema_dict = conn .describe_collection (collection_name , timeout = timeout , ** kwargs )
460
+ except Exception as ex :
461
+ logger .error ("Failed to describe collection: %s" , collection_name )
462
+ raise ex from ex
463
463
filter = self ._pack_pks_expr (schema_dict , ids )
464
464
465
465
if not output_fields :
466
466
output_fields = ["*" ]
467
- vec_field_name = self ._get_vector_field_name (schema_dict )
468
- if vec_field_name :
469
- output_fields .append (vec_field_name )
470
467
471
468
try :
472
469
res = conn .query (
@@ -524,9 +521,6 @@ def get(
524
521
525
522
if not output_fields :
526
523
output_fields = ["*" ]
527
- vec_field_name = self ._get_vector_field_name (schema_dict )
528
- if vec_field_name :
529
- output_fields .append (vec_field_name )
530
524
531
525
expr = self ._pack_pks_expr (schema_dict , ids )
532
526
try :
@@ -744,16 +738,6 @@ def _extract_primary_field(self, schema_dict: Dict) -> dict:
744
738
745
739
return {}
746
740
747
- def _get_vector_field_name (self , schema_dict : Dict ):
748
- fields = schema_dict .get ("fields" , [])
749
- if not fields :
750
- return {}
751
-
752
- for field_dict in fields :
753
- if field_dict .get ("type" , None ) == DataType .FLOAT_VECTOR :
754
- return field_dict .get ("name" , "" )
755
- return ""
756
-
757
741
def _pack_pks_expr (self , schema_dict : Dict , pks : List ) -> str :
758
742
primary_field = self ._extract_primary_field (schema_dict )
759
743
pk_field_name = primary_field ["name" ]
0 commit comments