[Zope] Re: Vocabularies and DateRangeIndexes
Maik Jablonski
maik.jablonski@uni-bielefeld.de
Thu, 03 Apr 2003 15:26:32 +0200
Paavo Parkkinen wrote:
>>>How do I add a vocabulary to a catalog so that the singlechars option
>>>is set, from a python script? It needs the extra.splitterSingleChars
>>>set, but I have no idea how to do that.
As far as I know you can't build records in PythonScripts which are
needed to add the new kind of Indexes... Maybe some interface should be
implemented into the Zope-Core to do this kind of stuff.
In the meanwhile you can try something like this in an External Python
Method:
class Extra:
""" Just a dummy to build records for the Lexicon.
"""
pass
wordSplitter = Extra()
wordSplitter.group = 'Word Splitter'
wordSplitter.name = 'Whitespace splitter'
caseNormalizer = Extra()
caseNormalizer.group = 'Case Normalizer'
caseNormalizer.name = 'Case Normalizer'
self.Catalog.manage_addProduct['ZCTextIndex'].manage_addLexicon(
'Lexicon', 'Lexicon',
(wordSplitter,
caseNormalizer))
extra = Extra()
extra.index_type = 'Okapi BM25 Rank'
extra.lexicon_id = 'Lexicon'
self.Catalog.manage_addIndex('mDate', 'DateIndex')
self.Catalog.addIndex('mSubject', 'ZCTextIndex', extra)
Cheers, Maik