Someone posted this for me in another thread:
This will probably give you what you want. I'm probably going to do this, but use Elastic instead of MySQL.