@@ -251,7 +251,8 @@ def match_by_query(text, query, countries):
251251 if candidates :
252252 candidates = [c for c in candidates if c ["_source" ]["status" ] == "active" ]
253253 scored_candidates = [score (text , c ) for c in candidates ]
254- scored_candidates = [s for s in scored_candidates if s .score >= MIN_SCORE_FOR_RETURN ]
254+ scored_candidates = [s for s in scored_candidates if s .score >= MIN_SCORE ]
255+ scored_candidates_to_return = [s for s in scored_candidates if s .score >= MIN_SCORE_FOR_RETURN ]
255256 if scored_candidates :
256257 if (len (scored_candidates ) == 1 ) and (scored_candidates [0 ].score >= MIN_SCORE ):
257258 chosen_candidate = scored_candidates [0 ]
@@ -279,18 +280,14 @@ def match_by_query(text, query, countries):
279280 substring = chosen_candidate .substring ,
280281 chosen = True ,
281282 )
282- scored_candidates = [
283- s ._replace (score = round (s .score / 100 , 2 )) for s in scored_candidates
283+ scored_candidates_to_return = [
284+ s ._replace (score = round (s .score / 100 , 2 )) for s in scored_candidates_to_return
284285 ]
285286
286- return chosen_true , scored_candidates
287+ return chosen_true , scored_candidates_to_return
287288
288289
289- def get_output (chosen , all_matched , active_only ):
290- if active_only :
291- all_matched = [
292- m for m in all_matched if m .organization ["_source" ]["status" ] == "active"
293- ]
290+ def get_output (chosen , all_matched ):
294291 all_matched = sorted (all_matched , key = lambda x : x .score , reverse = True )[:100 ]
295292 if chosen :
296293 all_matched = [
0 commit comments