本文介绍了MySQL加入和匹配/搜索失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我基本上试图创建搜索来查找文章(或来自作者的文章)。我已经结束了这个查询: SELECT`articles`。*,`authors`。* FROM `articles` LEFT JOIN`authors` ON(`authors`.`id` =`articles`.`author_id`) WHERE MATCH(`articles`.`title`,`articles`.`描述`) AGAINST(test)或MATCH(`authors`.`first_name`,`authors`.`last_name`) AGAINST(test) GROUP BY`articles`.`id` 我确定所有四个匹配的字段都是全文索引。搜索匹配并找到用户名为'Kevin'的所有文章,但如果我搜索名为'Test'的文章(它存在),则不匹配。 解决方案匹配will 不是找到停止单词的分数。 在$ 50%的结果中发生,或在正式停用词列表™中。 请参阅: http://dev.mysql.com/doc/refman/5.5/en/fulltext- stopwords.html And: http://dev.mysql.com/doc/refman/5.5/en/fulltext-search.html 对于微调Match Match,请参阅: http://dev.mysql.com/doc/refman/ 5.5 / en / fulltext-fine-tuning.html I'm basically trying to create a search to find articles (or articles from an author). I've ended up with this query: SELECT `articles`.*, `authors`.* FROM `articles`LEFT JOIN `authors` ON (`authors`.`id` = `articles`.`author_id`) WHERE MATCH (`articles`.`title`, `articles`.`description`) AGAINST ("test") OR MATCH (`authors`.`first_name`, `authors`.`last_name`) AGAINST ("test") GROUP BY `articles`.`id`I have made sure that all four matched fields are FULL TEXT indexes. The search matches against and finds all articles made by a user with first name 'Kevin' but will not match if I search for articles named 'Test' (which exists). 解决方案 Match against will not find a score for "stop" words.Stop words are words that occur in 50%+ of the results,or that are in the official stop word list™.See: http://dev.mysql.com/doc/refman/5.5/en/fulltext-stopwords.htmlAnd: http://dev.mysql.com/doc/refman/5.5/en/fulltext-search.htmlFor finetuning Match Against see: http://dev.mysql.com/doc/refman/5.5/en/fulltext-fine-tuning.html 这篇关于MySQL加入和匹配/搜索失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-17 05:43