Question

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

Was it helpful?

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top