[Zope] Re: getting some documentation going:(getting long here..)

Kevin Dangoor kid@kendermedia.com
Wed, 18 Aug 1999 22:58:13 -0400


-----Original Message-----
From: Lindon Parker <twomoonlp@hotmail.com>
To: zope@zope.org <zope@zope.org>
Date: Wednesday, August 18, 1999 10:14 PM
Subject: [Zope] Re: getting some documentation going:(getting long here..)


[much snipped above and mostly below]

>   So what I want to see is a simple piece of code that lets me search my
>Zope database where I can, as a complete novice, substitute my objects and
>my attributes to get back a list of things I can itterate over. Lets ignore
>perfomance, b-tree's, ZClass design etc. etc. Assume I have NOT installed
>ZCatalogue(unless of course it comes by default on my NT Zope 2.0 install,
>does it?), and I'm using DTML Documents. In short assume I am an idiot(you
>wont be so far wrong) but I need to get something working pretty quickly,
>and I'll make it graceful later.

Yep, ZCatalog comes with Zope 2.0.

You'll probably want to check out
http://www.zope.org/Download/ZCatalog/ZCatalogTutorial
(which I believe is also in lib/python/Products/ZCatalog/ZCatalog.txt in
your Zope distribution)

In general, to use it with DTML Documents should be pretty straightforward
(I think). Create a ZCatalog object (possibly in your Zope root). For any
Property you set up in your DTML Doc that you want indexed and searchable,
you need to enter that property name in the Indexes tab of the ZCatalog.
(You choose FieldIndex if you want the field to contain one discrete value,
regardless of spaces, TextIndex if you want a full text index that you can
search).

You can use the Z Search Interface, as Michel mentioned in his reply to get
going. The tutorial above lists some DTML for searching.

I've used it like this:

<dtml-in "Catalog({'metatype': 'MyZClass', 'category': 'top_stories'})">
<dtml-var title>
</dtml-in>

Will list the titles of any "MyZClass" type object that has the category
property set to "top_stories".

There's no one way to use ZCatalog and create the searches you want. It's
pretty flexible, but that flexibility also means that it's a little more
complicated to get started with until the docs catch up. Playing around with
a ZCatalog object and a ZSearch Interface will get you going, and you can
probably find out some more of what's there by checking out the ZCatalog
source code.

Another way to help get acquainted would be to check out the beta Zope2 site
http://www.zope.org:18200/
Every page has a DTML Source link that lets you see how the page was
produced.

Kevin