I followed Automatic Cataloging example in Zope Book, Chapter 9. Everything works fine except automatic cataloging of newly created fields ("author", "content"). When I change data in those fields it is not reflected in the catalog. When I add a new instance, it is not included in the catalog. This can be verified by clicking on the Catalog tab, and choosing the newly added instance (the page that says "the goal of this page is to provide basic debugging information about what is in the Catalog on a specific object."). Also, calling <dtml-in>Catalog</dtml-in> does not display new/modified data. The situation can be rectified by manually clicking Advanced/Update Catalog (for modified fields) or by Find Objects (for new instances). In other words, the catalog can only be updated manually. Strangely, the "date" field does not suffer this problem. I run Zope 2.3.1 source release. I use the latest Zope Book, dated March 13, 2001 Is the Zope Book text about Automatic Cataloging valid? What mistake I make? -- Milos Prudek
Milos Prudek wrote:
I followed Automatic Cataloging example in Zope Book, Chapter 9.
Everything works fine except automatic cataloging of newly created fields ("author", "content"). When I change data in those fields it is not reflected in the catalog.
[snip]
-- Milos Prudek
CatalogAware does not update things when properties are changed. This can be solved by intercepting manage_editProperties and manage_changeProperties, but I'm not sure if this is practical in a ZClass. Why couldn't CatalogAware do this? If nobody has a good reason, I might push forth a patch to CatalogAware to implement this. -- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------>
I think Casey's plan is a good idea. But, currently, you need to implement you own form and form handler for making property changes. Your form handler can call reindex_object right after it calls manage_editProperties or manage_changeProperties.
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Casey Duncan Sent: Wednesday, April 18, 2001 09:36 To: Milos Prudek Cc: zope@zope.org Subject: Re: [Zope] CatalogAware does not work?
Milos Prudek wrote:
I followed Automatic Cataloging example in Zope Book, Chapter 9.
Everything works fine except automatic cataloging of newly created fields ("author", "content"). When I change data in those fields it is not reflected in the catalog.
[snip]
-- Milos Prudek
CatalogAware does not update things when properties are changed. This can be solved by intercepting manage_editProperties and manage_changeProperties, but I'm not sure if this is practical in a ZClass.
Why couldn't CatalogAware do this? If nobody has a good reason, I might push forth a patch to CatalogAware to implement this.
-- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------>
On Thursday 19 April 2001 04:36, Casey Duncan wrote:
Milos Prudek wrote:
I followed Automatic Cataloging example in Zope Book, Chapter 9.
Everything works fine except automatic cataloging of newly created fields ("author", "content"). When I change data in those fields it is not reflected in the catalog.
CatalogAware does not update things when properties are changed. This can be solved by intercepting manage_editProperties and manage_changeProperties, but I'm not sure if this is practical in a ZClass.
To ensure your instance gets reindexed when the properties change, you need to have the method that processes the property change form call the reindexing method after you commit the changes, just like you do when adding the instance.
Why couldn't CatalogAware do this? If nobody has a good reason, I might push forth a patch to CatalogAware to implement this.
A simple case for the present flexibility is that you don't need to reindex for every property change, just the ones that are actually indexed. A more complicated case would be an operation that changes several instances at once. It's expensive to reindex for every instance you change, so it would be useful to pass a flag to the ZClass's change method to tell it not to do a reindex, and reindex the lot once the operation over all the instances is completed. I guess that you could build this kind of functionality into CatalogAware, but I'm generally in favour of having flexible and optional rather than automatic reindexing, and just adding documentation to discuss some of the different cases. You could hack Property Sheet Interface to add a call to reindex if the ZClass is catalog aware. John
CatalogAware does not update things when properties are changed. This can be solved by intercepting manage_editProperties and manage_changeProperties, but I'm not sure if this is practical in a ZClass.
To ensure your instance gets reindexed when the properties change, you need to have the method that processes the property change form call the reindexing method after you commit the changes, just like you do when adding the instance.
That's right. I just need to <dtml-call reindex_object()>, which is not documented in Zope Book.
Why couldn't CatalogAware do this? If nobody has a good reason, I might push forth a patch to CatalogAware to implement this.
A simple case for the present flexibility is that you don't need to reindex for every property change, just the ones that are actually indexed.
Fine with me. Thanks to all who gave advice! -- Milos Prudek
participants (4)
-
Casey Duncan -
John Morton -
Loren Stafford -
Milos Prudek