[Zope-dev] More ZCatalog Stuff.

Michael R. Bernstein webmaven@lvcm.com
Tue, 27 Feb 2001 07:08:57 -0800


Toby Dickenson wrote:
> 
> On Mon, 26 Feb 2001 19:00:58 -0800, "Michael R. Bernstein"
> <webmaven@lvcm.com> wrote:
> 
> >Toby Dickenson wrote:
> >>
> >> If you are interested in a short-term hack, it is possible implement
> >> your own type of index and add it to an existing catalog, without
> >> having to modify any of the ZCatalog product.
> >
> >Ok, how? Please keep in mind that I'm more of a designer and
> >integrator than a coder.
> 
> ZCatalogs are a zopeish wrapper around a zope-neutral catalog object,
> which is stored in the _catalog attribute. That leading underscore is
> a clue that you shouldnt be using it directly, however you need to in
> order to create a custom index. Liek I said, this is a hack.
> 
> The main problem is that catalog (and hence ZCatalog) implements a
> factory interface where you specify the name of the index type (for
> example "TextIndex", and it creates the indexing objects.
> 
> [snip description and code]

I am assuming that the code you provided goes into a
manage_addCustomIndex method that is part of a CustomIndex
Python Product.

> You will need to implement a subclass derived from one of the standard
> indexes to provide your custom indexing policy, whatever that is.

Can you provide the code for your custom KeywordIndex, so I
have a starting point? I realize yours subclasses a
KeywordIndex, and I probably need to subclass a TextIndex,
but it would still probably help. I can integrate and hack
on other peoples code better than I can write my own from
scratch.

Thanks,

Michael Bernstein.