Skip to content

Commit 68684bb

Browse files
committed
remove special chars that were causing trouble for search
1 parent 3b39de9 commit 68684bb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

backend/apps/events/views.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def get_events(request):
113113
accents_to = "aaaaaaeeeeiiiiooooouuuuyync"
114114

115115
# Special chars to remove
116-
special_from = "-_.,!?:;()[]{}|/\\ "
116+
special_from = "-_.,!?:;()[]|/ "
117117
map_from = accents_from + special_from
118118
map_to = accents_to
119119

@@ -148,10 +148,11 @@ def get_events(request):
148148
]
149149
where_clauses = []
150150
params = []
151+
151152
for field in fields:
152153
# Handle COALESCE for nullable fields
153154
col_ref = field
154-
if field not in ["title"]: # title is nullable but usually present, others might be null
155+
if field not in ["title"]:
155156
col_ref = f"COALESCE({field}, '')"
156157
clause = f"TRANSLATE(LOWER({col_ref}), '{map_from}', '{map_to}') LIKE %s"
157158
where_clauses.append(clause)
@@ -1241,4 +1242,4 @@ def boost_event_view(request, event_id):
12411242
},
12421243
},
12431244
status=status.HTTP_200_OK,
1244-
)
1245+
)

0 commit comments

Comments
 (0)