[Zope-dev] Q: Specialists, Racks, and ZCatalogs?
Michael Bernstein
webmaven@lvcm.com
Sat, 03 Feb 2001 07:20:56 -0800
Hi all,
I've started implementation of a simple ZPatterns based
application, and so far things have been going well.
The problem is, I'm not sure if I'm doing this right.
Here is my setup:
Zope 2.2.0 hosted at Codeit.com on a Linux box
ZPatterns 0.4.3b2
'BookProduct' product
*'BookClass' ZClass (inherits from
_ZClass_for_CatalogAware, _ZClass_for_DataSkin)
* Methods: editInstanceForm, editInstance, index_html,
AllTextMethod
'Books' Specialist
* defaultRack which stores 'Book' ZClasses
* Methods: addBookForm, addBook, index_html, BookSearch,
BookResults (the last two methods are a Z Search
Interface)
*'Catalog' ZCatalog
The 'BookClass' editInstance method contains:
[snip]
<dtml-call
"propertysheets.Standard.manage_changeProperties(REQUEST)">
<dtml-call reindex_object>
[snip]
The 'Books' Specialist's addBook method contains:
[snip]
<dtml-let ni="newItem(isbn)">
<dtml-call
"ni.propertysheets.Standard.manage_changeProperties(Authors=Authors,
Title=Title, Price=Price)">
<dtml-call "ni.index_object()">
</dtml-let>
[snip]
I've snipped out only the most relevant parts of these
methods.
As I said, so far this has worked ok. But it seems to me
that either the reindex_object or the index_object is in the
wrong place, but I'm not sure which. I'm also not sure it's
a good or bad idea to place the ZCatalog directly into the
Specialist.
Also, I would like to replace the three indexes I'm
maintaining on the books with a single text index on a
computed attribute. I understand that this involves adding a
SkinScript to the Rack containing something like 'WITH SELF
COMPUTE AllText=AllTextMethod', but I'm unsure of the
details. I have a method (AllTextMethod) on the ZClass that
returns several fields concatenated as a single string,
which I would like to use as a text index.
So, I decided to ask for a critique of the application
design (such as it is). I also seem to recall mention of
'indexing agents' that might make this a bit more elegant,
but haven't found a how-to on the subject.
Thanks,
Michael Bernstein.