[Zope] ZCatalog updating

R. David Murray bitz@bitdance.com
Mon, 31 Jul 2000 12:37:10 -0400 (EDT)


On Mon, 31 Jul 2000, Aaron Williamson wrote:
> I am convinced this is a stupid question that has been answered a
> hundred times already, but after scouring zope.org and the archives, I
> still don't know the answer, so...
> 
> How can I automatically update my ZCatalog when items have been
> added/modified/changed?

Any objects that you want to be automatically updated in the Catalog
must have CatalogAware as one of their base classes.  And then you
have to add a reindex_object call to any forms that add or update
them.  (I fail to understand why one has to explictly call
reindex_object when properties change, even though I think someone
tried to explain it to me once).

I suppose you could do something similar with non-catalog aware
objects, where you made sure the add/update forms called the Catalog
to index them, but they wouldn't get deleted from the catalog automatically,
or reindexed automaticaly when moved.  If you are writing your own
management screens for those operations, though, you could make
it all work, I think.

You could also use ZSchedular to perioducally run the commands to
reindex your site, if instaneous reindexing is not a requirement.

--RDM