Python/Plone: Getting all unique keywords (Subject)

keyword, plone, python, subject

Solution

catalog = self.context.portal_catalog
my_keys = catalog.uniqueValuesFor('Subject')

reference: http://docs.plone.org/develop/plone/searching_and_indexing/query.html#unique-values

Problem

Is there a way of getting all the unique keyword index i.e. Subject in Plone by querying the catalog? I have been using this as a guide but not yet successful. This is what I have so far ``` def search_content_by_keywords(self): """ Attempting to search the catalog """ catalog = self.context.portal_catalog query = {} query['Subject'] = 'Someval' results = catalog.searchResults(query) return results ``` Instead of passing the keyword, I want to fetch all the keywords

Original source