23
23
CALC_DIST_JACCARD ,
24
24
CALC_DIST_L2 ,
25
25
CALC_DIST_TANIMOTO ,
26
+ COLLECTION_ID ,
26
27
DEFAULT_SEARCH_EXTENSION_RATE ,
27
28
EF ,
28
29
FIELDS ,
@@ -101,13 +102,15 @@ def __init__(
101
102
) -> QueryIterator :
102
103
self ._conn = connection
103
104
self ._collection_name = collection_name
105
+ self .__set_up_collection_id ()
104
106
self ._output_fields = output_fields
105
107
self ._partition_names = partition_names
106
108
self ._schema = schema
107
109
self ._timeout = timeout
108
110
self ._session_ts = 0
109
111
self ._kwargs = kwargs
110
112
self ._kwargs [ITERATOR_FIELD ] = "True"
113
+ self ._kwargs [COLLECTION_ID ] = self ._collection_id
111
114
self .__check_set_batch_size (batch_size )
112
115
self ._limit = limit
113
116
self .__check_set_reduce_stop_for_best ()
@@ -120,6 +123,10 @@ def __init__(
120
123
self .__set_up_ts_cp ()
121
124
self .__seek_to_offset ()
122
125
126
+ def __set_up_collection_id (self ):
127
+ res = self ._conn .describe_collection (self ._collection_name )
128
+ self ._collection_id = res [COLLECTION_ID ]
129
+
123
130
def __seek_to_offset (self ):
124
131
# read pk cursor from cp file, no need to seek offset
125
132
if self ._next_id is not None :
@@ -502,6 +509,8 @@ def __init__(
502
509
self .__check_for_special_index_param ()
503
510
self ._kwargs = kwargs
504
511
self ._kwargs [ITERATOR_FIELD ] = "True"
512
+ self .__set_up_collection_id ()
513
+ self ._kwargs [COLLECTION_ID ] = self ._collection_id
505
514
self ._filtered_ids = []
506
515
self ._filtered_distance = None
507
516
self ._schema = schema
@@ -513,6 +522,10 @@ def __init__(
513
522
self .__setup__pk_prop ()
514
523
self .__init_search_iterator ()
515
524
525
+ def __set_up_collection_id (self ):
526
+ res = self ._conn .describe_collection (self ._collection_name )
527
+ self ._collection_id = res [COLLECTION_ID ]
528
+
516
529
def __init_search_iterator (self ):
517
530
init_page = self .__execute_next_search (self ._param , self ._expr , False )
518
531
self ._session_ts = init_page .get_session_ts ()
0 commit comments