Mailinglisten-Archive |
Hi,
ich möchte einen vorhandenen FULLTEXT-Index erweitern auf mehrere Spalten,
d.h. rauswerfen und für mehrere Spalten neu anlegen. Die DB ist noch im
Testzustand, es ist erst ein record drin. DB-Version ist 3.23.30-gamma-log.
Der Index soll über folgende Spalten gehen:
+--------------+--------------+------+-----+---------+----------------+---------------------------------+
| Field | Type | Null | Key | Default | Extra | Privileges |
+--------------+--------------+------+-----+---------+----------------+---------------------------------+
| storytitle | varchar(100) | YES | | NULL | | select,insert,update,references |
| storytext | text | YES | | NULL | | select,insert,update,references |
| keywords | text | YES | | NULL | | select,insert,update,references |
| persons | text | YES | | NULL | | select,insert,update,references |
...
Nun lege ich einen neuen FULLTEXT an mit
mysql> create fulltext index fullt_idx on stories (storytext,storytitle,persons,keywords);
Query OK, 1 row affected (0.09 sec)
Records: 1 Duplicates: 0 Warnings: 0
mysql> show index from stories;
+---------+------------+-----------+--------------+-------------+-----------+-------------+----------+--------+----------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Comment |
+---------+------------+-----------+--------------+-------------+-----------+-------------+----------+--------+----------+
| stories | 0 | PRIMARY | 1 | storyid | A | 1 | NULL | NULL | |
| stories | 1 | userid | 1 | userid | A | NULL | NULL | NULL | |
| stories | 1 | storyid | 1 | storyid | A | NULL | NULL | NULL | |
| stories | 1 | fullt_idx | 1 | storytext | A | NULL | 1 | NULL | FULLTEXT |
| stories | 1 | fullt_idx | 2 | storytitle | A | NULL | NULL | NULL | FULLTEXT |
| stories | 1 | fullt_idx | 3 | persons | A | NULL | 1 | NULL | FULLTEXT |
| stories | 1 | fullt_idx | 4 | keywords | A | NULL | 1 | NULL | FULLTEXT |
+---------+------------+-----------+--------------+-------------+-----------+-------------+----------+--------+----------+
Frage: sieht das gut aus?
Nun eine Abfrage:
mysql> SELECT storyid,storytitle,storytext,userid,totalquality,publishdate,eventdate, MATCH (storytext) AGAINST ('linux') AS score FROM stories WHERE MATCH (storytext) AGAINST ('linux');
ERROR 1191: Can't find FULLTEXT index matching the column list
Warum? Wenn ich den Index nur auf die Spalte storytext lege, ist es okay.
TIA!
--
Harald Milz | hm_(at)_linux-magazin.de | Cold, adj.: When the
Linux New Media AG | phone +49 (0) 89 993411-20 | local flashers are
Stefan-George-Ring 24 | fax +49 (0) 89 993411-99 | handing out written
D-81929 Muenchen | http://www.linux-magazin.de | descriptions.
---
!!NEU!!
Fragen und Antworten zu MySQL und dieser Liste unter
-->> http://www.4t2.com/mysql
php::bar PHP Wiki - Listenarchive