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.