【发布时间】:2014-04-08 13:17:55
【问题描述】:
我正在运行如下 SQL 查询:
SELECT a.id as id,a.name as name , a.price as price , a.saleprice as saleprice, a.images as images, a.slug as slug,a.hover_name as hover_name, MATCH (a.name) AGAINST ('+"blue cushion"') AS title_relevance FROM gc_products a WHERE ( ( ( MATCH (a.name) AGAINST ('+"blue cushion"') ) OR (a.sku like '%blue cushion%') ) and (a.enabled=1) ) ORDER BY title_relevance DESC
但它给了我错误的结果,它还向我显示名称类似于“蓝色蜡烛”、“红色垫子”的记录
我也试过了
MATCH (a.name) AGAINST ('blue cushion')
MATCH (a.name) AGAINST ('+blue cushion')
MATCH (a.name) AGAINST ('+blue +cushion')
这两个词不必在一起。它们可以在名称中的任何位置,但两个词必须在名称中。 '+' 号表示 0 或更多,而我至少需要一次。
但同样的结果即将到来。我想如果有多个单词要匹配,那么它应该匹配 name 中的所有单词。
MATCH (a.name) AGAINST ('blue +cushion')
【问题讨论】:
-
+、*等...语法仅适用于布尔模式。 -
那是什么?如何使用布尔模式。请根据我的搜索结果给我答案
标签: mysql search full-text-search match