I have to implement fulltext search in multiple columns with result weighting based on relevance of certain columns / fields.
All the solutions I've come across seem to use single-column indexes for calculating relevance and one multiple-column index for the WHERE
clause. See: https://stackoverflow.com/a/600915/168719 or https://stackoverflow.com/a/6305108/168719
Here's my query then:
SELECT MATCH(name) AGAINST (text) as relevance_name,
MATCH(description) AGAINST(text) as relevance_description,
MATCH(description_long) AGAINST (text) as relevance_description_long
FROM products WHERE
And I'm facing the choice between:
a)
MATCH(name, description, description_long) AGAINST (text) > 0
b)
MATCH(name) AGAINST (text) > 0
OR MATCH(description) AGAINST (text) > 0
OR MATCH(description_long) AGAINST (text) > 0
After which the sorting clause comes.
ORDER BY (relevance_name * 2 +
relevance_description * 3 +
relevance_description_long * 4) / 9
The question is - what is the superiority of a (apparently the preferred method) over b?
a requires creating another fulltext index (across all searchable columns), which obviously takes more disk space.
What are the advantages? Is it a matter of performance? Or search quality?