Igor Stroh wrote:
> Hi there,
> I'm trying to figure out the best way to implements a general
> solution for tags (like tags on flickr or del.icio.us). So far
> I've two different approaches, maybe someone could comment on
> them:
> 1) Store the tags as attributes of the particular content types.
>    Searching for tagged content is handled by a catalog index.
>    New tags are created by simply adding them to the object,
>    a collection of tags is the set of all tags from the catalog.
>    Drawbacks: centralized tag management is inefficient, e.g.
>    deleting a tag implies searching for the particular tag and
>    removing it from all objects it was tagged with.
> 2) Store tags in a local utility. The utility manages a
>    tag -> intids mapping (similar to a catalog index).
>    Searching for tags is easy - just query the mapping
>    for appropriate keys. New tags are created by adding
>    a new key to the mapping, a (weighted) collection of
>    tags is the list if mapping keys.
>    Drawbacks: I can't think of any right now

I would use annotations to store the tags. That way you can tag any
object you'd like. Using IDublinCore's keywords would even be possible.
Then, to find objects with a certain tag, use the catalog. The field
index knows how to adapt objects to a certain interface before indexing,
for example. Yes, this would make deleting a tag more expensive, but how
often does that happen anyways?


Zope3-users mailing list

Reply via email to