[wp-hackers] Taxonomy Schema Proposal
stevelle at gmail.com
Tue Apr 17 17:48:54 GMT 2007
On 4/16/07, Jamie Talbot <wphackers at jamietalbot.com> wrote:
> In the trac ticket, it was initially thought that synonyms could be a
> feature added by a plugin.
At this point the API and upgrade patterns suggest that adding columns to
existing tables is a dangerous thing for plugins to attempt. I wanted to at
least air that here. It could be addressed a number of ways, but making
sure the topic is explored earlier then later seemed wise.
term_group bigint(10) NOT NULL default 0
I would suggest alias_term_id as a column name, but a self-join was my first
thought. Using the word 'group' is very often a gateway to pain IME. That
word is just too easily overloaded and vague, though the idea of using this
as a lever to achieve translation is clever I have to admit. This solution
is distinct from the category type of hierarchy in that you only need to
manage a level of depth of 0 and 1. That means when you add a new alias,
you only alias to root terms, not to aliases. That simplifies the interface
and the data model tremendously.
Lookup by slug is easy.
Notice I slipped a trick into that one. You don't know if 'products' is a
tag or a post category or ... based on the URL. It isn't clear that we
> Lookup by both is still easy, but a bit more inefficient as you'd have to
> do an IN(term_ids) based on all the returned tags from the above query.
Couldn't you just self join, take the 'parent' term_id, and then lookup
objects based on that term_id? No need for an IN clause if the 'parent'
term_id points at itself, as you suggested in your reply. Of course getting
that inserted id into the alias column is it's own challenge. :)
More information about the wp-hackers