应该是你的全文搜索创建不成功吧!
错误提示找不到与全文搜索相匹配的列,你先用一个字段来试试看
mysql>create fulltext index ftitle on jgdmaterial (title);

解决方案 »

  1.   

    试过了,不行。在管理员工具下看的时候,建好了索引了,但是,发现索引的类型不是btree,是default,和这个有关系吗?在建索引时能不能建成btree类型的?
      

  2.   

    跟索引的类型没有关系,我发现的原因。
    只要你把
    select id from jgdmaterial where match (title) against ('material');
    改成
    select id from jgdmaterial where match (title,author) against ('material');
    就行了。
    以下是我所做的试验
    mysql> CREATE TABLE articles (
        -> id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
        -> title VARCHAR(200),
        ->  body TEXT,
        -> FULLTEXT (title,body)
        ->  );
    Query OK, 0 rows affected (0.12 sec)mysql> INSERT INTO articles VALUES
        -> (NULL,'MySQL Tutorial', 'DBMS stands for DataBase ...'),
        -> (NULL,'How To Use MySQL Efficiently', 'After you went through a ...'),
        -> (NULL,'Optimising MySQL','In this tutorial we will show ...'),
        -> (NULL,'1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
        -> (NULL,'MySQL vs. YourSQL', 'In the following database comparison ...'),
        -> (NULL,'MySQL Security', 'When configured properly, MySQL ...')
        -> ;
    Query OK, 6 rows affected (0.02 sec)
    Records: 6  Duplicates: 0  Warnings: 0mysql> select * from articles;
    +----+------------------------------+------------------------------------------+| id | title                        | body                                     |+----+------------------------------+------------------------------------------+|  1 | MySQL Tutorial               | DBMS stands for DataBase ...             ||  2 | How To Use MySQL Efficiently | After you went through a ...             ||  3 | Optimising MySQL             | In this tutorial we will show ...        ||  4 | 1001 MySQL Tricks            | 1. Never run mysqld as root. 2. ...      ||  5 | MySQL vs. YourSQL            | In the following database comparison ... ||  6 | MySQL Security               | When configured properly, MySQL ...      |+----+------------------------------+------------------------------------------+6 rows in set (0.00 sec)mysql> SELECT * FROM articles
        -> WHERE MATCH (title,body) AGAINST ('database');
    +----+-------------------+------------------------------------------+
    | id | title             | body                                     |
    +----+-------------------+------------------------------------------+
    |  5 | MySQL vs. YourSQL | In the following database comparison ... |
    |  1 | MySQL Tutorial    | DBMS stands for DataBase ...             |
    +----+-------------------+------------------------------------------+
    2 rows in set (0.04 sec)mysql> SELECT * FROM articles
        ->  WHERE MATCH (title) AGAINST ('database');
    ERROR 1191 (HY000): Can't find FULLTEXT index matching the column list
      

  3.   

    果真是这样,但这样出了问题了,我如何满足用户检索title和author呢?总不能在title和author中一块检吧?更要命的是,如果加入了fullcontent字段(全文字段),那是不是只能这样一块检了,不能区分检标题还是检内容?
      

  4.   

    我猜的:
    这个全文索引可能不像MSSQL一样,做一个索引就可以了,如果分开检不同字段的话,是不是就得创建多个?
    create fulltext index f_title on jgdmaterial (title);
    create fulltext index f_author on jgdmaterial (author);select count(*) from jgdmaterial where match (title) against ('material');
    select count(*) from jgdmaterial where match (author) against ('david');试试,可能是这样。