[Zope] Odd behaviour with lexicons and ZCTextIndex

Dieter Maurer dieter@handshake.de
Wed, 9 Jul 2003 20:55:38 +0200


Paavo Parkkinen wrote at 2003-7-9 13:56 +0300:
 > We have a site with the following structure:
 > 
 > /
 > `- foo
 >    |- lexicon
 >    `- bar
 > 
 > (foo and bar are ZClasses)
 > 
 > When I add the 'bar' under 'foo', and in 'bar's constructor, add a
 > catalog to bar and a ZCTextIndex to the catalog with an external
 > method[1], in 2.6.0 it works just fine, but with 2.6.1 I get the
 > following error:
 > 
 > Error Type: LookupError
 > Error Value: Lexicon "lexicon" not found
 > 
 > The end of the traceback looks like this:
 > 
 >     *  Module Products.ZCatalog.ZCatalog, line 897, in addIndex
 >     *  Module Products.ZCTextIndex.ZCTextIndex, line 78, in __init__
 > 
 > LookupError: Lexicon "lexicon" not found
 > 
 > [1] the external method we use for adding ZCTextIndexes:
 > 
 > def addZCTextIndex(context, id, field=''):
 >         extra = Extra()
 >         extra.index_type = 'Okapi BM25 Rank'
 >         extra.lexicon_id = 'lexicon'
 >         if field:
 >                 extra.doc_attr = field
 > 
 >         if id:
 >                 context.addIndex(id, 'ZCTextIndex', extra)

Is it possible that your "ZCatalog" is not yet acquisition wrapped
when you call "addIndex"?


Dieter