@@ -63,7 +63,7 @@ def __init__(
63
63
self .search_images = search_images
64
64
65
65
async def create_index (self , vectorizers : Optional [List [VectorSearchVectorizer ]] = None ):
66
- logger .info (f "Ensuring search index { self .search_info .index_name } exists" )
66
+ logger .info ("Ensuring search index %s exists" , self .search_info .index_name )
67
67
68
68
async with self .search_info .create_search_index_client () as search_index_client :
69
69
fields = [
@@ -175,10 +175,10 @@ async def create_index(self, vectorizers: Optional[List[VectorSearchVectorizer]]
175
175
),
176
176
)
177
177
if self .search_info .index_name not in [name async for name in search_index_client .list_index_names ()]:
178
- logger .info (f "Creating { self . search_info . index_name } search index" )
178
+ logger .info ("Creating %s search index" , self . search_info . index_name )
179
179
await search_index_client .create_index (index )
180
180
else :
181
- logger .info (f "Search index { self . search_info . index_name } already exists" )
181
+ logger .info ("Search index %s already exists" , self . search_info . index_name )
182
182
183
183
async def update_content (self , sections : List [Section ], image_embeddings : Optional [List [List [float ]]] = None ):
184
184
MAX_BATCH_SIZE = 1000
@@ -220,7 +220,9 @@ async def update_content(self, sections: List[Section], image_embeddings: Option
220
220
await search_client .upload_documents (documents )
221
221
222
222
async def remove_content (self , path : Optional [str ] = None , only_oid : Optional [str ] = None ):
223
- logger .info (f"Removing sections from '{ path or '<all>' } ' from search index '{ self .search_info .index_name } '" )
223
+ logger .info (
224
+ "Removing sections from '{%s or '<all>'}' from search index '%s'" , path , self .search_info .index_name
225
+ )
224
226
async with self .search_info .create_search_client () as search_client :
225
227
while True :
226
228
filter = None if path is None else f"sourcefile eq '{ os .path .basename (path )} '"
@@ -233,6 +235,6 @@ async def remove_content(self, path: Optional[str] = None, only_oid: Optional[st
233
235
if not only_oid or document ["oids" ] == [only_oid ]:
234
236
documents_to_remove .append ({"id" : document ["id" ]})
235
237
removed_docs = await search_client .delete_documents (documents_to_remove )
236
- logger .info (f" \t Removed { len ( removed_docs ) } sections from index" )
238
+ logger .info ("Removed %d sections from index", len ( removed_docs ) )
237
239
# It can take a few seconds for search results to reflect changes, so wait a bit
238
240
await asyncio .sleep (2 )
0 commit comments