使用union mysql在布尔模式下搜索权重

时间:2016-03-16 16:09:10

标签: mysql

我正在使用此查询来搜索多个表,但这样做有效但是我想将匹配的列“标题”称为高于列描述的匹配。

ol.control.FullScreen

我已尝试在匹配结尾添加“AS relevant1”,如下所示,但不会返回结果:

SELECT 'about' AS a.about,title,null article ,null description

FROM about a 

WHERE 
(
MATCH(a.about) AGAINST ('\"$search\"' IN BOOLEAN MODE)
)

UNION
SELECT 'articles' AS null, b.title,b.article,b.description
from articles b 

WHERE
(
MATCH(b.title,b.article,b.description) AGAINST ('\"$search\"' IN BOOLEAN MODE)
)

1 个答案:

答案 0 :(得分:0)

经过大量的搜索后,我发现这种方法很有效,并且非常易读:

.group