MySQL Match问题 [英] MySQL Match issue
问题描述
请参阅我以前的stackoverflow post 我正在尝试查找已发送消息中的相似之处通过以下方式:
Referring to my earlier stackoverflow post I'm trying to look for similarities in messages sent via the following:
SELECT id, MATCH (content) AGAINST (content) AS score FROM pms_messages WHERE sender_id = '.$sender_id.' AND MATCH (content) AGAINST (content) AND score > 1;
我看到错误:#1210-AGAINST的参数不正确
I see the error: #1210 - Incorrect arguments to AGAINST
我在内容字段上设置了FULLTEXT索引.来自phpmyadmin:
I've set a FULLTEXT index on my content field. From phpmyadmin:
Edit Drop fulltext_index FULLTEXT No No content 1
我想念什么?
推荐答案
当收到错误消息时,请务必阅读本手册,它对您的帮助最快:
Always read the manual when you get an error message, it's helpful most quickly:
AGAINST需要一个字符串来搜索,以及一个可选的修饰符,该修饰符指示要执行的搜索类型.搜索字符串必须是文字字符串,而不是变量或列名.
AGAINST takes a string to search for, and an optional modifier that indicates what type of search to perform. The search string must be a literal string, not a variable or a column name.
参考: http://dev.mysql. com/doc/refman/5.0/en/fulltext-search.html#function_match
因此,您尝试实现的目标是错误的.使用文字字符串而不是列名.
So what you try to achieve is done wrong. Use a literal string instead of a column name.
另请参见 11.9.5.全文限制 文档 ,特别是:
AGAINST()
的参数必须为常量字符串.
- The argument to
AGAINST()
must be a constant string.
这篇关于MySQL Match问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!