Reputation: 236
I'm am wondering if it is even possible (say through a nested sql query) to perform WITH QUERY EXPANSION on results from a FULLTEXT INDEX search run with IN BOOLEAN MODE.
This doesn't work, but maybe it will help explain what I am looking for:
SELECT * FROM (SELECT * FROM indexed_table AS x WHERE MATCH(x.ind_col)
AGAINST('(+word1 +word2 +word3) (+word1 +word4) (+word2 +word4)' IN BOOLEAN MODE))x
WHERE MATCH(ind_col) AGAINST('word1 word2' WITH QUERY EXPANSION);
To clarify: I'm trying to to use the second MATCH..AGAINST ("WITH QUERY EXPANSION") on the results of the first MATCH..AGAINST ("IN BOOLEAN MODE").
Upvotes: 4
Views: 1192
Reputation: 103
You should be able to do this with the following:
SELECT * FROM (
SELECT * FROM `indexed_table` WHERE MATCH(ind_col) against ('(+word1 +word2 +word3) (+word1 +word4) (+word2 +word4)' IN BOOLEAN MODE)
) AS x WHERE MATCH(ind_col) against ('word1 word2' WITH QUERY EXPANSION)
Upvotes: 0
Reputation: 65587
You can certainly use multiple MATCH statements in a single WHERE clause and just AND them together if that satisfies your requirements.
Do this work for you?
SELECT *
FROM indexed_table
WHERE MATCH(ind_col) AGAINST('(+word1 +word2 +word3) (+word1 +word4) (+word2 +word4)' IN BOOLEAN MODE)
AND MATCH(ind_col) AGAINST('word1 word2' WITH QUERY EXPANSION);
Upvotes: 1