Skip to content

Search

Components for building comprehensive search interfaces with filtering, sorting, and result counts.

Search Form

The search_form component is a high-level wrapper that coordinates all search elements.

Parameters for search_form
Parameter Type Description
content any Usually ignored, as the search form is typically rendered in a single part in the template, but can be used when the search form is split into multiple parts.
query str Current search query, used to populate the search input value
sorting_options list[tuple[str, str]] List of available sorting options
sorting str Currently selected sorting option, used to set the value of the search_sort_control element
error str Search error message to show, typically shown when there is an error with the search query or filters
count int Total number of search results, used to show the number of results found
facets list[dict] List of available search facets, used to show the available filters and their counts
facet_titles dict[str, str] Mapping of facet names to their display titles, used to show user-friendly filter labels
active_filters list[tuple[str, str]] List of currently active filters, used to show which filters are currently applied to the search
use_htmx bool Whether to use HTMX for the search form, which allows for dynamic updating of search results without a full page reload
query_name str Name of the search query parameter, used in the search input name and when generating URLs for pagination and sorting links
sorting_name str Name of the sorting parameter, used in the search_sort_control name and when generating URLs for pagination and sorting links
type str Type of the search, used to customize the search form for different types of content (e.g. datasets, organizations, etc.)

Search Input Area

These components handle the primary search query input.

Parameters for search_form_box
Parameter Type Description
content any Search form content, typically including search_input and search_submit_button elements
use_htmx bool Whether to use HTMX for the search form, which allows for dynamic updating of search results without a full page reload
Parameters for search_input
Parameter Type Description
content any Help text for the search input
name str Name of the search query parameter, used in the search input name and when generating URLs for pagination and sorting links
value str Current search query, used to populate the search input value
label str Label text shown next to the search input
placeholder str Placeholder text shown in the search input when it is empty
Parameters for search_submit_button
Parameter Type Description
content any Button label, typically ignored when using an icon for the button

Results & Controls

Search Information

Displays counts and current search context.

Parameters for search_results_text
Parameter Type Description
content any Usually ignored, as the search results text is typically generated dynamically based on the search query and results count, but can be used to customize the search results text.
count int Total number of search results, used to show the number of results found
error str Search error message to show, typically shown when there is an error with the search query or filters
query str Current search query, used to show the search query in the results text
type str Type of the search, used to customize the search results text for different types of content (e.g. datasets, organizations, etc.)
Parameters for search_active_filters
Parameter Type Description
active_filters list[tuple[str, str]] List of currently active filters
facet_titles dict[str, str] Mapping of facet names to their display titles, used to show user-friendly filter labels
facets list[dict] List of available facets, used to show user-friendly filter labels
use_htmx bool Whether to use HTMX for the filter links, which allows for dynamic updating of search results without a full page reload

Advanced Controls & Sorting

Parameters for search_sort_control
Parameter Type Description
content any Help text for the sorting control
name str Name of the sorting parameter, used in the search_sort_control name and when generating URLs for pagination and sorting links
selected str Currently selected sorting option, used to set the value of the search_sort_control element
options list[tuple[str, str]] List of available sorting options, each option is a tuple of (value, label)
label str Label text shown next to the sorting control
Parameters for search_advanced_controls
Parameter Type Description
content any Usually ignored