code: def _cleanAndRebuildIfNeeded(portal, cleanrebuild):
      
      for cat in cleanrebuild:
          catalog = getToolByName(portal, cat)
          if catalog:
              if hasattr(catalog, "softClearFindAndRebuild"):
                  catalog.softClearFindAndRebuild()
              else:
                  catalog.clearFindAndRebuild()
          else:
              logger.warning('%s do not found' % cat)
docs: Rebuild the given catalogs.
      :portal: the Plone portal object
      :cleanrebuild: a list with catalog ids