Is it possible to run a complex query against a KeywordIndex?

Hi everyone,

I'm developing a custom search in a Plone portal using the catalog.

The customer requested that a query like this be performed on the Subject keywordIndex:

("green" OR "blue") AND ("winter" OR "autumn").

I've looked into the documentation on docs plone org (path /develop/plone/searching_and_indexing/query.html) and IIUC I can't run a query like the one above directly through the catalog.

Is it true? Before I start investigating a way to solve this I'm asking here to make sure I'm not overlooking the simplest available solution.

This might be a good solution if you require complex filtering:

It is true.

The catalog interface was designed with an HTML form frontend in mind -- i.e. a mostly flat data structure. For this reason, it has limited support for boolean operators.

You could install the external product Products.AdvancedQuery. It has the use via programs in mind and therefore allows much more complex queries (among them the one you need).

Thanks for the info @dieter and @mtrebron!

For now I'll just load all existing brains and filter them in python, since there are only a handful of objects. If they turn out to be too many I think I'll opt for Products.AdvancedQuery, to avoid the dependency on solr.

Solr is optional, all you really need to get started is

eggs +=

To get this: