[Zope] Problem with Automatic Cataloging Example in ZopeBook

Christian Wittern wittern@kanji.zinbun.kyoto-u.ac.jp
16 May 2001 15:33:06 +0900


Chris McDonough <chrism@digicool.com> writes:

> Hi Chris,
> 
> Hmmm... I haven't tried this, but I'm afraid I believe you.  :-( Are you
> saying that anything that is a property of an instance of a ZClass is
> not indexed in the catalog?  Does this happen with any particular type
> of ZClass properties or only a certain kind?  What if you add a
> PythonScript (with no parameters) to a ZClass as a method and make it
> return a string?  Does that get indexed?  Would you be kind enough to
> try to make that distinction and report back?  

I am following the example in the ZopeBook, Chapter 9 to the letter:

Adding Product News,
Creating ZClass NewsItem, Baseclasses: ZObject, CatalogAwareBase
Adding a propertysheet News to NewsItem
Adding properties to this sheet:
 content: text
 author: string
 date: date

I then create an instance of Catalog, with Indexes:
 author  FieldIndex
 content TextIndex
 date    FieldIndex
 title   FieldIndex

and a table of Metadata
 absolute_url
 author
 date
 title

I also create a ZSearch Interface with a FOrm and a Report method

If I now add a NewsItem to my ZOpe somewhere, I can see the item
appearing in my Catalog, when I click on the Catalog-tab. When I now
click on the item in the catalog, I see the catalog record for this
item. This tells me that the fields author and
title are empty in the section Metadata Contents and author, title and content
are empty in the section Index Contents.


Now trying the trick with the PythonScript:

Adding a PythonScript "test" as method to NewsItem
  The script just returns a string, without any params.
Adding a TextIndex  "test" to the Catalog
Adding a field "test" to the Metadata table

With this in place, I now add another NewsItem to my Zope, and add
some dummy content.

Looking at the index record reveals: Indeed, the string returned from
the "test" script is in place, both in the Index and in the Metatable
record.


-- 

 Institute for Research in Humanities, Kyoto University
 47 Higashiogura-cho, Kitashirakawa, Sakyo-ku, Kyoto 606-8265, JAPAN