Consider a simple query as
SELECT * FROM posts
JOIN tags USING(post_id)
JOIN tag_map USING(tag_id)
WHERE tags.tag IN('tag1', 'tag2', 'tag3')
tag_map is a many-to-many relationship between tables posts and tags.
In this query, mysql will find all posts tagged by any of these words, and order them by PRIMARY KEY.
How can we order the results by tag weight:
- posts witch tagged with more words in the list (first posts with three tags from the list, then with two words, ...)
- posts witch tagged with first words (first posts tagged with tag1 then posts tagged with tag2).
tag_mapis a many<>many relationship between forum/blog posts and tags that have been associated with each post? – Phil May 13 '12 at 17:25