I need to implement a custom scoring system in my database design. My program is a system of tags. My site is a dating site filled with tags about a particular person. A person will search for potential dates by using tags only. Each tag is rated from 1 to 10 depending on the person rates themselves on a certain tag. Here is how it works:
Search query:
Search for a girlfriend or boyfriend
Tag Rating
--------------- ------
Good-with-kids 5
athletic-figure 9
intelligence 8
cooking 10
In the query above, someone searched for all these tags and their ratings against my database that has a collection of tags where people have rated themselves on these tags.
My problem:
When i run the query i can match profiles that contain all the tags. If a user runs a search query I would like the system to capture users that did not match all tags. If a query did not match all tags it should be ranked lower.
Do you know of a good database layout to do this?
Assuming
A table containing a list of tags
tags (id, name)
A table containing a mapping of users to tags with a weight/ranking attribute
user_tags(user_id, tag_id, weight)
Query