I have posts, and those posts have tags. Now what i would like to do
is find, for a given post, the most similar posts based on the tags
they have. I’d like to retrieve a list with all the posts from all the
tags that the given post has, ordered by the number of how many
similar tags they (the post and the retrieved posts) have.
Can anybody give a hint for doing something like this?
I’ve no idea, how you could directly query your tags
and get those results. I think even to make areasonable
decision on how “similar” two give words may be.
If you want only the number of equal words, you could
count them.
But I would strongly recommend using a good indexing
& search engine to do this. I’ve just moved a project
with acts_as_taggable from ferret to sphinx and found
sphinx a wonderful tool for such things. Ordering results
by relevance & weighting fields works out of the box.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.