[Zope] ZCatalog woes

Geir B Hansen Geir B Hansen <geirh@funcom.com>
Thu, 23 Mar 2000 09:06:00 +0100


on Wednesday, March 22, 2000 Helge Tesdal wrote :
HT> I have a ZCatalog instance in my root folder called Catalog. I have some
HT> CatalogAware ZClasses that get added to it automatically.

HT> The problem is, when I query Catalog for results, it only shows the
HT> elements that were present the last time I clicked the "Update" button in
HT> ZCatalog. The new elements are present in the catalog, but they don't show
HT> up in the query until I manually update the catalog.

HT> Here's the query code:

[snip]

HT> --
HT> Helge Tesdal
HT> tesdal@stud.ntnu.no


the problem is not in your query-code, i guess ..

IIRC, the catalog-aware zclasses are indexed automagically
when created, but not properties you set after creation. So
when you search for track_hasfile='on' , Zcatalog doesn't
have that property indexed:

You'll have to add :
<dtml-call reindex_object> in your Zclass Constructor method
( if you change properties there)

like this :

<dtml-with "Zclass_name.createInObjectManager(REQUEST['id'], REQUEST)">
       <dtml-call "propertysheets.Propertyshhet_name.manage_editProperties(REQUEST)">
       <dtml-call reindex_object>
</dtml-with>

-
Another possibility could be that you haven't added
track_hasfile to your indexes in Zcatalog.
If it is just a on/off-flag (which it looks like from here)
, add it as a field-index..


For better information, check out the excellent Zcatalog /
catalogAware HowTos on zope.org..

--
Geir Bækholt Hansen
web-developer/designer
geirh@funcom.com
http://www.funcom.com