TagCloud Table Structure?

This is a discussion on TagCloud Table Structure? within the MySQL Database forums, part of the Database Forums category; Hi. I need some help with a tag-cloud. I am wondering a few things: 1) Should I be allowing ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-07-2008
pbd22
 
Posts: n/a
Default TagCloud Table Structure?

Hi.

I need some help with a tag-cloud.
I am wondering a few things:
1) Should I be allowing repetition in my table inserts?
2) I am assuming yes, and, if this is the case, then I am
guessing that the count goes up for all tags of the same name?
How is that done?

Below is my table structure:

CREATE TABLE IF NOT EXISTS mcs.tagcloud (
TagID int(10) unsigned NOT NULL auto_increment,
ScheduleID int(10) unsigned NOT NULL,
Tag varchar(100) NOT NULL,
count int(11) NOT NULL default '0',
hits int(11) NOT NULL default '0',
PRIMARY KEY (TagID),
KEY ScheduleID (ScheduleID),
FOREIGN KEY (ScheduleID) references CommonSchedule(ScheduleID) on
delete cascade on update cascade
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Reply With Quote
  #2 (permalink)  
Old 03-07-2008
Bruno Barberi Gnecco
 
Posts: n/a
Default Re: TagCloud Table Structure?

pbd22 wrote:
> Hi.
>
> I need some help with a tag-cloud.
> I am wondering a few things:
> 1) Should I be allowing repetition in my table inserts?
> 2) I am assuming yes, and, if this is the case, then I am
> guessing that the count goes up for all tags of the same name?
> How is that done?


Why not do something like this:

CREATE TABLE tag (
id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
tagname VARCHAR(50) NOT NULL,

PRIMARY KEY(id),
UNIQUE(tagname)
);

CREATE TABLE tag_schedule (
tag INTEGER UNSIGNED NOT NULL,
target INTEGER UNSIGNED NOT NULL,

PRIMARY KEY (tag, target),
KEY (tag),
KEY (target),
FOREIGN KEY (tag) REFERENCES tag(id),
FOREIGN KEY (target) REFERENCES Schedule(id)
);


--
Bruno Barberi Gnecco <brunobg_at_users.sourceforge.net>
Reply With Quote
  #3 (permalink)  
Old 03-08-2008
pbd22
 
Posts: n/a
Default Re: TagCloud Table Structure?

Bruno, would you mind elaborating on what you have suggested.
Also, tags need to be evaluated based on "popularity" which means
that they increase in value if somebody clicks on an image.

Thanks again,
Peter
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:21 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0