Vocabularies and DateRangeIndexes
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. The same problem with the DateRangeIndexes. How do I set the extra.since_field and extra.until_field? -- paavo. wu wei er wu bu wei
Checkout the method that is called from with the corresponding ZMI screen. -aj --On Donnerstag, 3. April 2003 14:31 Uhr +0300 Paavo Parkkinen <pparkkin@cc.jyu.fi> 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.
The same problem with the DateRangeIndexes. How do I set the extra.since_field and extra.until_field?
-- paavo. wu wei er wu bu wei
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
On Thu, 03.04.2003 at 13:39 +0200, Andreas Jung wrote:
Checkout the method that is called from with the corresponding ZMI screen.
--On Donnerstag, 3. April 2003 14:31 Uhr +0300 Paavo Parkkinen <pparkkin@cc.jyu.fi> 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.
This is the method called: --- def manage_addVocabulary(self, id, title, globbing=None, extra=None, splitter='', REQUEST=None): ... c=Vocabulary(id, title, globbing,splitter,extra) ... --- The Vocabulary-class contructor contains these lines: --- if not extra: extra = _extra() extra.splitterIndexNumbers = 0 extra.splitterSingleChars = 0 extra.splitterCasefolding = 1 --- So I'm guessing I need to pass manage_addVocabulary the extra parameter and have that contain splitterSingleChars (= 1). But I have no idea how to do that. I can't create _extra class instances inside a python script (because of the '_'). -- paavo. wu wei er wu bu wei
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
participants (3)
-
Andreas Jung -
Maik Jablonski -
Paavo Parkkinen