From 49699fe25164fefa6e36a5cb450ce897700d4184 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Mon, 14 May 2018 08:41:40 -0400 Subject: [PATCH] Fix MySQL bug in full text search Fixes https://jira.coreos.com/browse/QUAY-937 --- data/text.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/data/text.py b/data/text.py index 870dd935a..094516d85 100644 --- a/data/text.py +++ b/data/text.py @@ -25,6 +25,10 @@ def match_mysql(field, search_query): if field.name.find('`') >= 0: # Just to be safe. raise Exception("How did field name '%s' end up containing a backtick?" % field.name) + # Note: There is a known bug in MySQL (https://bugs.mysql.com/bug.php?id=78485) that causes + # queries of the form `*` to raise a parsing error. If found, simply filter out. + search_query = search_query.replace('*', '') + return Clause(fn.MATCH(SQL("`%s`" % field.name)), fn.AGAINST(SQL('%s', search_query)), parens=True)