zope portal catalog - the difference between metadata and index contents
This post was written 6 years ago.
Fri, 08 Sep 2006
I always forget this - when doing a zope catalog query, you are searching the index contents not the metadata contents. If there is a field in your metadata that you want to be able to use as a variable in a portal catlog query, you need to add the field as an index and then reindex the catalog (or just the new field within the catalog).
For example I was generating some custom tabs for the contents of a particular folder within a plone site and I wanted the catalog query to exclude any items with the "exclude_from_nav" field set to True. It wasn't listening to me. The solution was to go to portal_catalog -> indexes and add a new field index 'exclude_from_nav' (i.e the field name needs to match the meta data field name). Tick the box next to the new 'exclude_from_nav' and hit the reindex button. Now the catalog is aware of this field and which objects in the zodb are set to true and false.
For example I was generating some custom tabs for the contents of a particular folder within a plone site and I wanted the catalog query to exclude any items with the "exclude_from_nav" field set to True. It wasn't listening to me. The solution was to go to portal_catalog -> indexes and add a new field index 'exclude_from_nav' (i.e the field name needs to match the meta data field name). Tick the box next to the new 'exclude_from_nav' and hit the reindex button. Now the catalog is aware of this field and which objects in the zodb are set to true and false.
This post was written 6 years ago, which in internet time is really, really old. This means that what is written above, and the links contained within, may now be obsolete, inaccurate or wildly out of context, so please bear that in mind :)
Comments
Eric 2007-05-13 00:53:24
Rick 2007-05-13 19:35:16
Can you provide an example on how to use this in my AT Class file (filesystem based product)?
Thanks much.
Eric
Eric 2007-05-13 19:48:34
Rick 2007-05-13 20:03:09