@@ -75,18 +75,11 @@ def perform_search_engine_query(query_params):
7575 return results , paginator
7676
7777
78- def add_sounds_to_search_engine (sound_objects , fields_to_include = [], update = False ):
78+ def add_sounds_to_search_engine (sound_objects : list [ "sounds.models.Sound" ] ):
7979 """Add the Sounds from the queryset to the search engine
8080
8181 Args:
82- sound_objects (list[sounds.models.Sound]): list (or queryset) of Sound objects to index
83- fields_to_include (list[str]): use this list to indicate the specific field names of the sounds
84- that need to be included in the documents that will be indexed. If no fields are specified
85- (fields_to_update=[]), then all available fields will be included.
86- update (bool): if True, the sounds' data will be updated in the index, otherwise it will be
87- replaced by the new generated documents. This is specially useful in combination with
88- fields_to_include so that different fields of the indexed can be updated separately.
89-
82+ sound_objects: list (or queryset) of Sound objects to index
9083 Returns:
9184 int: number of sounds added to the index
9285 """
@@ -95,13 +88,13 @@ def add_sounds_to_search_engine(sound_objects, fields_to_include=[], update=Fals
9588 else :
9689 num_sounds = len (sound_objects )
9790 try :
98- console_logger .info ( "Adding %d sounds to the search engine" % num_sounds )
99- search_logger .info ( "Adding %d sounds to the search engine" % num_sounds )
100- get_search_engine ().add_sounds_to_index (sound_objects , fields_to_include = fields_to_include , update = update )
91+ console_logger .debug ( f "Adding { num_sounds } sounds to the search engine" )
92+ search_logger .debug ( f "Adding { num_sounds } sounds to the search engine" )
93+ get_search_engine ().add_sounds_to_index (sound_objects , fields_to_include = [] , update = False )
10194 return num_sounds
10295 except SearchEngineException as e :
103- console_logger .info (f"Failed to add sounds to search engine index: { str (e )} " )
104- search_logger .info (f"Failed to add sounds to search engine index: { str (e )} " )
96+ console_logger .error (f"Failed to add sounds to search engine index: { str (e )} " )
97+ search_logger .error (f"Failed to add sounds to search engine index: { str (e )} " )
10598 return 0
10699
107100
0 commit comments