Searching for and displaying properties
Dear All, I managed to add a property to an object by using the manage_addproperty () method. However, if I don't issue a manage.reindexIndex () for the new property, it won't come out in the catalog search results. So I issue reindexIndex (), but when I finally try to display the property, all I get is 'Missing Value'. But if I then issue the command refreshCatalog(clear=1), the property is now visible. Although refreshCatalog works, it would gobble up the server's CPU and memory resources everytime its run. My question is, is there another command I can use instead of refreshCatalog to make the property display ? Below is the code I'm talking about : wf = context.GeneralWorkflow instance_id = wf.addInstance( process_id=process, customer=jobname, comments=comment, title=subject, activation=1) wf.getInstance(instance_id).manage_addProperty('jobname', 'ABC12345', 'string') wf.Catalog.manage_reindexIndex(ids=['jobname'], REQUEST=None, RESPONSE=None, URL1=None) jobs = cat.searchResults({'jobname':'ABC12345'}) for j in jobs: print j.jobname Regards, Danny
--On 24. Juni 2006 21:50:15 +0800 "Sinang, Danny" <D.Sinang@spi-bpo.com> wrote:
jobs = cat.searchResults({'jobname':'ABC12345'})
for j in jobs: print j.jobname
'jobname' is added as *metadata* to your catalog? -aj -- ZOPYX Ltd. & Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany Web: www.zopyx.com - Email: info@zopyx.com - Phone +49 - 7071 - 793376 E-Publishing, Python, Zope & Plone development, Consulting
Sinang, Danny wrote:
Dear All,
I managed to add a property to an object by using the manage_addproperty () method.
However, if I don't issue a manage.reindexIndex () for the new property, it won't come out in the catalog search results.
manage_addProperty does not trigger recataloguing of the object even if its a subclass of CatalogAwareness. You should either call obj.reindex_object() or at least obj.index_object(), if your class has the CatalogAwareness-Mixin or you use the catalog API: yourcatalog.catalog_object(obj,obj.absolute_url_path()) After that, your metadata should show up nicely w/o indexing the whole object tree. Regards Tino
participants (3)
-
Andreas Jung -
Sinang, Danny -
Tino Wildenhain