I have MySQL and Sphinx installed and working properly on a LNMP server. Now I’d like to integrate a Sphinx sub-query into an existing MySQL query.
Example:
SELECT * FROM mysql_table
JOIN (SELECT id FROM sphinx_index MATCH ('keyword')) AS match_table
ON match_table.id = mysql_table.id
Is this possible? If not, should I do the Sphinx separately and then use WHERE IN in the MySQL query, or will this kill the extra efficiency I’m getting from Sphinx?
Use SphinxSE
http://sphinxsearch.com/docs/current.html#sphinxse-overview
Then would be
Although
is shorter and more concise. And better maintains the order of results.
Where ‘sphinx_index’ is a SphinxSE table, which points to underlying sphinx index.