Re: Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist
| From: | Richard Quadling | Date: | Thu, 20 Jan 2011 17:21:27 +0000 |
| Subject: | Re: Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-310904@lists.php.net to get a copy of this message | ||
On 20 January 2011 16:20, Dotan Cohen <dotancohen@gmail.com> wrote:
> On Thu, Jan 20, 2011 at 17:00, Richard Quadling <rquadling@gmail.com> wrote:
>> I'd have my items table, my tags table and a join table for the two.
>> My join table is really simple. UniqueID, ItemID, TagID.
>>
>
> Yes, that is the first approach that I mentioned. It looks to be a
> good compromise.
>
>
>> I'd recommend using a nested set approach for the tags
>> (http://dev.mysql.com/tech-resources/articles/hierarchical-data.html
>> gives a good explanation on the issues and methodology of nested
>> sets).
>>
>
> That is terrific, at least the first half. The second half, with the
> Venn diagrams, is awkward!
>
> --
> Dotan Cohen
>
> http://gibberish.co.il
> http://what-is-what.com
>
When you get heavily nested data, the adjacent set model (where you
have a parentid for every uniqueid), you very quickly get into
complicated logic trying to traverse n-levels. The nested set model is
specifically built to handle this issue. I'd recommend getting to
grips with it. It will make finding items belonging to a group (or a
super group) a LOT easier.
Especially if you have multiple tag hierarchies.
--
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY