The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

How To implement Tagging

I am working on a Lessons learned database where users can create items that they have documented as problems and the necessary steps / processes needed to fix and avoid the problem in the future.  Originally I had thought of creating multiple levels of categorization to identify the type of issues so users in the future will be able to easily search for them.  Now I am rethinking this, I think that the tagging mechanism on so many web sites would be a better approach.

The questions is this... How To implement Tagging?  Do these types of systems have a column / field on each table that can be searched called "tags' separated by say a ';' , do they have a 'Tags' table that joins to each record in the other tables where the Tags table has just a list of Tag words and a non binding FK? 

Any help on this would be greatly appreciated.

Thanks
Chris Hoffman Send private email
Tuesday, October 02, 2007
 
 
Have a Tags table with an id and name.
Have a many:many linking the Tags to the content.

If you want the items searchable, filterable, tags updatable, etc (aka the whole point of tagging), don't put them in a single field.  That's the fastest way to make your life painful.
KC Send private email
Tuesday, October 02, 2007
 
 
Are you working at a major department of the US Government?
John Cromartie Send private email
Tuesday, October 02, 2007
 
 
I'm not working for the government, but at an aerospace company that does have projects with the government.  The data in question though is for internal use only.  Right now we have ~ 2000 engineers at my site (more if you include all sites) and they mostly track these items in an excel spreadsheet that gets printed out periodically and stored in a 3 ring binder.
Chris Hoffman Send private email
Tuesday, October 02, 2007
 
 
Think about it this way: Each 'tag' has multiple items that have that tag attached. Each item may have multiple tags attached. This is a classic many-to-many relationship and should be implemented as such:

  create table items
      id integer primary key;
      ...
  end

  create table tags
      id integer primary key;
      ...
  end

  create table item_tag
      item_id integer foreign key on items.id
      tag_id integer foreign key on tags.id
  end

Doing it any other way is just asking for trouble.
Jeffrey Dutky Send private email
Tuesday, October 02, 2007
 
 
+900  Jeffrey Dutky

:)
Totally Agreeing
Tuesday, October 02, 2007
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz