К постам Опубликовано: 2016-09-05

Полнотекстовый поиск с учетом релевантности

SELECT title , description , MATCH (title,description)
AGAINST ('$searchphrase')
AS score
FROM table
ORDER BY score DESC

Источник

Там еще несколько примеров.

 

А здесь пускай будет мой запрос. С выборкой из нескольких таблиц. Указывайте LIMIT !!! ибо дорого стоит будет

 SELECT id, name, article, image, what, eng_name, MATCH (name,article) AGAINST ('$zal') AS score
 FROM fashion WHERE MATCH (name,article) AGAINST   ('$zal')
 UNION ALL
 SELECT id, name, article, image, what, eng_name, MATCH (name,article) AGAINST ('$zal') AS score
 FROM poster_ua WHERE MATCH (name,article) AGAINST   ('$zal') 
 UNION ALL
 SELECT id, name, article, image, what, eng_name, MATCH (name,article) AGAINST ('$zal') AS score
 FROM sb WHERE MATCH (name,article) AGAINST   ('$zal')
 UNION ALL
 SELECT id, name, article, image, what, eng_name, MATCH (name,article) AGAINST ('$zal') AS score
 FROM high_life WHERE MATCH (name,article) AGAINST   ('$zal') 
 ORDER BY score DESC LIMIT 6"