Getting a list of catalog indexes and metadata

I recently had a need to get a list of the indexes from the portal_catalog.

While the metadata has an API method to get it, using something along:

pc = getToolByName(self, 'portal_catalog')
metadatas = pc.enumerateColumns()

I couldn't find the equivalent API method to get the Indexes. After digging through the DTML files used by ZCatalog, I came up with the following method:

pc = getToolByName(self, 'portal_catalog')
indexes = pc.Indexes.objectIds()

Comments