MySQL Join and Match/Against Search Fail

北战南征 提交于 2019-12-13 07:25:01

问题


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).


回答1:


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.html
And: http://dev.mysql.com/doc/refman/5.5/en/fulltext-search.html

For finetuning Match Against see: http://dev.mysql.com/doc/refman/5.5/en/fulltext-fine-tuning.html



来源:https://stackoverflow.com/questions/5925369/mysql-join-and-match-against-search-fail

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!