MYSQL全文 - 从一列获得相关性的正确方法是什么?

时间:2015-06-06 07:19:44

标签: mysql full-text-indexing

此示例显示只需要一个全文索引。 http://www.vionblog.com/mysql-full-text-search-with-multiple-words/

以下是例子:

ALTER TABLE products ADD FULLTEXT(title, sdescription, ldescription)

SELECT *,
MATCH(`title`) AGAINST ('+iphone +case +4s' IN BOOLEAN MODE) * 10 as rel1,
MATCH(`sdescription`) AGAINST ('+iphone +case +4s' IN BOOLEAN MODE) * 3 as rel2,
MATCH(`ldescription`) AGAINST ('+iphone +case +4s' IN BOOLEAN MODE) as rel3,
FROM products
WHERE MATCH (title, sdescription, ldescription) 
  AGAINST ('+iphone +case +4s' IN BOOLEAN MODE)
ORDER BY (rel1)+(rel2)+(rel3) DESC;

这个答案表明需要三个全文索引来做同样的事情。 How can I manipulate MySQL fulltext search relevance to make one field more 'valuable' than another?

我想让一个列比其他人更有价值,就像在上面的查询中完成的那样。我混淆了需要多少索引,一个或三个?

0 个答案:

没有答案