Secondary catalog with Dexterity


I'm working on bika.lims which is largely Archetype based. Because the long term objective is to move everything to dexterity, all new types are being developed with dexterity. Also, the product makes use of 2 catalogs other than portal_catalog which is easy to configure with archetype_tool's setCatalogByType - it allows you to specify an alternative catalog for each portal type.

I've been looking to do something similar for a new dexterity portal type. I followed this example in plone.indexer and when my new object is created, I see that the class is initialized and called but nothing new appears in the catalog. Is anyone using a secondary catalog and/or done something that mimics AT's setCatalogByType method?


this is very old, unmaintained and Grok-based, but you can find the answer to your question on it:

Products.membrane depends on collective.indexing for indexing DX objects into its catalog

Thanks guys. I've used the relevant methods from the person class in
p17.person product in my product and it works well until I hit Clear and
Rebuild and lot everything. I then found a clearNadRebuild method in this
and added my content type to the list of metatypes to be reindexed but that
didn't work because ZopeFindAndApply is matching on meta_type and not
portal_type. I tried changing the meta_type but it didn't get them
reindexed. Anyone got any pointers and more importantly, will I break
something if I set my content type's meta_type to something besides
'Dexterity FTI'?

Hi all, I'm still wrestling with ZopeFindAndApply. Does anyone know if
there is an alternative function that allows one to filter by portal_type
or interface rather than meta_type?

I would write a script for that (and activate it either via bin/{instance|client1} run or put it into a view and activate via an HTTP request). ZopeFindAndApply uses the object{Ids|Values|Items} family to determine the children of an object; alteratively, you could use the content{Ids|Values|Items} family (defined by the CMF and giving the content children).

If you have a perfect integration, calling the object's indexObject may be enough to index an object in all relevant catalogues. Otherwise, you may need to call the various catalogue's catalog_object for the object.

Hi Dieter,

In my clearAndRebuild I'll write a function that uses objectItems to
traverse the entire site to find objects of the required interfaces.


I fight also :wink: , sorry for bringing up this thread.
In the Docs is the Method self.reindexObject(obj) documented, but my Catalog ist empty after Clear&Rebuild.
I look in some Code and other Examples and find a alternate Solution. But i don't know ist this right? It's a Typo in the Example? Maybe because the Decorator of the Parent Method is: @security.private ?


def indexObject(self, object, idxs=None):
    # Add object to catalog.
    # The optional idxs argument is a list of specific indexes
    # to populate (all of them by default).
    if idxs is None:
        idxs = []
        self.reindexObject(object, idxs)

class MyCatalog(CatalogTool):
    security.declareProtected(ManagePortal, 'clearFindAndRebuild')
    def clearFindAndRebuild(self):

        def indexObject(obj, path):
            # only this interface is allowed
            if ICustomType.providedBy(obj):
                """did not the job, but is in the Example in the Docs
                # self.reindexObject(obj)

                """this call did the job:
                super(MyCatalog, self)._reindexObject(obj)


        portal = getToolByName(self, 'portal_url').getPortalObject()