MySQL MATCH AGAINST efficiency
I have a small PHP articles sy开发者_运维技巧stem, and I'd like to add a Similar Articles list to each article (that would obviously be loaded very frequently).
I figured I should use MATCH AGAINST in order to populate the similar articles list, based on the title of articles. The thing is, how would I go about actually implementing it? Is performing the MATCH AGAINST query on each view of an article too intensive, or fine? If it is too intensive, what are the alternatives?Thanks.
If you want to find those articles that is similar to the current article's title, then try MATCH AGAINST and see how it performs. Running a query like this every time an article added (or title being modified) should not be a performance problem.
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('@newtitle');
However, if you want to find similar articles based on the whole text of the article, you may want to try calculate similarity between article bodies and see if it gives better results then MATCH AGAINST title
In general, first I'd worry about actually finding the really similar articles, and then I may start worry about the performance. Good luck.
精彩评论