Extension Search Facet Presets


Extension Basics

Title
Search Facet Presets
Name
ckanext-search-preset
Type
Public extension
Description
Create collections from search facets with automatic dataset matching
CKAN versions

~2.9, ~2.10, ~2.11

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


Background Infos

Description (long)
Show details

A powerful extension for storing search facets as package fields to create dynamic collections that automatically list datasets satisfying the stored criteria. The primary use case is creating ‘collections’ or ‘presets’ that contain datasets matching fixed search facets - users select facets on the search page, trigger collection creation, and the collection page automatically shows all matching datasets (updated dynamically as new datasets are added). Requires Python v3.7+ and CKAN 2.9-2.10. The extension supports complex configurations including custom package types, field prefixes for preset data, base64 encoding for URL parameters, and extensive control over which facets and extra fields can be used. An example schema is provided at ckanext/search_preset/example_preset.yaml showing the required field structure with pattern.

Version
0.0.2
Version release date
2025-07-17
Contact name
DataShades
Contakt email
Contact Url
(not set)


Installation Guide

Configuration hints

Installation: pip install ckanext-search-preset. Add ‘search_preset’ to ckan.plugins in your CKAN configuration. Requires Python v3.7+, CKAN 2.9-2.10. Package Type Requirement: Presets require a special package type (custom schema) with fields matching pattern . Configuration Options: ckanext.search_preset.default_type = preset (default preset type created by Create Preset button). ckanext.search_preset.package_types = preset collection dataset (package types that show matching packages, default: value of default_type). ckanext.search_preset.group_by_field = type (field for grouping before printing, default: none). ckanext.search_preset.field_prefix = facet_field_ (default: search_preset_field_) - prefix for preset fields holding facet details. ckanext.search_preset.allowed_facets = license_id organization (default: any existing facet) - facets usable by preset. ckanext.search_preset.extras_field = search_extra_field_ (default: none) - field holding ext_* fields from preset creation. ckanext.search_preset.allowed_extras = ext_bbox ext_start_date (default: any passed extra) - ext_* fields to capture. ckanext.search_preset.convert_to_base64 = true (default: false) - base64 encoding for JSON in URL. If base64 enabled: apply search_preset_decode_from_base64 validator to custom fields. Example Schema: ckanext/search_preset/example_preset.yaml. Active facets stored as JSON arrays. Programmatic Creation: ckanapi action package_create name=datasets-with-tag-xxx type= search_preset_field_tags=’[“xxx”]’. API Action: search_preset_preset_list id=. Jinja2 blocks customizable for preset page output. Dependencies: ckanext-toolbelt>=0.2.5, typing-extensions.

Plugins to configure (ckan.ini)
search_preset
CKAN Settings (ckan.ini)
# ckanext.search_preset.default_type = preset # ckanext.search_preset.package_types = preset collection dataset # ckanext.search_preset.group_by_field = type # ckanext.search_preset.field_prefix = facet_field_ # ckanext.search_preset.allowed_facets = license_id organization # ckanext.search_preset.extras_field = search_extra_field_ # ckanext.search_preset.allowed_extras = ext_bbox ext_start_date # ckanext.search_preset.convert_to_base64 = false
DB migration to be executed
(not set)
<< back to Extensions