I have three tables in mysql which have full text search enabled:
title (title, url), headings (headings, url), and content (content, url).
My question is this: I wanted weight the url column more than the title, title column more than the headings, and the headings more than the content. Could I do this with boolean searches where each term is required, like so:
SELECT * FROM title WHERE MATCH (title)
AGAINST('+search' IN BOOLEAN MODE)
MATCH ...AGAINSTreturns a number, and MySQL remembers the result of the where clause, so if you have 3 separate FT-indexes on 1 table, you could just do a:Or whatever the weights may need to be.
Alternatively, in Boolean mode, same table, you could use:
For searches where the searchterm is required, same trick:
If you have 3 separate tables, you’ll have to store the weight somewhere, either in some JOIN, or by separate queries (however you do it now):