Requirements:
- typing_extensions
Installation:
pip install ckanext-or-facet
Add to ckan.plugins:
or_facet
Configuration:
List of facets that use OR logic when applied (optional, default: empty)
Facets not in this list continue using AND logic (default behavior)
ckanext.or_facet.optional = tags res_format
For CKAN v2.10.4 and later: Allow required Solr query parsers
ckan.search.solr_allowed_query_parsers = edismax bool
Example Usage:
Default CKAN behavior (AND logic):
- User selects tags: “economy” AND “health”
- Result: Only datasets with BOTH tags
With or_facet enabled for tags (OR logic):
- User selects tags: “economy” AND “health”
- Result: Datasets with EITHER “economy” OR “health” OR both
Common use cases:
- Tags: Find datasets matching any selected tag
- Formats: Find datasets in any selected format (CSV OR JSON OR XML)
- Organizations: Find datasets from any selected organization
- Groups: Find datasets in any selected group
Multiple facets can be configured:
ckanext.or_facet.optional = tags res_format organization groups
Note: This only affects facets listed in ckanext.or_facet.optional.
Other facets continue using default AND logic.
Testing: pytest –ckan-ini=test.ini