mysql - 两个全文索引的字段能否并在一起查询
PHP中文网
PHP中文网 2017-04-17 14:56:21
0
3
797

字段:title,article,都是全文索引。

查询关键词:key1,key2,key3。

SELECT * FROM [表名] WHERE MATCH(article) AGAINST('key1,key2,key3');针对一个全文检索的字段是可行的

有没有这种:

SELECT * FROM [表名] WHERE MATCH(title,article) AGAINST('key1,key2,key3');

即同时在title+abstract中查找key1,key2,key3。但错误提示:Can't find FULLTEXT index matching the column list

有没有好办法?

PHP中文网
PHP中文网

认证0级讲师

reply all(3)
PHPzhong

alter table aws_articles add fulltext(title,abstract); It’s ok. Create a joint index, but building it alone will not work

阿神

Which version of MySQL is it? Does full-text search support Chinese?

小葫芦

If it is an English field, as @haixia9060 said, you can create a new index and query

  1. Create a new index on three fields

    ALTER TABLE articles ADD FULLTEXT content_title_keywords_ndx (content,title,keywords);
    
  2. Query

    match(content,title,keywords) against ('cats' in boolean mode)
    

    MySQL can only handle English/numeric types by default;

If it is a Chinese field, the inverted index should be maintained according to the process (Document->Token->Term->Index);
There is also a MySQL field specified by Analyzer to automatically maintain the index and synchronize it to Solr in real time. How to perform full-text indexing;

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!