[Zope3-dev] TTW Indexes

Martijn Faassen faassen@vet.uu.nl
Wed, 6 Aug 2003 10:43:53 +0200


Andreas Jung wrote:
> --On Dienstag, 5. August 2003 11:55 Uhr +0200 Martijn Faassen 
> <faassen@vet.uu.nl> wrote:
> 
> >
> >I see two main limitations with the Zope 2 catalog:
> >
> >  * attributes have to exist on the object with the same name of the
> >    indexes. This is going to be overcome, but still, attributes have
> >    to exist for the indexes to call. This can be overcome too with
> >    ProxyIndex.
> 
> This is no longer true for Z2.7.

That's good; I thought the only thing that was overcome was that
the index had to have the same name as the attribute, but apparently
now I can cause arbitrary code (on some other object) to be called to do 
indexing?

> >  * it is hard to use multiple catalogs for the same objects. Objects
> >    really tend to belong to a single catalog. This means the catalog
> >    tries to index them for *all* indexes, even though that doesn't
> >    really make sense.
> 
> Why is it hard? There is no limitation from the Zope side to index
> one object with multiple catalog except the limitation that the UI
> sucks :-)

I'm sure it's all *possible*, but it's much harder to:

  * write code that makes the same object indexed in multiple catalogs 
    (can't use CatalogAwareness)

  * write code that queries multiple catalogs in one go. This may be useful
    if you catalog the set of objects A for some basic interface and then
    some subset B for a more specific interface. Now you want to query
    set B but you want to make use in the query of information cataloged
    by the catalog for superset A.

There is no straightforward standard way to do either, as far as I'm
aware. In the first case, the objects involved need to have (tricky to
debug) catalog awareness in multiple catalogs, which needs to be
hand-written or found somewhere. In the second case multi-catalog query
facilities need to be hand-written or found somewhere.

So, again, my point is not to say something is impossible, but to say it's 
much harder to work with multiple catalogs in Zope 2. I hope this will
be made easier in Zope 3. If you're of the opinion that nothing possible is 
actually hard then the discussion ends of course. :)

Regards,

Martijn