开发者

MySQL Join and Match/Against Search Fail

开发者 https://www.devze.com 2023-03-03 12:32 出处:网络
I\'m basically trying to create a search to find articles (or articles from an author). I\'ve ended up with this query:

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号