ZCatalog and acquired objects
Hi, ZCatalog traverses the object hierarchy and indexes the content of objects, right? So (it seems to me that) objects that display content acquired from other objects won't be indexed correctly. For example, I got this situation: folder: show (DTML Method) 1 (TinyTable) 2 (TinyTable) 3 (TinyTable) 4 (TinyTable) 'show' displays the content of a TinyTable when called with 'folder/1/show'. Indexing 'show' with ZCatalog is useless because it doesn't contain any interesting data if it doesn't acquire a TinyTable. Indexing the TinyTables themselves is also useless because a find will then link to the TinyTable object, but I need to link to 'show'. So, is this true, or am I missing something? Is there a way to get around this? Itai -- Itai Tavor -- "Je sautille, donc je suis." -- itavor@vic.bigpond.net.au -- - Kermit the Frog -- -- -- -- "Every day, once a day, give yourself a present" - Dale Cooper --
Itai Tavor wrote:
Hi,
ZCatalog traverses the object hierarchy and indexes the content of objects, right? So (it seems to me that) objects that display content acquired from other objects won't be indexed correctly. For example, I got this situation:
folder: show (DTML Method) 1 (TinyTable) 2 (TinyTable) 3 (TinyTable) 4 (TinyTable)
'show' displays the content of a TinyTable when called with 'folder/1/show'. Indexing 'show' with ZCatalog is useless because it doesn't contain any interesting data if it doesn't acquire a TinyTable. Indexing the TinyTables themselves is also useless because a find will then link to the TinyTable object, but I need to link to 'show'.
So, is this true, or am I missing something? Is there a way to get around this?
Yep it's true. But the question is, what attributes of an object do you really want to index? Mass indexing (traversing all your objects looking for a collection of attributes) is often not as useful as it seems, often you don't want to index the contents of a DTML Method, but you DO want to index the contents of a DTML Document. Or maybe you do want methods? Or maybe you only want certain properties of a tiny table? This is why the ZCatalog can be used programaticly from DTML. Often with a bit more effort you can construct an application that catalogs it's own objects in a sane way that makes much mroe sense to you than just a vast object sweep. This works reather well with ZClasses; you can define your own Zope objects and modify their constructors so that they catalog and uncatalog themselves. Also, you can create as many specialized catalogs as you want. This gets down to a pretty fundemental Zope question (and dynamic systems in general) 'What is content?'. The Catalog brings this question to light most especially. I suspect other cataloging systems are fairly limited in that they let you index text, maybe some object meta data; but the ZCatalog is a bit more low level, and thus more flexible. You can configure both what you want for meta data and what you want to index independantly, and object attributes can be methods, lists, objects, etc... This means that whenyou do mass indexing, you might sweep up more than you really want. ZCatalog adds another dimension to application design, not only should you organize your site to take advantage of folder structure and acquision, but also cataloging. Note that in your example, you can also create an external method that renders your show method in the context of a tiny table passed as a parameter and returns the data you want to index. Then you can just, for example, index all folders looking for the attribute 'externalmethodname'.
-- "Every day, once a day, give yourself a present" - Dale Cooper --
Hey a peak freak! -Michel List PS: Yes I really do get up at 4am to answer list email.
[was "ZCatalog and acquired objects"] On Tue, 20 Jul 1999 04:04:12 -0400, Michel Pelletier <michel@digicool.com> said: Michel> it's own objects in a sane way that makes much mroe sense to you Michel> than just a vast object sweep. This works reather well with Michel> ZClasses; you can define your own Zope objects and modify their Michel> constructors so that they catalog and uncatalog themselves. ^ ^ Cool! I would LOVE to see a code snippet for this. This is what I tried in my constructor, but it didn't work: <!--#with "myZClass.createInObjectManager(REQUEST['id'], REQUEST)"--> <!--#call "stealth_catalog.manage_catalogObject(REQUEST,[absolute_url()])"--> <!--#/with--> This doesn't create the object at all, apparently. I have some ZCatalogs which work with ZClasses, but I don't see quite how to automate adding/removing objects from the Catalogs. Thanks bunches. Michel> List PS: Yes I really do get up at 4am to answer list email. I need some coffee like you drink, or something. -- Alex Rice | alrice@swcp.com | http://www.swcp.com/~alrice Current Location: N. Rio Grande Bioregion, Southwestern USA
Alex Rice wrote:
[was "ZCatalog and acquired objects"]
On Tue, 20 Jul 1999 04:04:12 -0400, Michel Pelletier <michel@digicool.com> said:
Michel> it's own objects in a sane way that makes much mroe sense to you Michel> than just a vast object sweep. This works reather well with Michel> ZClasses; you can define your own Zope objects and modify their Michel> constructors so that they catalog and uncatalog themselves. ^ ^
Cool! I would LOVE to see a code snippet for this. This is what I tried in my constructor, but it didn't work:
There will be a howto I'll start working on soon.
<!--#with "myZClass.createInObjectManager(REQUEST['id'], REQUEST)"--> <!--#call "stealth_catalog.manage_catalogObject(REQUEST,[absolute_url()])"--> <!--#/with-->
This doesn't create the object at all, apparently.
I have some ZCatalogs which work with ZClasses, but I don't see quite how to automate adding/removing objects from the Catalogs.
Thanks bunches.
What will probably be the case is that I'll develop a base class that your ZClasses can subclass that provides a simple framwork for your ZClass instances to automaticly catalog themselves; currently, it's a pretty involved and complex process, it should be made easier. I'm for rolling the Catalog into the Zope core, but this might not happen until the release after 2.0 final, there is still alot of XMLish stuff that should be matured in respect to the catalog before it is worked into the core infrastructure. I would like to see Catalog be integrated into Zope much like authentication is, so that there will be a top level catalog much like the top level acl_users User Folder. This many not be how it actually turns out however. -Michel
participants (3)
-
Alex Rice -
Itai Tavor -
Michel Pelletier