在MySQL中具有相关性的Cakephp 3.x全文搜索

时间:2019-05-10 09:03:53

标签: mysql full-text-search cakephp-3.0

目标是建立一个具有相关引用的全文搜索引擎。

mysql应该看起来像这样:

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;

这是如何用cakephp 3.x编写的?

0 个答案:

没有答案