sql MATCH AGAINST BOOLEAN MODE 返回 0 个结果
这是查询:
SELECT title from prod_table WHERE MATCH(title) AGAINST ('-Gears Of War' IN BOOLEAN MODE) limit 30;
表肯定已填充,这里是模式
SQL query: explain prod_table;
Rows: 22
Field Type Null Key Default Extra
PRprodinfo_id int(11) NO PRI NULL auto_increment
PRid varchar(64) NO UNI NULL
main_category varchar(64) YES NULL
title varchar(128)NO MUL NULL
agegroup varchar(16) YES NULL
author varchar(128)YES NULL
sex varchar(8) YES NULL
actors varchar(256)YES NULL
platform varchar(64) YES NULL
artist varchar(128)YES NULL
genre varchar(128)YES NULL
description text YES NULL
manuf varchar(128)YES NULL
manufID varchar(64) YES NULL
prodcat varchar(128)YES NULL
prodcatID int(11) YES NULL
userrating decimal(1,1)NO NULL
profrating decimal(1,1)NO NULL
lowprice decimal(10,2) NO NULL
highprice decimal(10,2) NO NULL
imageURL varchar(128) NO NULL
dateadded timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
也尝试过:
SELECT title from PRprodINFO WHERE MATCH(title) AGAINST ("-'Gears Of War'" IN BOOLEAN MODE) limit 30;
但
SELECT title from PRprodINFO WHERE MATCH(title) AGAINST ("'-Gears Of War'" IN BOOLEAN MODE) limit 30;
它们有点取消自己,一些结果是:
'Gears and Gear Cutting Workshop Practice'
'Gears of War 2 Signature Series Guide Bradygames Signature Guides'
'Gears of War 2 Last Stand Edition Guide Bradygames Signature'
'Cream Disraeli Gears Classic Albums DVD RETAIL BUT NOT AVAILABLE TO RENT'
'Gears of War 2 Limited Edition'
'Gears Of War'
'Gears of War 2'
'Gears of War Triple Pack'
'Gears of War 2 Game of the Year Edition'
'Gears of War 3 Limited Edition'
'Gears of War 3'
这正是我不想要的
我被难住了 - 而且,在title 字段有一个 FULLTEXT 索引。
谢谢达伦
This is the query:
SELECT title from prod_table WHERE MATCH(title) AGAINST ('-Gears Of War' IN BOOLEAN MODE) limit 30;
The table is definitely populated and here is schema
SQL query: explain prod_table;
Rows: 22
Field Type Null Key Default Extra
PRprodinfo_id int(11) NO PRI NULL auto_increment
PRid varchar(64) NO UNI NULL
main_category varchar(64) YES NULL
title varchar(128)NO MUL NULL
agegroup varchar(16) YES NULL
author varchar(128)YES NULL
sex varchar(8) YES NULL
actors varchar(256)YES NULL
platform varchar(64) YES NULL
artist varchar(128)YES NULL
genre varchar(128)YES NULL
description text YES NULL
manuf varchar(128)YES NULL
manufID varchar(64) YES NULL
prodcat varchar(128)YES NULL
prodcatID int(11) YES NULL
userrating decimal(1,1)NO NULL
profrating decimal(1,1)NO NULL
lowprice decimal(10,2) NO NULL
highprice decimal(10,2) NO NULL
imageURL varchar(128) NO NULL
dateadded timestamp NO CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
Also tried:
SELECT title from PRprodINFO WHERE MATCH(title) AGAINST ("-'Gears Of War'" IN BOOLEAN MODE) limit 30;
and
SELECT title from PRprodINFO WHERE MATCH(title) AGAINST ("'-Gears Of War'" IN BOOLEAN MODE) limit 30;
but they kind of cancel themselves out, some of the reults are:
'Gears and Gear Cutting Workshop Practice'
'Gears of War 2 Signature Series Guide Bradygames Signature Guides'
'Gears of War 2 Last Stand Edition Guide Bradygames Signature'
'Cream Disraeli Gears Classic Albums DVD RETAIL BUT NOT AVAILABLE TO RENT'
'Gears of War 2 Limited Edition'
'Gears Of War'
'Gears of War 2'
'Gears of War Triple Pack'
'Gears of War 2 Game of the Year Edition'
'Gears of War 3 Limited Edition'
'Gears of War 3'
Which is exactly what i DON'T want
I'm stumped - also, on the title field there is a FULLTEXT index.
Thanks
Darren
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
试试这个:
在单词两边加上单引号。
Try this:
with single quotes around the words.
不支持使用单个否定查询。阅读文档。它指出:
所以这是不可能的。您必须包含其他内容供查询查找,以排除与 - 匹配的行。
这只是我的意见,但我认为尝试返回与某些任意术语不匹配的所有行的列表太过密集。最好的解决方案是使用“like”查询,如下所示。
Using a single negation query isn't supported. Read the documentation. It states:
So this is not possible. You must include something else for the query to find, to exclude the rows matched with the -.
Just my opinion here, but I think it would be way too intensive to try to return a list of all rows that doesn't match some arbitrary term. The best solution would be to use a "like" query as follows.
您将无法使用 MATCH AGAINST 运算符来解决此问题。解决方案是 否定 LIKE< /a> 查询。例如:
You won't be able to solve this problem using MATCH AGAINST operator. A solution would be to negate a LIKE query. E.g: