automatically add to ZCatalog?
I have a blog where a search show the latest BlogItems ordered by date I've looked everywhere and can't work out how to automatically add a BlogItemClass instance to my ZCatalog. Currently I have to go to the catalog and click "Find Objects" which is a pain I think I tried to automatically update the whole catalog (3000+ items) but this was too slow to be reasonable. Surely there is a way (in python) to add an item to the ZCatalog and index just it. cheers tom p.s myObj.re_index() doesn't seem to make any difference either -- tom smith http://www.othermedia.com/blog/ 0207 089 5959 3rd Floor, The Pavilion, Newham's Row, London SE1 3UZ
tom smith wrote:
I have a blog where a search show the latest BlogItems ordered by date
I've looked everywhere and can't work out how to automatically add a BlogItemClass instance to my ZCatalog.
You must make your Product CatalogAware: from Products.ZCatalog.CatalogPathAwareness import CatalogAware class BlogClass(CatalogAware, ...): Depending on your Product you have to call self.reindex_object() after changes [esp. for the PropertyManager, which is not CatalogAware by default]. -mj -- German Zope User Group http://www.dzug.org/
On Thursday, November 21, 2002, at 11:46 AM, Maik Jablonski wrote:
tom smith wrote:
I have a blog where a search show the latest BlogItems ordered by date I've looked everywhere and can't work out how to automatically add a BlogItemClass instance to my ZCatalog.
You must make your Product CatalogAware: Sorry, it's a ZClass, but I made sure to add CatalogAware when I created it.
Depending on your Product you have to call self.reindex_object() after changes [esp. for the PropertyManager, which is not CatalogAware by default].
So, in my constructor I have... instance = container.ArticleFolderoid.createInObjectManager(request['id'], request) instance.propertysheets.properties.manage_editProperties(request) instance.reindex_object() ...and in update_Article I have... instance = context.this() instance.propertysheets.properties.manage_editProperties(request) instance.reindex_object() ...and still, the items don't show on my searchResults driven front page unless I go to the catalog and click "Find Objects" -- tom smith http://www.othermedia.com/blog/ 0207 089 5959 3rd Floor, The Pavilion, Newham's Row, London SE1 3UZ
tom smith wrote:
...and still, the items don't show on my searchResults driven front page unless I go to the catalog and click "Find Objects"
ZClasses? Switch to Python-Products and feel happy...;-) Maybe an last idea: Add a property "default_catalog" which points to your Catalog-Id. reindex_object needs this to guess which Catalog you want your object indexed to. -mj -- German Zope User Group http://www.dzug.org/
Hi there, I haven't read through all the posts on your subject, however if no one else has told you, the default catalog should be named "Catalog". Had this problem myself. More details : <a href = "http://www.zope.org/Members/Zen/tips/DefaultZCatalog"> hth Sean tom smith <tom@othermedia.com> wrote: On Thursday, November 21, 2002, at 11:46 AM, Maik Jablonski wrote:
tom smith wrote:
I have a blog where a search show the latest BlogItems ordered by date I've looked everywhere and can't work out how to automatically add a BlogItemClass instance to my ZCatalog.
You must make your Product CatalogAware: Sorry, it's a ZClass, but I made sure to add CatalogAware when I created it.
Depending on your Product you have to call self.reindex_object() after changes [esp. for the PropertyManager, which is not CatalogAware by default].
So, in my constructor I have... instance = container.ArticleFolderoid.createInObjectManager(request['id'], request) instance.propertysheets.properties.manage_editProperties(request) instance.reindex_object() ...and in update_Article I have... instance = context.this() instance.propertysheets.properties.manage_editProperties(request) instance.reindex_object() ...and still, the items don't show on my searchResults driven front page unless I go to the catalog and click "Find Objects" -- tom smith http://www.othermedia.com/blog/ 0207 089 5959 3rd Floor, The Pavilion, Newham's Row, London SE1 3UZ --------------------------------- Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now
participants (3)
-
Maik Jablonski -
Sean K -
tom smith