code: def reindex_content_structure(portal):
      
      logger.info("*** Reindex content structure ***")
  
      def reindex(obj, recurse=False):
          # skip catalog tools etc.
          if api.is_object(obj):
              obj.reindexObject()
          if recurse and hasattr(aq_base(obj), "objectValues"):
              map(reindex, obj.objectValues())
  
      setup = api.get_setup()
      setupitems = setup.objectValues()
      rootitems = portal.objectValues()
  
      for obj in itertools.chain(setupitems, rootitems):
          logger.info("Reindexing {}".format(repr(obj)))
          reindex(obj)
docs: Reindex contents generated by Generic Setup