Rick Hurst Web Developer in Bristol, UK

Menu

zope portal catalog – the difference between metadata and index contents

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.

archived comments

Where does one set ‘exclude_from_nav’ to true?

Eric 2007-05-13 00:53:24

exclude_from_nav is a field within the metatdata of a plone page – it is set using the check box Exclude from navigation on the properties tab when editing a page or other plone content type

Rick 2007-05-13 19:35:16

Thank you, Rick.

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

If your AT class file inherits from another plone content type then you do not need to add this field, as it will be inherited by your content type. I’ve never had to add it in – I just did a quick search and see that it is an Accessor in ATContentTypes/content/base.py – it is actually returning a value from a var called excludeFromNav – where ever that is coming from

Rick 2007-05-13 20:03:09