Back to index

plone3  3.1.7
update_catalogIndexes.py
Go to the documentation of this file.
00001 from Products.CMFCore.utils import getToolByName
00002 
00003 def update_catalogIndexes(self, REQUEST):
00004     '''
00005     External method to drop, re-add, and rebuild catalog Indexes for migrated 
00006     CMF sites from Zope 2.3 to 2.4+.
00007     '''
00008     rIndexes = {'allowedRolesAndUsers': 'KeywordIndex'
00009               , 'effective': 'FieldIndex'
00010               , 'expires': 'FieldIndex'}
00011     ct = getToolByName(self, 'portal_catalog')
00012     map(lambda x, ct=ct: ct.delIndex(x), rIndexes.keys())
00013     map(lambda x, ct=ct: ct.addIndex(x[0], x[1]), rIndexes.items()) 
00014     ct.manage_reindexIndex(ids=rIndexes.keys(), REQUEST=REQUEST)
00015     return 'Catalog Indexes rebuilt.'