code: def _setup_catalog(portal, catalog_id, catalog_definition):
      
  
      reindex = False
      catalog = getToolByName(portal, catalog_id, None)
      if catalog is None:
          logger.warning('Could not find the %s tool.' % (catalog_id))
          return False
      # Indexes
      indexes_ids = catalog_definition.get('indexes', {}).keys()
      # Indexing
      for idx in indexes_ids:
          # The function returns if the index needs to be reindexed
          indexed = _addIndex(catalog, idx, catalog_definition['indexes'][idx])
          reindex = True if indexed else reindex
      # Removing indexes
      in_catalog_idxs = catalog.indexes()
      to_remove = list(set(in_catalog_idxs)-set(indexes_ids))
      for idx in to_remove:
          # The function returns if the index has been deleted
          desindexed = _delIndex(catalog, idx)
          reindex = True if desindexed else reindex
      # Columns
      columns_ids = catalog_definition.get('columns', [])
      for col in columns_ids:
          created = _addColumn(catalog, col)
          reindex = True if created else reindex
      # Removing columns
      in_catalog_cols = catalog.schema()
      to_remove = list(set(in_catalog_cols)-set(columns_ids))
      for col in to_remove:
          # The function returns if the index has been deleted
          desindexed = _delColumn(catalog, col)
          reindex = True if desindexed else reindex
      return reindex
docs: Given a catalog definition it updates the indexes, columns and content_type
      definitions of the catalog.
      :portal: the Plone site object
      :catalog_id: a string as the catalog id
      :catalog_definition: a dictionary like
          {
              'types':   ['ContentType', ...],
              'indexes': {
                  'UID': 'FieldIndex',
                  ...
              },
              'columns': [
                  'Title',
                  ...
              ]
          }