Homec4science

Add a "query compiler" to convert user search queries into a form MySQL likes

Authored by epriestley <git@epriestley.com> on Nov 24 2016, 16:21.

Description

Add a "query compiler" to convert user search queries into a form MySQL likes

Summary:
Ref T11741. Ref T10642.

By default, MySQL runs query cat dog as "cat OR dog". Users expect "cat AND dog".

For users using MySQL, we instruct them to fix this by changing ft_boolean_syntax. However:

  • You can't edit this in RDS (T10642).
  • There's no similar option for InnoDB (T11741).

Instead, we can parse the query ourselves, and submit +"cat" +"dog" to MySQL, using whatever syntax it is configured for. This will also let us simplify setup since users won't need to change this setting any more.

This just implements a parser/compiler and test cases. It does not yet change search beahvior.

Test Plan: Added and executed unit tests. Ran some of the resulting queries in MySQL to make sure it did what I was expecting.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10642, T11741

Differential Revision: https://secure.phabricator.com/D16938

Details

Committed
epriestley <git@epriestley.com>Nov 25 2016, 20:09
Pushed
aubortMar 17 2017, 12:03
Parents
rPHU19d250fe8a8a: Add a console method for picking from a list of options
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPHUf91fe45f667b: Add a "query compiler" to convert user search queries into a form MySQL likes (authored by epriestley <git@epriestley.com>).Nov 25 2016, 20:09