Planning my next mod; Related articles in sNews CMS

Planning my next mod; Related articles in sNews CMS

OK, in playing around with MySQL's full text capabilities for an advanced search function I also thought about doing a "related posts" function along similar lines, like so many other blogs use, i.e. WordPress has several related posts type plugins. Today I have begun work on this monster of a mod, I've already been grinding out some tasty regular expressions and have much of the core MySQL full-text match code done.

I've always hated the way the typical related posts mod seems to just use basic tags/category matching, or a simple MySQL LIKE query, which results in much of the "related posts" not actually being such. Therefore I will use full-text matching and ranking of the keywords, which will be adjustable by the end user.

The beauty of full-text is speed and relevance, in my mod you will be able to increase relevance on certain items... i.e. rank higher any matches with the title or description words, then matches words from the body of the article against the other articles text at a lower ranking.

Done right, this will result in providing automatically generated related posts (that are actually related), and sorted by relevance. This is a beautiful thing, and using IN BOOLEAN MODE returns the match count (adjusted for ranking) in it's score, you can set a threshold, so if you only have 2 or 3 articles that are truly related, and just happen to have 5 or so similar words in an unrelated article, the unrelated article won't be displayed because it failed to meet that threshold.

There is no magic number, it will likely vary depending on ranking settings (obviously) but also the length of your articles, i.e. if your average article is only 50 words, you may need a lower threshold. I'm still tinkering to find the perfect score for me at the moment.

Once I've got it in good enough shape I will try it live on my site and then release it for public consumption.



You might like


No comments have been posted to this page.

Comments are closed. No new comments allowed.

Copyleft 2002 - 2017 Matt Jones
Hand crafted with HTML5 & CSS3
↑ Back to top