ZCatalog doesn't do well on hierarchical searches like this. The way you're doing it (without some sort of change to your objects' structures) is pretty much the only way. There's a "ZTopics" product floating around that is supposed to provide functionality like this, but 1) I don't know if it's released, 2) I've never used it. You *could* add a method to your "superobjects" that returned the meta_type of all of its subobjects and add that to the Catalog index, e.g. def getChildMetaTypes(self): return map(lambda x: getattr(x, 'meta_type'), self.objectValues()) then add getChildMetaTypes as a keyword index... then... for x in Catalog.searchResults(getChildMetaTypes="My Kind Of Object"): ... Menard.Jean-Francois@hydro.qc.ca wrote:
(Post #2) I'm trying to search a zCatalog to find all the objects containing a certain type of sub-object.
Right now, I use a dtml-if inside the result loop, but the result count is obviously wrong.
There must be a better way to do this, right?
Jean-François Ménard Intranet DPAS Pratiques d'affaires et orientations * (514) 840-3000 poste 3939 * (514) 840-5585 * menard.jean-francois@hydro.qc.ca * 855 Ste-Catherine est, 6e étage Montréal, Qué. H2L 4P5
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- Chris McDonough Digital Creations Publishers of Zope - http://www.zope.org