[GeneralDiscussion] applied to unstable: Create ZCTextIndexes with Unicode splitters by default.
[email protected] (unstable-repo)
| Newsgroups | gmane.comp.web.zope.zwiki |
|---|---|
| Message-ID | <20080501185922.7AB13465CE0__31460.7021435679$1209668506$gmane$org@mail.joyful.com> |
Thu May 1 11:45:37 PDT 2008 [email protected] * Create ZCTextIndexes with Unicode splitters by default. diff -rN -u old-ZWiki-unstable/Admin.py new-ZWiki-unstable/Admin.py --- old-ZWiki-unstable/Admin.py 2008-05-01 11:59:21.000000000 -0700 +++ new-ZWiki-unstable/Admin.py 2008-05-01 11:59:21.000000000 -0700 @@ -421,12 +421,33 @@ catalog = self.catalog() catalogindexes, catalogmetadata = catalog.indexes(), catalog.schema() PluginIndexes = catalog.manage_addProduct['PluginIndexes'] + class Extra: + """ Just a dummy to build records for the Lexicon.""" + pass + + if 'ZwikiLexicon' not in catalog.objectIds('ZCTextIndex Lexicon'): + wordSplitter = Extra() + wordSplitter.group = 'Word Splitter' + wordSplitter.name = 'Unicode HTML aware splitter' + caseNormalizer = Extra() + caseNormalizer.group = 'Case Normalizer' + caseNormalizer.name = 'Unicode Case normalizer' + catalog.manage_addProduct['ZCTextIndex'].manage_addLexicon( + 'ZwikiLexicon', 'Lexicon', (wordSplitter, caseNormalizer)) for i in TEXTINDEXES: - # XXX should choose a TING2 or ZCTI here and set up appropriately + # we use a ZCTI here and set up appropriately + # this will always work with what stock Zope and Zwiki provides + # admins can replace with a more potent or differently setup index # a TextIndex is case sensitive, exact word matches only # a ZCTextIndex can be case insensitive and do right-side wildcards # a TextIndexNG2 can be case insensitive and do both wildcards - if not i in catalogindexes: PluginIndexes.manage_addTextIndex(i) + if not i in catalogindexes: + extra = Extra() + extra.index_type = 'Okapi BM25 Rank' + extra.lexicon_id = 'ZwikiLexicon' + extra.doc_attr = i + catalog.addIndex(i, 'ZCTextIndex', extra) + for i in FIELDINDEXES: if not i in catalogindexes: PluginIndexes.manage_addFieldIndex(i) for i in KEYWORDINDEXES: diff -rN -u old-ZWiki-unstable/plugins/tracker/tracker_tests.py new-ZWiki-unstable/plugins/tracker/tracker_tests.py --- old-ZWiki-unstable/plugins/tracker/tracker_tests.py 2008-05-01 11:59:21.000000000 -0700 +++ new-ZWiki-unstable/plugins/tracker/tracker_tests.py 2008-05-01 11:59:21.000000000 -0700 @@ -1,6 +1,7 @@ from Products.ZWiki.testsupport import * ZopeTestCase.installProduct('ZWiki') ZopeTestCase.installProduct('ZCatalog') +ZopeTestCase.installProduct('ZCTextIndex') def test_suite(): suite = unittest.TestSuite() -- forwarded from http://zwiki.org/GeneralDiscussion#[email protected]