Search code examples
plonezopedexterity

Plone and dexterity custom index


I've created a custom folderish content type (bobo) using dexterity and a custom index (ibobo) in the catalog. I'm able to put images inside bobo with no problem. The problem is the images are being indexed in ibobo and I don't want this. The ibobo index is working well when I change bobo data but the images keep the old data in its ibobo index. It is crazy because images don't have ibobo index. How can I avoid images indexing in this case? Thank you.


Solution

  • If I understood correctly, you want use a dedicated index for you content type and avoid indexing anything else into your index.

    You can achieve this by

    1. Create a custom indexer using plone.indexerfor you content type interface.

    2. Create an another indexer using plone.indexer for zope.interface.Interface that only to raises AttributeError.

    That should stop the default indexing and only your dedicated content type gets indexed into your index.

    The issue is, that for historical reasons Plone (Zope2/ZCatalog) indexes try to index everything, which either has an attribute with the name of the index (or its configured indexable attribute) or can acquire a such attribute using acquisition.