<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Tags with MySQL fulltext</title>
	<atom:link href="http://www.pui.ch/phred/archives/2005/05/tags-with-mysql-fulltext.html/feed" rel="self" type="application/rss+xml" />
	<link>http://www.pui.ch/phred/archives/2005/05/tags-with-mysql-fulltext.html</link>
	<description>Philipp Kellers weblog</description>
	<lastBuildDate>Wed, 18 Jan 2012 20:28:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Ricson</title>
		<link>http://www.pui.ch/phred/archives/2005/05/tags-with-mysql-fulltext.html/comment-page-1#comment-133769</link>
		<dc:creator>Ricson</dc:creator>
		<pubDate>Mon, 06 Sep 2010 14:21:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.pui.ch/phred/archives/2005/05/tags-with-mysql-fulltext.html#comment-133769</guid>
		<description>I initially user first solution without fulltext index, at the beginning no performance issue was found. But when I got 500,000 articles on my sites, it took several seconds to fetch the list of articles with specified tag. Then I added full text index on tag field, now it&#039;s much faster on tag query.</description>
		<content:encoded><![CDATA[<p>I initially user first solution without fulltext index, at the beginning no performance issue was found. But when I got 500,000 articles on my sites, it took several seconds to fetch the list of articles with specified tag. Then I added full text index on tag field, now it&#8217;s much faster on tag query.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: S!ava</title>
		<link>http://www.pui.ch/phred/archives/2005/05/tags-with-mysql-fulltext.html/comment-page-1#comment-130763</link>
		<dc:creator>S!ava</dc:creator>
		<pubDate>Sat, 25 Jul 2009 15:18:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.pui.ch/phred/archives/2005/05/tags-with-mysql-fulltext.html#comment-130763</guid>
		<description>Nice solution but limited to use one word tag.
I found another good solution to store tags in the same structure separated by comma. And you can use any character includin &#039;-&#039; in tag name.

CREATE TABLE `delicious` (
`id` int(11) NOT NULL auto_increment,
`tags` text
PRIMARY KEY (`id`),
FULLTEXT KEY (`tags`)
) ENGINE=MyISAM


The sql will be

SELECT * FROM `delicious` WHERE concat(&#039;, &#039;,tags,&#039;,&#039;) like &#039;%, two,%&#039;

and if executed against a table with this data

ID, tags
---------------------------------------
1, &#039;one two three, numbers, consecutive
2, &#039;two times, three times, another tag
3, &#039;tags, two, five, seven&#039;


will show the result:

ID, Tags
---------------------------------------
3, &#039;tags, two, five, seven&#039;</description>
		<content:encoded><![CDATA[<p>Nice solution but limited to use one word tag.<br />
I found another good solution to store tags in the same structure separated by comma. And you can use any character includin &#8216;-&#8217; in tag name.</p>
<p>CREATE TABLE `delicious` (<br />
`id` int(11) NOT NULL auto_increment,<br />
`tags` text<br />
PRIMARY KEY (`id`),<br />
FULLTEXT KEY (`tags`)<br />
) ENGINE=MyISAM</p>
<p>The sql will be</p>
<p>SELECT * FROM `delicious` WHERE concat(&#8216;, &#8216;,tags,&#8217;,') like &#8216;%, two,%&#8217;</p>
<p>and if executed against a table with this data</p>
<p>ID, tags<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
1, &#8216;one two three, numbers, consecutive<br />
2, &#8216;two times, three times, another tag<br />
3, &#8216;tags, two, five, seven&#8217;</p>
<p>will show the result:</p>
<p>ID, Tags<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
3, &#8216;tags, two, five, seven&#8217;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: The Experience Game Blog</title>
		<link>http://www.pui.ch/phred/archives/2005/05/tags-with-mysql-fulltext.html/comment-page-1#comment-129997</link>
		<dc:creator>The Experience Game Blog</dc:creator>
		<pubDate>Wed, 15 Oct 2008 14:23:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.pui.ch/phred/archives/2005/05/tags-with-mysql-fulltext.html#comment-129997</guid>
		<description>&lt;strong&gt;Tags, search and a tagcloud...&lt;/strong&gt;

I have been thinking about how to implement the Tags and which database structure would be best for it. In the end I settled for a method using fulltext search. Now that I had the tags working and knew how search worked I added the actual search functi...</description>
		<content:encoded><![CDATA[<p><strong>Tags, search and a tagcloud&#8230;</strong></p>
<p>I have been thinking about how to implement the Tags and which database structure would be best for it. In the end I settled for a method using fulltext search. Now that I had the tags working and knew how search worked I added the actual search functi&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: html-utvikler &#187; Blog Archive &#187; Tags og MySQL - en perfekt kombinasjon</title>
		<link>http://www.pui.ch/phred/archives/2005/05/tags-with-mysql-fulltext.html/comment-page-1#comment-121104</link>
		<dc:creator>html-utvikler &#187; Blog Archive &#187; Tags og MySQL - en perfekt kombinasjon</dc:creator>
		<pubDate>Wed, 09 Apr 2008 19:23:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.pui.ch/phred/archives/2005/05/tags-with-mysql-fulltext.html#comment-121104</guid>
		<description>[...] Tags with MySQL fulltext [...]</description>
		<content:encoded><![CDATA[<p>[...] Tags with MySQL fulltext [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Egbert Wietses</title>
		<link>http://www.pui.ch/phred/archives/2005/05/tags-with-mysql-fulltext.html/comment-page-1#comment-70680</link>
		<dc:creator>Egbert Wietses</dc:creator>
		<pubDate>Mon, 09 Jul 2007 04:43:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.pui.ch/phred/archives/2005/05/tags-with-mysql-fulltext.html#comment-70680</guid>
		<description>Why not have both, fulltext with mysql and a table wich keeps track off all different tags and adds everytime one tag is used.

- Egbert</description>
		<content:encoded><![CDATA[<p>Why not have both, fulltext with mysql and a table wich keeps track off all different tags and adds everytime one tag is used.</p>
<p>- Egbert</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Philipp Keller</title>
		<link>http://www.pui.ch/phred/archives/2005/05/tags-with-mysql-fulltext.html/comment-page-1#comment-62479</link>
		<dc:creator>Philipp Keller</dc:creator>
		<pubDate>Sun, 10 Jun 2007 13:34:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.pui.ch/phred/archives/2005/05/tags-with-mysql-fulltext.html#comment-62479</guid>
		<description>Nickel: I did some &lt;a href=&quot;http://www.pui.ch/phred/archives/2005/06/tagsystems-performance-tests.html&quot; rel=&quot;nofollow&quot;&gt;perfomance measurements&lt;/a&gt;. It depends how your data looks and how big your database will become. If you &quot;just&quot; have a few thousand entries, then I would go for the &lt;a href=&quot;http://www.pui.ch/phred/archives/2005/04/tags-database-schemas.html#toxi&quot; rel=&quot;nofollow&quot;&gt;&quot;toxi schema&quot;&lt;/a&gt; and would add a &quot;fulltext table&quot; with the columns &quot;bookmark_id&quot;, &quot;user_id&quot; and &quot;tags&quot;. This extra table holds redundant data that helps you with the boolean fulltext queries (much much faster than LIKE queries). If you have less complicated queries (just and), then I&#039;d just stick with the toxi schema and wouldn&#039;t add the extra fulltext table.

As for the tag cloud: If you want to have a &quot;global tag cloud&quot; (whatever this is for, I find them rather silly), you&#039;d have to compute this from time to time. Doing tag clouds with the toxi solution is fairly simple (some group by clauses and you&#039;re in)</description>
		<content:encoded><![CDATA[<p>Nickel: I did some <a href="http://www.pui.ch/phred/archives/2005/06/tagsystems-performance-tests.html" rel="nofollow">perfomance measurements</a>. It depends how your data looks and how big your database will become. If you &#8220;just&#8221; have a few thousand entries, then I would go for the <a href="http://www.pui.ch/phred/archives/2005/04/tags-database-schemas.html#toxi" rel="nofollow">&#8220;toxi schema&#8221;</a> and would add a &#8220;fulltext table&#8221; with the columns &#8220;bookmark_id&#8221;, &#8220;user_id&#8221; and &#8220;tags&#8221;. This extra table holds redundant data that helps you with the boolean fulltext queries (much much faster than LIKE queries). If you have less complicated queries (just and), then I&#8217;d just stick with the toxi schema and wouldn&#8217;t add the extra fulltext table.</p>
<p>As for the tag cloud: If you want to have a &#8220;global tag cloud&#8221; (whatever this is for, I find them rather silly), you&#8217;d have to compute this from time to time. Doing tag clouds with the toxi solution is fairly simple (some group by clauses and you&#8217;re in)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nickel</title>
		<link>http://www.pui.ch/phred/archives/2005/05/tags-with-mysql-fulltext.html/comment-page-1#comment-61364</link>
		<dc:creator>Nickel</dc:creator>
		<pubDate>Thu, 07 Jun 2007 18:32:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.pui.ch/phred/archives/2005/05/tags-with-mysql-fulltext.html#comment-61364</guid>
		<description>Hi guys,

Very informative article and comments!

I will appreciate if you can suggest the most scalable and performance-oriented solution in my scenario. I have a PHP/MySQL based application, with the following DB schema (simplified):

Table: Users
------------
UserID
[other misc. fields]

Table: Bookmarks
----------------
BookmarkID
BookmarkURL
[other misc. fields]

Table: UserBookmarks
--------------------
UBID
UserID
BookmarkID
BookmarkTags (Varchar)

This schema allows multiple users to manage multiple bookmarks. Now, what approach would be ideal in the following two scenarios:

1. If I want to search for bookmarks based on keywords. Eg: &quot;mysql database&quot; -postgres. Programatically, a boolean search parser can be implemented with either &#039;LIKE&#039; or &#039;Fulltext&#039;, but I&#039;m concerned about performance (say with a thousands of bookmarks and tags, and high frequency search queries from the users). I need to show unique bookmarks matching the search query and also the number/count of users who have bookmarked it? What do you guys reckon?

2. If I want to build a tag cloud, displaying all the unique tags and their count per user bookmarks.

Please share your thoughts. Thanks in advance!</description>
		<content:encoded><![CDATA[<p>Hi guys,</p>
<p>Very informative article and comments!</p>
<p>I will appreciate if you can suggest the most scalable and performance-oriented solution in my scenario. I have a PHP/MySQL based application, with the following DB schema (simplified):</p>
<p>Table: Users<br />
&#8212;&#8212;&#8212;&#8212;<br />
UserID<br />
[other misc. fields]</p>
<p>Table: Bookmarks<br />
&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
BookmarkID<br />
BookmarkURL<br />
[other misc. fields]</p>
<p>Table: UserBookmarks<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
UBID<br />
UserID<br />
BookmarkID<br />
BookmarkTags (Varchar)</p>
<p>This schema allows multiple users to manage multiple bookmarks. Now, what approach would be ideal in the following two scenarios:</p>
<p>1. If I want to search for bookmarks based on keywords. Eg: &#8220;mysql database&#8221; -postgres. Programatically, a boolean search parser can be implemented with either &#8216;LIKE&#8217; or &#8216;Fulltext&#8217;, but I&#8217;m concerned about performance (say with a thousands of bookmarks and tags, and high frequency search queries from the users). I need to show unique bookmarks matching the search query and also the number/count of users who have bookmarked it? What do you guys reckon?</p>
<p>2. If I want to build a tag cloud, displaying all the unique tags and their count per user bookmarks.</p>
<p>Please share your thoughts. Thanks in advance!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Philipp Keller</title>
		<link>http://www.pui.ch/phred/archives/2005/05/tags-with-mysql-fulltext.html/comment-page-1#comment-43811</link>
		<dc:creator>Philipp Keller</dc:creator>
		<pubDate>Fri, 23 Mar 2007 12:45:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.pui.ch/phred/archives/2005/05/tags-with-mysql-fulltext.html#comment-43811</guid>
		<description>Mark: You would do that in your program. It is not possible to do this on the database side, that&#039;s actually a downside of this db schema.</description>
		<content:encoded><![CDATA[<p>Mark: You would do that in your program. It is not possible to do this on the database side, that&#8217;s actually a downside of this db schema.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Carey</title>
		<link>http://www.pui.ch/phred/archives/2005/05/tags-with-mysql-fulltext.html/comment-page-1#comment-43807</link>
		<dc:creator>Mark Carey</dc:creator>
		<pubDate>Fri, 23 Mar 2007 12:10:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.pui.ch/phred/archives/2005/05/tags-with-mysql-fulltext.html#comment-43807</guid>
		<description>I like the fulltext approach to tagging.

With this approach what is the best way to generate a list of unique tags, with counts for each?

Such as:

books (3)
programming (10)
work (1)</description>
		<content:encoded><![CDATA[<p>I like the fulltext approach to tagging.</p>
<p>With this approach what is the best way to generate a list of unique tags, with counts for each?</p>
<p>Such as:</p>
<p>books (3)<br />
programming (10)<br />
work (1)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jon lee dot see eh &#187; Blog Archive &#187; mediatemple woes</title>
		<link>http://www.pui.ch/phred/archives/2005/05/tags-with-mysql-fulltext.html/comment-page-1#comment-30619</link>
		<dc:creator>jon lee dot see eh &#187; Blog Archive &#187; mediatemple woes</dc:creator>
		<pubDate>Fri, 02 Feb 2007 19:54:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.pui.ch/phred/archives/2005/05/tags-with-mysql-fulltext.html#comment-30619</guid>
		<description>[...] However, perhaps more exciting is their promise of every user&#8217;s own MySQL container! I hope this means I can finally be able to tinker with my own MySQL server settings! What do I need this for you ask? Well for example for one of my projects I needed to use a MySQL fulltext implementation of a tagging system, and by default, MySQL has its minimum word length limit set to 4, meaning all tags of length 3 or less won&#8217;t be searched! So I asked mediatemple to set ft_min_word_length = 3 but of course they wouldn&#8217;t because that would affect everybody else on my server (grid?) [...]</description>
		<content:encoded><![CDATA[<p>[...] However, perhaps more exciting is their promise of every user&#8217;s own MySQL container! I hope this means I can finally be able to tinker with my own MySQL server settings! What do I need this for you ask? Well for example for one of my projects I needed to use a MySQL fulltext implementation of a tagging system, and by default, MySQL has its minimum word length limit set to 4, meaning all tags of length 3 or less won&#8217;t be searched! So I asked mediatemple to set ft_min_word_length = 3 but of course they wouldn&#8217;t because that would affect everybody else on my server (grid?) [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

