[Zope-dev] Pluggable Indexes and Splitters

Chris Withers chrisw@nipltd.com
Tue, 31 Jul 2001 15:15:16 +0100


Andreas Jung wrote:
> 
> aquires the Splitter from the corresponding Lexicon. Currently
> there is no official way to make Splitters available only 
> to dedicated components. 

I think the opposite is true, Splitters and Volcabularies seem to be limited to
only being used by TextIndexes within PlugginIndexes.
I just put a bug in the collector about one aspect of this.

I think Vocabularies might be generically useful in Zope, not just to ZCatalog,
likewise splitters.

I'd love to be able to do:

context.mySplitter.split('the quíck brown f0x')

...for example.

But, it does seem exraordinarily hard to register new types of splitter.
Currently, the only way I can think to do it would be something like:

import MySplitter

from Products.PluginIndexes.TextIndex import Splitter

aS = Splitter.availableSplitters # why isn't availableSplitters a dictionary?!
aS = aS + ("MySplitter","My Special Funky Splitter")
Splitter.availableSplitters = aS

# worse still...
setattr(Splitter,'MySplitter',MySplitter)

...and I'm not even sure that'd work :(

Maybe Vocabularies should be in their own Product and maybe (although maybe not)
Splitters and Lexicons should be in their own Products too?

cheers,

Chris