How do you implement the 'related tags' functionality as used in many websites like our stackoverflow.com and http://tagexplorer.sandbox.yahoo.com/.
My guess is that it is a correlation between which tags are most often used together.
For example:
Then it's natural to assume that tag2 "is related to" tag1.
I would say the best place to learn would be O'Reilly's Programming Collective Intelligence book.
A couple of ways come to mind. You could just do a quick query to select related tag names:
SELECT * FROM tags WHERE tag_name LIKE '%$current_tag%'
Another way would be to actually setup your tag table to have a relations field, maybe related IDs separated by commas, but this seems hellish to maintain.
I'm sure someone will come up with a better answer, so I'm quite curious as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With