Skip to content

Commit a009ee9

Browse files
committed
Fixed bug where disney and wine were returned together
1 parent 56161a1 commit a009ee9

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

backend/PyMatcha/routes/api/search.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,12 @@ def search():
7878
if max_distance != -1:
7979
raise BadRequestError("user needs to sets his location first")
8080

81-
user_tags = [t.name for t in user.get_tags()]
82-
common_tags = _get_common_tags(tags, user_tags)
83-
if not common_tags:
84-
common_tags = []
85-
if tags:
81+
if tags:
82+
user_tags = [t.name for t in user.get_tags()]
83+
common_tags = _get_common_tags(tags, user_tags)
84+
if not common_tags:
85+
# No tags has been found
86+
common_tags = []
8687
continue
8788

8889
user_dict = user.to_dict()

backend/PyMatcha/utils/match_score.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def _get_common_tags(tag_list_1: list, tag_list_2: list) -> List[str]:
2222
common_tags = []
2323
for tag_1 in tag_list_1:
2424
for tag_2 in tag_list_2:
25-
if fuzz.partial_ratio(tag_1, tag_2) >= 70:
25+
if fuzz.partial_ratio(tag_1, tag_2) >= 90:
2626
common_tags.append(tag_1 if len(tag_1) > len(tag_2) else tag_2)
2727
return list(set(common_tags))
2828

0 commit comments

Comments
 (0)