[Zope] Zcatalog and PrincipiaSearchSource with Zclasses ?

gtk gtk@well.com
Sat, 23 Oct 1999 15:44:51 +1000


> >Sure, why not just impliment a DTML Method in your ZClass called
> >PrincipiaSearchSource that returns what you want indexed?
> >
> ><dtml-return "title + author + body">
>
> This won't work, because you can't index on the result of a DTML Method.

PythonMethod is perfect for this kind of thing. I just created
PrincipiaSearchSource with self as an argument and the following code:

    return self.id+"; "+self.title+"; "+self.text

... and then re-indexed everything (so the catalog picked up on the method)
and performed a search. Worked a treat!

    return string.join((self.id, self.title, self.text,), '; ')

would perhaps be more efficient, but isn't quite as readable. :) 

Regards,
Garth.

--
<gtk@well.com>