[Zope-CMF] Re: TextIndex -> ZCTextIndex

Casey Duncan casey at zope.com
Thu Jul 22 09:50:49 EDT 2004


On Wed, 21 Jul 2004 16:42:06 +0100
Chris Withers <chris at simplistix.co.uk> wrote:

> Andrew Veitch wrote:
> 
> > Would it be a good idea to change the default text index to
> > ZCTextIndex now that Zope 2.7 is required?
> 
> Have you seen how bad it smells to programmatically set up a
> ZCTextIndex?
> 
> I was truly shocked to think that the pythonlabs guys produced
> something so unweildy :-(

What's so bad about this (where self is a portal_catalog)?

from Products.ZCTextIndex.ZCTextIndex \
    import PLexicon, ZCTextIndex, OkapiIndex

zcti = ZCTextIndex('SearchableText', 
                   caller=self,
                   index_factory=OkapiIndex,
                   field_name=name, 
                   lexicon_id='lexicon')
self._catalog.addIndex(name, zcti)

And if you need to add a lexicon:

lexicon = PLexicon('lexicon', '', HTMLWordSplitter(), CaseNormalizer())
self._setObject('lexicon', lexicon)

No big deal if you ask me.

-Casey



More information about the Zope-CMF mailing list