@@ -1258,7 +1258,7 @@ def _sql_search_count(self, query: str) -> int:
1258
1258
count = session .execute (statement ).one ()
1259
1259
return count [0 ]
1260
1260
1261
- def reindex_qdrant (self , batch : int = 1000 ) -> None :
1261
+ def reindex_qdrant (self , batch : int = 100 ) -> None :
1262
1262
"""
1263
1263
Re-upload all files to quadrant.
1264
1264
!Warning: only hg38 genome can be added to qdrant!
@@ -1271,7 +1271,9 @@ def reindex_qdrant(self, batch: int = 1000) -> None:
1271
1271
"""
1272
1272
bb_client = BBClient ()
1273
1273
1274
- annotation_result = self .get_ids_list (limit = 100000 , genome = QDRANT_GENOME )
1274
+ annotation_result = self .get_ids_list (
1275
+ limit = 100000 , genome = QDRANT_GENOME , offset = 0
1276
+ )
1275
1277
1276
1278
if not annotation_result .results :
1277
1279
_LOGGER .error ("No bed files found." )
@@ -1280,6 +1282,7 @@ def reindex_qdrant(self, batch: int = 1000) -> None:
1280
1282
1281
1283
with tqdm (total = len (results ), position = 0 , leave = True ) as pbar :
1282
1284
points_list = []
1285
+ processed_number = 0
1283
1286
for record in results :
1284
1287
try :
1285
1288
bed_region_set_obj = GRegionSet (bb_client .seek (record .id ))
@@ -1298,18 +1301,26 @@ def reindex_qdrant(self, batch: int = 1000) -> None:
1298
1301
),
1299
1302
)
1300
1303
)
1304
+ processed_number += 1
1305
+ if processed_number % batch == 0 :
1306
+ pbar .set_description (f"Uploading points to qdrant using batch..." )
1307
+ operation_info = self ._config .qdrant_engine .qd_client .upsert (
1308
+ collection_name = self ._config .config .qdrant .file_collection ,
1309
+ points = points_list ,
1310
+ )
1311
+ pbar .write ("Uploaded batch to qdrant." )
1312
+ points_list = []
1313
+ assert operation_info .status == "completed"
1314
+
1301
1315
pbar .write (f"File: { record .id } successfully indexed." )
1302
1316
pbar .update (1 )
1303
1317
1304
1318
_LOGGER .info (f"Uploading points to qdrant using batches..." )
1305
- for i in range (0 , len (points_list ), batch ):
1306
- operation_info = self ._config .qdrant_engine .qd_client .upsert (
1307
- collection_name = self ._config .config .qdrant .file_collection ,
1308
- points = points_list [i : i + batch ],
1309
- )
1310
-
1311
- assert operation_info .status == "completed"
1312
-
1319
+ operation_info = self ._config .qdrant_engine .qd_client .upsert (
1320
+ collection_name = self ._config .config .qdrant .file_collection ,
1321
+ points = points_list ,
1322
+ )
1323
+ assert operation_info .status == "completed"
1313
1324
return None
1314
1325
1315
1326
def delete_qdrant_point (self , identifier : str ) -> None :
0 commit comments