[Zope-Checkins] SVN: Zope/trunk/src/ - improved index creation in ProductHelp
Yvo Schubbe
y.2009 at wcm-solutions.de
Fri Jul 3 11:11:10 EDT 2009
Log message for revision 101450:
- improved index creation in ProductHelp
- removed special PluginIndexes handling in Product initialization code
Changed:
U Zope/trunk/src/App/Product.py
UU Zope/trunk/src/HelpSys/HelpSys.py
U Zope/trunk/src/OFS/Application.py
-=-
Modified: Zope/trunk/src/App/Product.py
===================================================================
--- Zope/trunk/src/App/Product.py 2009-07-03 15:10:07 UTC (rev 101449)
+++ Zope/trunk/src/App/Product.py 2009-07-03 15:11:10 UTC (rev 101450)
@@ -101,17 +101,10 @@
def __init__(self, id, title):
from HelpSys.HelpSys import ProductHelp
- self.id=id
- self.title=title
+ self.id = id
+ self.title = title
+ self._setObject('Help', ProductHelp('Help', id))
- # Workaround for unknown problem with help system and PluginIndexes product
- # NEEDS to be fixed for 2.4 ! (ajung)
-
- try:
- self._setObject('Help', ProductHelp('Help', id))
- except:
- pass
-
security.declarePublic('Destination')
def Destination(self):
"Return the destination for factory output"
Modified: Zope/trunk/src/HelpSys/HelpSys.py
===================================================================
--- Zope/trunk/src/HelpSys/HelpSys.py 2009-07-03 15:10:07 UTC (rev 101449)
+++ Zope/trunk/src/HelpSys/HelpSys.py 2009-07-03 15:11:10 UTC (rev 101450)
@@ -23,9 +23,17 @@
from OFS.ObjectManager import ObjectManager
from OFS.SimpleItem import Item
from Persistence import Persistent
+from Products.PluginIndexes.KeywordIndex.KeywordIndex import KeywordIndex
from Products.ZCatalog.ZCatalog import ZCatalog
from Products.ZCatalog.Lazy import LazyCat
+from Products.ZCTextIndex.OkapiIndex import OkapiIndex
+from Products.ZCTextIndex.Lexicon import CaseNormalizer
+from Products.ZCTextIndex.HTMLSplitter import HTMLWordSplitter
+from Products.ZCTextIndex.Lexicon import StopWordRemover
+from Products.ZCTextIndex.ZCTextIndex import PLexicon
+from Products.ZCTextIndex.ZCTextIndex import ZCTextIndex
+
class HelpSys(Implicit, ObjectManager, Item, Persistent):
"""
Zope Help System
@@ -221,17 +229,19 @@
)
def __init__(self, id='Help', title=''):
- self.id=id
- self.title=title
- c=self.catalog=ZCatalog('catalog')
- # clear catalog
- for index in c.indexes():
- c.delIndex(index)
- for col in c.schema():
- c.delColumn(col)
- c.addIndex('SearchableText', 'TextIndex')
- c.addIndex('categories', 'KeywordIndex')
- c.addIndex('permissions', 'KeywordIndex')
+ self.id = id
+ self.title = title
+ c = self.catalog = ZCatalog('catalog')
+
+ l = PLexicon('lexicon', '', HTMLWordSplitter(), CaseNormalizer(),
+ StopWordRemover())
+ c._setObject('lexicon', l)
+ i = ZCTextIndex('SearchableText', caller=c, index_factory=OkapiIndex,
+ lexicon_id=l.id)
+ # not using c.addIndex because it depends on Product initialization
+ c._catalog.addIndex('SearchableText', i)
+ c._catalog.addIndex('categories', KeywordIndex('categories'))
+ c._catalog.addIndex('permissions', KeywordIndex('permissions'))
c.addColumn('categories')
c.addColumn('permissions')
c.addColumn('title_or_id')
Property changes on: Zope/trunk/src/HelpSys/HelpSys.py
___________________________________________________________________
Deleted: cvs2svn:cvs-rev
- 1.26
Added: svn:keywords
+ Id
Modified: Zope/trunk/src/OFS/Application.py
===================================================================
--- Zope/trunk/src/OFS/Application.py 2009-07-03 15:10:07 UTC (rev 101449)
+++ Zope/trunk/src/OFS/Application.py 2009-07-03 15:11:10 UTC (rev 101450)
@@ -547,12 +547,10 @@
if ( os.path.exists(os.path.join(fullpath, '__init__.py')) or
os.path.exists(os.path.join(fullpath, '__init__.pyo')) or
os.path.exists(os.path.join(fullpath, '__init__.pyc')) ):
- # import PluginIndexes 1st (why?)
- priority = (name != 'PluginIndexes')
# i is used as sort ordering in case a conflict exists
# between Product names. Products will be found as
# per the ordering of Products.__path__
- products.append((priority, name, i, product_dir))
+ products.append((0, name, i, product_dir))
i = i + 1
products.sort()
return products
More information about the Zope-Checkins
mailing list