@@ -232,12 +232,7 @@ async def create_index(self):
232
232
type = "Edm.String" ,
233
233
analyzer_name = self .search_analyzer_name ,
234
234
),
235
- SimpleField (
236
- name = "category" ,
237
- type = "Edm.String" ,
238
- filterable = True ,
239
- facetable = True ,
240
- ),
235
+ SimpleField (name = "category" , type = "Edm.String" , filterable = True , facetable = True ),
241
236
SimpleField (
242
237
name = "sourcepage" ,
243
238
type = "Edm.String" ,
@@ -282,10 +277,7 @@ async def create_index(self):
282
277
vector_algorithms : list [VectorSearchAlgorithmConfiguration ] = []
283
278
vector_compressions : list [VectorSearchCompression ] = []
284
279
if embedding_field :
285
- logger .info (
286
- "Including %s field for text vectors in new index" ,
287
- embedding_field .name ,
288
- )
280
+ logger .info ("Including %s field for text vectors in new index" , embedding_field .name )
289
281
fields .append (embedding_field )
290
282
if text_vectorizer is not None :
291
283
vectorizers .append (text_vectorizer )
@@ -300,10 +292,7 @@ async def create_index(self):
300
292
vector_compressions .append (text_vector_compression )
301
293
302
294
if images_field :
303
- logger .info (
304
- "Including %s field for image descriptions and vectors in new index" ,
305
- images_field .name ,
306
- )
295
+ logger .info ("Including %s field for image descriptions and vectors in new index" , images_field .name )
307
296
fields .append (images_field )
308
297
if image_vector_search_profile is None or image_vector_algorithm is None :
309
298
raise ValueError ("Image search profile and algorithm must be set" )
@@ -340,10 +329,7 @@ async def create_index(self):
340
329
logger .info ("Search index %s already exists" , self .search_info .index_name )
341
330
existing_index = await search_index_client .get_index (self .search_info .index_name )
342
331
if not any (field .name == "storageUrl" for field in existing_index .fields ):
343
- logger .info (
344
- "Adding storageUrl field to index %s" ,
345
- self .search_info .index_name ,
346
- )
332
+ logger .info ("Adding storageUrl field to index %s" , self .search_info .index_name )
347
333
existing_index .fields .append (
348
334
SimpleField (
349
335
name = "storageUrl" ,
@@ -408,10 +394,7 @@ async def create_index(self):
408
394
409
395
if existing_index .semantic_search :
410
396
if not existing_index .semantic_search .default_configuration_name :
411
- logger .info (
412
- "Adding default semantic configuration to index %s" ,
413
- self .search_info .index_name ,
414
- )
397
+ logger .info ("Adding default semantic configuration to index %s" , self .search_info .index_name )
415
398
existing_index .semantic_search .default_configuration_name = "default"
416
399
417
400
if existing_index .semantic_search .configurations :
@@ -421,10 +404,7 @@ async def create_index(self):
421
404
and existing_semantic_config .prioritized_fields .title_field
422
405
and not existing_semantic_config .prioritized_fields .title_field .field_name == "sourcepage"
423
406
):
424
- logger .info (
425
- "Updating semantic configuration for index %s" ,
426
- self .search_info .index_name ,
427
- )
407
+ logger .info ("Updating semantic configuration for index %s" , self .search_info .index_name )
428
408
existing_semantic_config .prioritized_fields .title_field = SemanticField (
429
409
field_name = "sourcepage"
430
410
)
@@ -434,10 +414,7 @@ async def create_index(self):
434
414
or len (existing_index .vector_search .vectorizers ) == 0
435
415
):
436
416
if self .embeddings is not None and isinstance (self .embeddings , AzureOpenAIEmbeddingService ):
437
- logger .info (
438
- "Adding vectorizer to search index %s" ,
439
- self .search_info .index_name ,
440
- )
417
+ logger .info ("Adding vectorizer to search index %s" , self .search_info .index_name )
441
418
existing_index .vector_search .vectorizers = [
442
419
AzureOpenAIVectorizer (
443
420
vectorizer_name = f"{ self .search_info .index_name } -vectorizer" ,
@@ -578,10 +555,7 @@ async def remove_content(self, path: Optional[str] = None, only_oid: Optional[st
578
555
filter = f"sourcefile eq '{ path_for_filter } '"
579
556
max_results = 1000
580
557
result = await search_client .search (
581
- search_text = "" ,
582
- filter = filter ,
583
- top = max_results ,
584
- include_total_count = True ,
558
+ search_text = "" , filter = filter , top = max_results , include_total_count = True
585
559
)
586
560
result_count = await result .get_count ()
587
561
if result_count == 0 :
0 commit comments