[Zope] ZCatalog

Michel Pelletier michel@digicool.com
Wed, 5 Jan 2000 15:44:26 -0500


> -----Original Message-----
> From: Magnus Heino [mailto:magnus@vuab.net]
> Sent: Wednesday, January 05, 2000 5:12 PM
> To: zope@zope.org
> Subject: [Zope] ZCatalog
> 
> 
> 
> Hi.
> 
> I am trying to add a ZCatalog to my site, and have come up 
> with a few questions/problems about ZCatalog and how one 
> sould implement things:
> 
> 1. It doesn't handle едц! I have setup my zcatalog to to text 
> indexes, but when I search on something containing едц, 
> nothing is found. Everything else works. I thought this was 
> fixed some versions ago?

Did you set your locale environment variable and pass z2.py the -L
option?

> 2. I want to index on what the dtml document index_html looks 
> like when it is renderd, not what the source looks like. 

That's just not going to happen.  Documents are rendered in the context
of a request, the rendering of a document may be different for every
reqeust that looks at it.  There is no way the Catalog can render, or
even know how to render, or know what context you want your content
rendered in.  Further, what, exactly, is content then?  This is a
really, really, really sticky issue, there is no way around it.  Then
bring in the issues of security (which can have a drastic effect on
rendered results), Acquisition (which controls the context of how things
are rendered) etc....

>    Example: DTML method foo contains some text. index_html 
> includes this method with <dtml-var foo>. I want to get 
> index_html when I search, not foo, even if foo is the one 
> containing the text.

You will need to create a ZClass (or python class) that 'renders itself'
in some predictable way and catalogs itself also.
 
> 3. DTML documents and methods don't update themself in the 
> catalog, right? Why? Do I have to do it manually everytime I 
> update something, or is there a better way? How is the Zope site done?

DTML Documents and Methods do not catalog themselves automatically
because they are not designed to, they are small simple components that
do not do complex things like that on their own.

To do it yourself, create a ZClass that subclasses Document or Method
and have the ZClass catalog itself when an instance is created or
edited.  There are a couple of how-tos on this allready.

-Michel