portal_catalog: Archetypes versus GenericSetup

Rob Miller ra at burningman.com
Mon Apr 16 20:28:06 UTC 2007


Maurits van Rees wrote:
> Hi,
> 
> You can put indexes and metadata (columns that end up in the brains)
> into the portal catalog.  It is customary to do this with Archetypes.
> But it can also be done with GenericSetup.  Doing the same thing twice
> does not sound like a good idea.  So I wondered what is the best way now.
> 
> 
> Archetypes
> ----------
> 
> With archetypes you can add an index for a field in your schema, e.g.:
> 
>      index="FieldIndex"
> 
> Or you can add that field to the index *and* to the metadata:
> 
>      index="FieldIndex:brains"
> 
> I do not think it is possible to add a field *only* to the metadata
> with Archetypes, so not in the Index as well.  Am I correct here?
> 
> 
> GenericSetup
> ------------
> 
> With GenericSetup you can add an index in profiles/default/catalog.xml:
> 
>  <index name="getHours" meta_type="FieldIndex">
>   <indexed_attr value="getHours"/>
> 
> and you can add a column to the metadata:
> 
>  <column value="getHours"/>
> 
> 
> Of course when you are aiming for compatibility with Plone 2.1 you
> should just use the Archetypes way.
> 
> But for Plone 2.5 or 3.0, I wonder if it is better to rely on
> GenericSetup only.

i would agree with this statement.  in fact, currently, if you use a 
GenericSetup profile to install and define your types, then you HAVE to use 
the GenericSetup profile to define your custom indexes; the AT schema will NOT 
be parsed for indexing information.  this index parsing usually happens when 
you call AT's 'installTypes' utility function from within a product installer; 
when using GS this never gets called.

-r





More information about the Product-Developers mailing list