@@ -150,9 +150,9 @@ def insert_word_desc(self, word_name, word_desc):
150
150
:param word_name: The name of the word(string).
151
151
:param word_desc: The description of the word(string).
152
152
"""
153
-
154
- self .log .info (f"Inserting word description: { word_name } - { word_desc } " )
155
- self .word_desc .insert_one ({"word_name" : word_name , "word_desc" : word_desc })
153
+ if word_desc != None :
154
+ self .log .info (f"Inserting word description: { word_name } - { word_desc } " )
155
+ self .word_desc .insert_one ({"word_name" : word_name , "word_desc" : word_desc })
156
156
def insert_word_location (self , word_name , word_location ):
157
157
"""Insert word and its location into the NLP database.
158
158
@@ -359,6 +359,8 @@ def search_entire_db(self, term):
359
359
360
360
self .log .info (f"Searching entire database for: { term } " )
361
361
362
+ final_results = []
363
+
362
364
for d in self .dbs :
363
365
self .log .info (f"===> Database: { d .name } " )
364
366
for c in d .list_collection_names ():
@@ -371,12 +373,14 @@ def search_entire_db(self, term):
371
373
372
374
for key in keys :
373
375
self .log .info (f" ===> Key: { c } " )
374
- results .append (db_col_search .find ({key : re .compile (rf"\b{ term } \b" , re .IGNORECASE )}))
375
- final_results = []
376
-
377
- for i in results :
378
- for j in i :
379
- final_results .append (j )
376
+ search = db_col_search .find ({key : re .compile (rf"\b{ term } \b" , re .IGNORECASE )})
377
+ results .append (search )
378
+ try :
379
+ a = search .next ()
380
+ self .log .info (f" ===> Found: { a } " )
381
+ final_results .append (a )
382
+ except :
383
+ self .log .info (f" ===> Found: None" )
380
384
381
385
return final_results
382
386
0 commit comments