mercredi 4 février 2015

database structure for an object of keywords


Each object I am storing is made up of a title, a description and 10-20 keywords. Each keyword is grouped and some groups can only have one member keyword assigned to an object. Objects will only have one instance of any keyword. Typical queries are



  • Objects with given keyword(s)

  • Count of objects with given keyword(s)

  • Object title, description, and all applied keywords


I am thinking that EAV is the pattern I should use for that and apply the group limiting problematically and leave the DB promiscuous. However both throw red flags.


As I see it my options are:


EAV



  • table of objects - id,title,description

  • table of keywords - keyword, group

  • table of object/keyword links - object_id, keyword


In Table


The table of objects holds the id, title, description plus columns for the groups that have a limit on a single keyword from the group, and a column where keywords from unlimited groups are in a comma separated list. In this case the filter queries of objects with given keyword(s) will be more complex but I will (mostly) be avoiding the EAV pattern. But this seems inelegant.


thoughts?





Aucun commentaire:

Enregistrer un commentaire