Add catalog metadata column to existing standard type

I'd like to add a few new metadata columns to my catalog, for use in lists; e.g., I'd like to have (among others) a subject_formatted column to give me the (sorted, for a start) Subject values as a string, and a code_formatted column which contains the language-specific expansion of my code field.
I seem to have a problem wiring things together.

For a start, I created a code_formatted metadata column which uses an existing ExtensionStringField code (used in my traditional setup to extend the AT Document and Folder types; thus, I'm not very conversant with interfaces and ZCA in this respect).
In my extension package to take care of the code aspects, I added a catalog.xml to the default profile:

<?xml version="1.0"?>
<object name="portal_catalog" meta_type="Plone Catalog Tool">
  <column value="code_formatted"/>
</object>

In my ZCML, I have:

<adapter
    factory=".metadata.code_formatted"
    provides=".metadata.interfaces.IHierarchicalCodeFormatted"
    name="code_formatted"
    for="*"
    />

... with IHierarchicalCodeFormatted being a new interface used nowhere else so far:

from zope.interface import Interface

class IHierarchicalCodeFormatted(Interface):
    """
    A string to represent 0 to (currently) 3 levels of hierarchical codes,
    possibly shortened (e.g. by leaving out repetitions of the top level title
    in the lower levels)
    """

and the following implementation stub:

def code_formatted(context):
    """
    return a string containing all (up to 3) levels of the hierarchical
    buzzword "code"
    """
    set_trace()
    ...

Now, when I restart my development instance and re-execute my profile, I have the new metadata column, but it is empty; when editing a document or folder and saving the changes, I'd expect the object to be reindexed and my function to be called. But it isn't.

So I wondered whether some more wiring would be necessary, and I created another (at) module in the metadata subpackage, which is activated via <include package=".at" />:

from Products.ATContentTypes.content.document import ATDocument
from Products.ATContentTypes.content.folder import ATFolder
from zope.interface import classImplements

from .interfaces import IHierarchicalCodeFormatted

classImplements(ATDocument, IHierarchicalCodeFormatted)
classImplements(ATFolder, IHierarchicalCodeFormatted)

But still -- when I edit an object (document or folder), causing it to be reindexed, my implementation stub is not called.

So there must be missing something.
Or should I do it completely differently?

Is your code_formatted registered as a custom indexer ?

Well, no.
I came across this, but what I need is not an index but a metadata column; so I didn't use that decorator ...

Now that I added it:

from plone.indexer.decorator import indexer

@indexer(IHierarchicalCodeFormatted)
def code_formatted(context):
    ...

and removed the provides and for attributes, it works; thank you!
(The only remaining problem: the code is currently run twice ...)