from Acquisition import aq_inner
from Acquisition import aq_parent
from Products.CMFCore.utils import getToolByName


def upgrade(tool):
    """ Just some catalog indexes to update
    """
    portal = aq_parent(aq_inner(tool))
    portal_catalog = getToolByName(portal, 'portal_catalog')
    typestool = getToolByName(portal, 'portal_types')
    setup = portal.portal_setup

    bc = getToolByName(portal, 'bika_catalog')
    bc.delIndex('getSampleTypeTitle')
    bc.delIndex('getSamplePointTitle')
    bc.addIndex('getSampleTypeTitle', 'KeywordIndex')
    bc.addIndex('getSamplePointTitle', 'KeywordIndex')
    for o in bc():
        o.reindexObject(idxs=['getSampleTypeTitle', 'getSamplePointTitle'])

from Acquisition import aq_inner
from Acquisition import aq_parent
from Products.CMFCore.utils import getToolByName


def upgrade(tool):
    """ Just some catalog indexes to update
    """
    portal = aq_parent(aq_inner(tool))
    portal_catalog = getToolByName(portal, 'portal_catalog')
    typestool = getToolByName(portal, 'portal_types')
    setup = portal.portal_setup

    bc = getToolByName(portal, 'bika_catalog')
    bc.delIndex('getSampleTypeTitle')
    bc.delIndex('getSamplePointTitle')
    bc.addIndex('getSampleTypeTitle', 'KeywordIndex')
    bc.addIndex('getSamplePointTitle', 'KeywordIndex')
    bc.clearFindAndRebuild()

Fix upgrade step 1115: rebuild catalog
Fix upgrade step 1115: rebuild catalog

  from Acquisition import aq_inner
  from Acquisition import aq_parent
  from Products.CMFCore.utils import getToolByName
  
  
  def upgrade(tool):
      """ Just some catalog indexes to update
      """
      portal = aq_parent(aq_inner(tool))
      portal_catalog = getToolByName(portal, 'portal_catalog')
      typestool = getToolByName(portal, 'portal_types')
      setup = portal.portal_setup
  
      bc = getToolByName(portal, 'bika_catalog')
      bc.delIndex('getSampleTypeTitle')
      bc.delIndex('getSamplePointTitle')
      bc.addIndex('getSampleTypeTitle', 'KeywordIndex')
      bc.addIndex('getSamplePointTitle', 'KeywordIndex')
+     bc.clearFindAndRebuild()
-     for o in bc():
-         o.reindexObject(idxs=['getSampleTypeTitle', 'getSamplePointTitle'])
  
Fix upgrade step 1115: rebuild catalog
## Code Before:
from Acquisition import aq_inner
from Acquisition import aq_parent
from Products.CMFCore.utils import getToolByName


def upgrade(tool):
    """ Just some catalog indexes to update
    """
    portal = aq_parent(aq_inner(tool))
    portal_catalog = getToolByName(portal, 'portal_catalog')
    typestool = getToolByName(portal, 'portal_types')
    setup = portal.portal_setup

    bc = getToolByName(portal, 'bika_catalog')
    bc.delIndex('getSampleTypeTitle')
    bc.delIndex('getSamplePointTitle')
    bc.addIndex('getSampleTypeTitle', 'KeywordIndex')
    bc.addIndex('getSamplePointTitle', 'KeywordIndex')
    for o in bc():
        o.reindexObject(idxs=['getSampleTypeTitle', 'getSamplePointTitle'])

## Instruction:
Fix upgrade step 1115: rebuild catalog
## Code After:
from Acquisition import aq_inner
from Acquisition import aq_parent
from Products.CMFCore.utils import getToolByName


def upgrade(tool):
    """ Just some catalog indexes to update
    """
    portal = aq_parent(aq_inner(tool))
    portal_catalog = getToolByName(portal, 'portal_catalog')
    typestool = getToolByName(portal, 'portal_types')
    setup = portal.portal_setup

    bc = getToolByName(portal, 'bika_catalog')
    bc.delIndex('getSampleTypeTitle')
    bc.delIndex('getSamplePointTitle')
    bc.addIndex('getSampleTypeTitle', 'KeywordIndex')
    bc.addIndex('getSamplePointTitle', 'KeywordIndex')
    bc.clearFindAndRebuild()
