Skip to main content

Compound criterion for managing complex query

Project description

This package add a new kind of criterion available for


Sometimes, some index are composed of different elements with a certain logic or you need to query particular elements of the site like groups of the current user or anything else. This is not achievable using default indexes and Collection UI, you need to write python code.

How to use

When adding/editing a Collection, a new criterion filed under the ‘Other’ category of available indexes called ‘Filter’ is available.

When selecting a ‘Filter’, a selection box will show you named adapter that provide the collective.compoundcriterion.interfaces.ICoumpondCriterionFilter interface.

You will be able to select among available ones. This can still be used together with other criteria.

To register this complex query builder named adapter, you will have to add this kind of code :

<adapter for="*"
         name="testing-compound-adapter" />

How to test

Add the adapter registration zcml here above to a configure.zcml file (like the one in collective.compoundcriterion), it will make the ‘testing-compound-adapter’ available in the Collection ‘Filter’ index.

This testing adapter will query elements of the site having string ‘special_text_to_find’ in the title. So create a document with such title and it should work.

A second adapter can be used to test :

<adapter for="*"
         name="sample-compound-adapter" />

This one will query elements having ‘title_with_sample_text’ in the title.


This product has been translated into

  • French.

  • Spanish.

You can contribute for any message missing or other new languages, join us at Plone Collective Team into service with all world Plone translators community.



0.5 (2021-04-20)

  • Add service integration to manage the translation process. [macagua]

  • Add Spanish translation [macagua]

0.4 (2018-08-31)

  • When getting the adapter, if context is not the Collection, try to get real context following various cases. This is the case when using Collection from [gbastien]

  • Do not use a SelectionWidget to render the querystring widget as it does not exist anymore for Collection. Use the MultipleSelectionWidget. This way finally we may select several filters to build the query. [gbastien]

  • When using ‘not’ in queries for ZCatalog 3, ‘query’ level must be replaced by ‘not’ in query dictionary. [sgeulette]

0.3 (2016-12-08)

  • Return clear message when a query format is not compliant. [gbastien]

0.2 (2015-09-04)

  • Raise a KeyError if the format of the query returned by the named adapter is not compliant with what is returned by, this way it behaves correctly with collective.eeafaceted.collectionwidget. [gbastien]

0.1 (2015-06-02)

  • Initial release. [IMIO]

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

collective.compoundcriterion-0.5.tar.gz (22.1 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page