Extension OR Facet


Extension Basics

Title
OR Facet
Name
ckanext-or_facet
Type
Public extension
Description
Change facet logic to search for datasets including ANY of applied facets instead of ALL
CKAN versions

~2.9, ~2.10, ~2.11

Show details
Download-Url (zip)
Download-Url commit date
2025-05-27
Url to repo
Category
Specialized Tools


Background Infos

Description (long)
Show details

The or_facet extension modifies the default facet search logic in CKAN. By default, CKAN requires datasets to match ALL applied facets (AND logic). This extension enables searching for datasets that match ANY of the applied facets (OR logic) for specified facet fields. This is particularly useful when users want to find datasets matching multiple tags, formats, or other facet values without requiring all facets to be present simultaneously. Configuration is simple - just specify which facets should use OR logic via the ckanext.or_facet.optional setting. Starting from CKAN v2.10.4, the Solr configuration must also allow the edismax and bool query parsers.

Version
0.3.1
Version release date
2025-05-27
Contact name
DataShades
Contakt email
Contact Url
(not set)


Installation Guide

Configuration hints

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

Plugins to configure (ckan.ini)
or_facet
CKAN Settings (ckan.ini)
# ckanext.or_facet.optional = tags res_format # ckan.search.solr_allowed_query_parsers = edismax bool
DB migration to be executed
(not set)
<< back to Extensions