MySQL FULLTEXT不能用于多个字段 [英] MySQL FULLTEXT won't work with more than one field

查看:189
本文介绍了MySQL FULLTEXT不能用于多个字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个bog标准的MySQL全文查询,如下所示:

SELECT * FROM accounts WHERE MATCH(first_name,username)AGAINST('stringhere ')



问题是,它无法在字段 first_name ,尽管我现在已经索引了几次。它可以正常工作,当我这样做:
$ b $ p code $选择*从帐户WHERE MATCH(用户名)AGAINST('字符串')



或者:

SELECT * FROM accounts WHERE MATCH(first_name)AGAINST ('stringhere')



但不包含两个或更多字段。我在这里做错了什么?我已经确定索引是在字段上设置的,我甚至修复了表格,但仍然没有工作: - (



使用这个结果多个字段:

查询中的错误:无法找到与列列表匹配的FULLTEXT索引



这是令人困惑和恼怒的,因为像我说的,我已经明确定义了全文索引。



感谢您的任何帮助,



James

解决方案

  show create table accounts 

我想你有这样的东西:

  FULLTEXT(first_name)
FULLTEXT )

而不是

  FULLTEXT(名字,用户名)


I have a bog standard MySQL fulltext query as follows:

SELECT * FROM accounts WHERE MATCH(first_name, username) AGAINST ('stringhere')

The problem is, it can't find the fulltext index on the field first_name, even though I've indexed it a few times now. It works fine when I do this:

SELECT * FROM accounts WHERE MATCH(username) AGAINST ('stringhere')

Or this:

SELECT * FROM accounts WHERE MATCH(first_name) AGAINST ('stringhere')

But not with two or more fields. What am I doing wrong here? I've made sure the indexes are set on the fields, and I've even REPAIRed the table, but still no worky :-(

I get this result when using more than one field:

Error in query: Can't find FULLTEXT index matching the column list

Which is confusing and irritating because, like I said, I have definitely defined the fulltext index.

Thanks for any help,

James

解决方案

It would be useful to see the output of

show create table accounts

I suppose that you have something like

FULLTEXT(first_name)
FULLTEXT(username)

instead of

FULLTEXT(first_name,username) 

这篇关于MySQL FULLTEXT不能用于多个字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆