[Zope-dev] Pluggable Indexes and Splitters

Andy Dawkins andyd@nipltd.com
Tue, 31 Jul 2001 13:48:19 +0000


Andreas

Ok call me stupid but I really don't see how subclassing the vocabulary
will help in this situation.

The ZCatalog uses the Vocabulary in the Products/ZCatalog Folder, Which
is 'HardCoded' to use the Vocabulary in the
Products/PluginIndexes/TextIndex folder.  (I am guess this is for
backward compatibility issues)

I can't change any of this code because there are systems currently
running on this Zope Base which use catalogs and the fact that it is
backwards compatible is really important.

I don't see how creating another Vocabulary would change any of this.

Am I stupid? (Be fair)

-Andy

Andreas Jung wrote:
> 
> Andy,
> 
> Splitters belong to the vocabularies/lexicons. The TextIndex just
> aquires the Splitter from the corresponding Lexicon. Currently
> there is no official way to make Splitters available only a available
> to dedicated components. A more sophisticated approach would be to
> register them in the registry in a similar way PluginIndexes are registered.
> One workaround for you *might* to create your own vocabulary type by
> subclassing
> one of the exstings vocabularies and adjust the Splitter selection to your
> needs.
> 
> Andreas
> Zope Corporation
> 
> ----- Original Message -----
> From: "Andy Dawkins" <andyd@nipltd.com>
> To: <zope-dev@zope.org>
> Sent: Dienstag, 31. Juli 2001 06:33
> Subject: [Zope-dev] Pluggable Indexes and Splitters
> 
> > I have a small problem with Pluggable Indexes and Splitters which I
> > think is an oversight of the current design implementation.
> >
> > The Details Bit:
> > Zope 2.4.0 (final)
> > Python 2.1
> >
> > I can successfully create a new Splitter (called MySplitter) I add it to
> > availablesplitters, put it in its own directory in
> > PluginIndexes/TextIndex/Splitter/
> >
> > Then I create a new vocabulary and MySplitter appear on the list of
> > splitters.  Fantastic thats great.
> >
> > Next I create my own index.
> >
> > This index is very similar to the TextIndex, so I copy the
> > PluginIndexes, rename it, remove the indexes I don't want to modify
> > (FieldIndex, KeywordIndex, PathIndex) and rename TextIndex to
> > MyTextIndex
> >
> > I make the relevant changes to MyTextIndex, head back to the ZMI and add
> > an index using MyTextIndex.
> >
> > All is fine.
> >
> > Here is a quick diagram of my current directory structure (for those who
> > are easily lost)
> >
> > /2.4.0_base/lib/python/Product/PluginIndexes/TextIndex/Splitter/MySpliter
> > -  (MySplitter)
> > /MyInstance/Products/MyTextIndex/MyTextIndex  -  (MyTextIndex)
> >
> > Now because MySplitter is completely useless when used with TextIndex
> > and because other zope instance's use the 2.4.0_base that don't need
> > MySplitter, I move MySplitter out of the
> > /PluginIndexes/TextIndex/Splitter folder and into /MyTextIndex/Splitter
> > folder.
> >
> > I return the availablesplitters attribute in
> > /TextIndex/Splitter/__init__.py to what is should be and make the change
> > to my own /MyTextIndex/Splitter/__init__.py
> >
> > Because MySplitter is the _only_ splitter that I want MyTextIndex to use
> > I remove all other splitters from the /MyTextIndex/Splitter/ folder, and
> > their relevant entries in availablesplitters.
> >
> > Head back to the ZMI, Remove the catalog and start again.
> >
> > New ZCatalog <click>, Create a vocabulary for me <click>, ok <click>
> > New Vocabulary <click>, Name it 'MyVocabulary' <tap><tap><tap>, Select
> > my splitter <STOP> My splitter isn't listed anymore.
> >
> > And thats where the problem lies.
> >
> > Deaper investigation reveals that inside
> > /2.4.0_base/lib/python/Products/ZCatalog/Vocabulary.py
> > Lies a single line which reads.
> > from Products.PlugginIndexs.TextIndex.Vocabulary import *
> >
> > So it _always_ uses the vocabulary in TextIndex, which always uses the
> > Splitters in TextIndex.
> > Oooops, This isn't very friendly, How am i supposed to create my own
> > Indexes with thier Own Splitters???????
> >
> > 1) I could change this file, But it is in a base zope folder so it will
> > screw all the Catalogs that use this base.
> > 2) I could leave MySplitter in the /TextIndex/Splitter folder, But I
> > don't want a normal TextIndex to use this splitter.
> >
> > Ideally I want PluggableIndexes to be able to have their own splitters.
> >