We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1ab32c8 commit 544c12eCopy full SHA for 544c12e
handlers/search.py
@@ -37,6 +37,14 @@ def get(self, base36_id=None):
37
38
current_user_obj = self.get_current_user_object()
39
q = self.get_argument("q", "")
40
+
41
+ # Take care of an mysql specific case where prepending an @ to a token
42
+ # causes a query syntax error. Wrap any token like that in double
43
+ # quotes first.
44
+ # More info: @distance fulltext search proximity operator
45
+ # https://dev.mysql.com/doc/refman/8.4/en/fulltext-boolean.html
46
+ q = re.sub(r'(?<!")(\B@[\w\-]+)(?!")', r'"\1"', q)
47
48
context = self.get_argument("context", "")
49
if context:
50
q = q + " " + context
0 commit comments