字段: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
有没有好办法?
PHPz2017-04-17 14:58:21
alter table aws_articles add fulltext(title,abstract); It’s ok. Create a joint index, but building it alone will not work
高洛峰2017-04-17 14:58:21
If it is an English field, as @haixia9060 said, you can create a new index and query
Create a new index on three fields
ALTER TABLE articles ADD FULLTEXT content_title_keywords_ndx (content,title,keywords);
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;