Merge pull request #3076 from quay/joseph.schorr/QUAY-937/star-search
Fix MySQL bug in full text search
This commit is contained in:
commit
e5b86d4763
1 changed files with 4 additions and 0 deletions
|
@ -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)
|
||||
|
||||
|
|
Reference in a new issue