开发者

match ... against on more field: give more importance to first field?

I do a query like this

SELECT * FROM . WHERE MATCH(title,text) AGAINST ('word1') LIMIT 100

now of coure title is more important than text. Are there a way to tell mysql it should give more revelance if word1 is found in t开发者_开发问答itle than text?

Thanks


this should do it but its seems a little clunky

SELECT * FROM 

(SELECT * FROM  WHERE 
MATCH(title) AGAINST ('word1') 
UNION
SELECT * FROM  WHERE 
MATCH(text) AGAINST ('word1') 

) t

LIMIT 100
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜