19
19
CALC_DIST_JACCARD ,
20
20
CALC_DIST_L2 ,
21
21
CALC_DIST_TANIMOTO ,
22
+ COLLECTION_ID ,
22
23
DEFAULT_SEARCH_EXTENSION_RATE ,
23
24
EF ,
24
25
FIELDS ,
@@ -72,11 +73,14 @@ def __init__(
72
73
) -> QueryIterator :
73
74
self ._conn = connection
74
75
self ._collection_name = collection_name
76
+ self .__set_up_collection_id ()
75
77
self ._output_fields = output_fields
76
78
self ._partition_names = partition_names
77
79
self ._schema = schema
78
80
self ._timeout = timeout
79
81
self ._kwargs = kwargs
82
+ self ._kwargs [ITERATOR_FIELD ] = "True"
83
+ self ._kwargs [COLLECTION_ID ] = self ._collection_id
80
84
self .__check_set_batch_size (batch_size )
81
85
self ._limit = limit
82
86
self .__check_set_reduce_stop_for_best ()
@@ -87,6 +91,10 @@ def __init__(
87
91
self .__seek ()
88
92
self ._cache_id_in_use = NO_CACHE_ID
89
93
94
+ def __set_up_collection_id (self ):
95
+ res = self ._conn .describe_collection (self ._collection_name )
96
+ self ._collection_id = res [COLLECTION_ID ]
97
+
90
98
def __check_set_reduce_stop_for_best (self ):
91
99
if self ._kwargs .get (REDUCE_STOP_FOR_BEST , True ):
92
100
self ._kwargs [REDUCE_STOP_FOR_BEST ] = "True"
@@ -336,11 +344,14 @@ def __init__(
336
344
"timeout" : timeout ,
337
345
"round_decimal" : round_decimal ,
338
346
}
347
+ self ._collection_name = collection_name
339
348
self ._expr = expr
340
349
self .__check_set_params (param )
341
350
self .__check_for_special_index_param ()
342
351
self ._kwargs = kwargs
343
352
self .__set_up_iteration_states ()
353
+ self .__set_up_collection_id ()
354
+ self ._kwargs [COLLECTION_ID ] = self ._collection_id
344
355
self ._filtered_ids = []
345
356
self ._filtered_distance = None
346
357
self ._schema = schema
@@ -352,6 +363,10 @@ def __init__(
352
363
self .__setup__pk_prop ()
353
364
self .__init_search_iterator ()
354
365
366
+ def __set_up_collection_id (self ):
367
+ res = self ._conn .describe_collection (self ._collection_name )
368
+ self ._collection_id = res [COLLECTION_ID ]
369
+
355
370
def __init_search_iterator (self ):
356
371
init_page = self .__execute_next_search (self ._param , self ._expr , False )
357
372
if len (init_page ) == 0 :
0 commit comments