code: def setup_core_catalogs(portal):
      
      logger.info("*** Setup Core Catalogs ***")
  
      to_reindex = []
      for catalog, name, attribute, meta_type in INDEXES:
          c = api.get_tool(catalog)
          indexes = c.indexes()
          if name in indexes:
              logger.info("*** Index '%s' already in Catalog [SKIP]" % name)
              continue
  
          logger.info("*** Adding Index '%s' for field '%s' to catalog ..."
                      % (meta_type, name))
  
          # do we still need ZCTextIndexes?
          if meta_type == "ZCTextIndex":
              addZCTextIndex(c, name)
          else:
              c.addIndex(name, meta_type)
  
          # get the new created index
          index = c._catalog.getIndex(name)
          # set the indexed attributes
          if hasattr(index, "indexed_attrs"):
              index.indexed_attrs = [attribute or name]
  
          to_reindex.append((c, name))
          logger.info("*** Added Index '%s' for field '%s' to catalog [DONE]"
                      % (meta_type, name))
  
      # catalog columns
      for catalog, name in COLUMNS:
          c = api.get_tool(catalog)
          if name not in c.schema():
              logger.info("*** Adding Column '%s' to catalog '%s' ..."
                          % (name, catalog))
              c.addColumn(name)
              logger.info("*** Added Column '%s' to catalog '%s' [DONE]"
                          % (name, catalog))
          else:
              logger.info("*** Column '%s' already in catalog '%s'  [SKIP]"
                          % (name, catalog))
              continue
  
      for catalog, name in to_reindex:
          logger.info("*** Indexing new index '%s' ..." % name)
          catalog.manage_reindexIndex(name)
          logger.info("*** Indexing new index '%s' [DONE]" % name)
docs: Setup core catalogs