Re: [Zope] Catalog and CatalogAware questions
Thanks again for your time kevin. I appreciate your help a great deal. After inhereiting CatalogAware in all my classes I can now see the main catalog when I add a Zsearch interface. I haved renamed some of my variables to match standard naming conventions, namely "title" and "summary". so without adding anything to the meta data table there should still be some functionality. So, the catalog gets updated with this new record (the fresh install of my product), and reads successfully that 1 record is in each of the meta data tables. All good so far. Now, within my product, when I add a person, the table does not say 2 records. Also, searches for that new person are unsuccessful. I am curious if I need to do any specific calls to inform zope or Catalog of the 'person' objects when they are created. Do the person objects neet to inherit some kind of generic zope object? Currently it only inherits: Persistent, Implicit, CatalogAware. As it is you don't see the person objects in the "contents" view of the management screens, and I want it to stay that way. I feel like I'm close to the solution. thx -ed- At 09:52 AM 5/16/00 -0400, you wrote:
----- Original Message ----- From: "ed colmar" <element@immersivearts.com> To: "Kevin Dangoor" <kid@kendermedia.com> Sent: Monday, May 15, 2000 10:03 PM Subject: Re: [Zope] Catalog and CatalogAware questions
Thanks for your reply Kevin.
You have made the picture a bit clearer in my mind. I don't quite follow your points about the metadata table. This is the table within the
catalog
that contains the searchable items correct? So, when someone first installs my product, it or they will need to check to see if the meta data attributes are set, and if not, set them?
When you search the Catalog, the fields that are compared for the search are compared against the indexed fields. The return value is a list of search result objects that include the values from the meta data table. The advantage to this setup is that the actual objects (which could be quite large) are not activated when you do a search.
I'll give the caveat that my experience has been in building ZClass products, but many of the same lessons are applicable to Python products.
When I first created KM|net News, I specified in the documentation that the user needed to add a few properties to the metadata table, and other properties to the indexes. This *can* be automated though. The latest version of KMNN creates its own Catalog and sets up the proper indexes and all. There's no reason why it couldn't configure another Catalog similarly.
Was I mistaken in setting the _searchable_result_columns() and _searchable_arguments()?
I don't remember the exact bit of code... I just know that when you're doing "application-level" stuff with ZCatalog, you don't really need to do a whole lot to make it work. In DTML, <dtml-in "Catalog({'metatype' : 'Foo', 'title' : 'something'})"> <dtml-var title> </dtml-in>
In python: for obj in self.Catalog({'metatype' : 'Foo', 'title' : 'something'}): if obj.title == "Something Something Something": return "something else"
With this method, can a search be performed on just this product? Can it also be performed on the entire zope install
Yep. Just set the metatype in your search... I think you'll find that for application-level sorts of things, DTML examples may help you, because they can be converted to Python pretty readily (as you see above).
Kevin
----- Original Message ----- From: "ed colmar" <element@immersivearts.com> To: "Kevin Dangoor" <kid@kendermedia.com> Cc: <zope@zope.org> Sent: Tuesday, May 16, 2000 11:49 PM Subject: Re: [Zope] Catalog and CatalogAware questions
After inhereiting CatalogAware in all my classes I can now see the main catalog when I add a Zsearch interface. I haved renamed some of my variables to match standard naming conventions, namely "title" and "summary". so without adding anything to the meta data table there should still be some functionality.
Standard naming conventions are helpful when using ZCatalog.
Now, within my product, when I add a person, the table does not say 2 records. Also, searches for that new person are unsuccessful. I am curious if I need to do any specific calls to inform zope or Catalog of the 'person' objects when they are created. Do the person objects neet to inherit some kind of generic zope object? Currently it only inherits: Persistent, Implicit, CatalogAware.
This is where my ZClass-centric upbringing makes it hard for me to answer... You may want to look at the PTK and see how PTK objects work (Links, Documents, etc.) These objects all inherit PortalContent, which acts similarly to CatalogAware (but adds review features). In a ZClass that is CatalogAware, the CatalogAware class implements a manage_afterAdd that indexes the object to begin with. However, with ZClasses this happens before the object's properties are set. So, you need to then set the properties and call reindex_object. However, there seems to be some other problem since your objects are not even getting added to the catalog.
As it is you don't see the person objects in the "contents" view of the management screens, and I want it to stay that way.
I feel like I'm close to the solution. thx
Glad to help! Kevin
On Tue, May 16, 2000 at 09:49:50PM -0600, ed colmar wrote: <snip>
Now, within my product, when I add a person, the table does not say 2 records. Also, searches for that new person are unsuccessful. I am curious if I need to do any specific calls to inform zope or Catalog of the 'person' objects when they are created. Do the person objects neet to inherit some kind of generic zope object? Currently it only inherits: Persistent, Implicit, CatalogAware.
there could be a problem right there. is CatalogAware the first class you inherit from (leftmost)? a comment from some code i wrote a while back: Product.py:# CatalogAware must be the first, as it defines the manage_afterAdd Product.py-# that calls index_object. give that a go. -d -- Adroit | Dyon Balding dyon@adroit.net Internet | http://www.adroit.net/ Solutions | work: +613 95634461, mobile: +61 0414992604
participants (3)
-
Dyon Balding -
ed colmar -
Kevin Dangoor