I want to allow users to tag items so that they can search for them using tags. What is the best way to achieve this? So far, the solution I came up with has only added two additional tables to my current db system.
<db Trackable product 1>
int id;
info etc
</>
<db Trackable product 2>
int id;
info etc
</>
//defines the M:M relationship between Tag and various types of Trackable products
<db TagLink>
int trackableProd1Id
int trackableProd2Id
int tagId
</>
<db Tag>
int tagId
tag name etc
</>
Is this a good way? The advantage of this approach is that it should scale well and also allows me to add more tracked products in the future by simply adding a column to the TagLink table. This, of course, is not a good idea, if I plan to track 10 tables, but for 3-4 tables this should work well, right?