Skip to content

feat(search): tagFilters#1034

Open
abulte wants to merge 7 commits intodatagouv:mainfrom
ecolabdata:feat/global-search/tag-filters
Open

feat(search): tagFilters#1034
abulte wants to merge 7 commits intodatagouv:mainfrom
ecolabdata:feat/global-search/tag-filters

Conversation

@abulte
Copy link
Copy Markdown
Contributor

@abulte abulte commented Apr 9, 2026

Close ecolabdata/ecospheres#1011

Adds a tagFilters option to GlobalSearchConfig that renders select dropdowns whose values map to the tag API param.

This enables multiple independent predefined-value tag filters (e.g. theme, enjeu, secteur like on https://ecologie.data.gouv.fr/indicators) that merge correctly with hiddenFilters and the native tag filter.

The URL is two-way synced with the dropdowns. Query param name is filter's name.

Example usage:

const config: GlobalSearchConfig = [
    {
        class: 'datasets',
        hiddenFilters: [
            { key: 'tag', value: 'ecospheres-indicateurs' },
            { key: 'organization', value: '67884b4da4fca9c97bbef479' }
        ],
        basicFilters: ['last_update_range', 'badge'],
        advancedFilters: [],
        tagFilters: [
            {
                urlParam: 'theme',
                label: 'Thématique',
                defaultLabel: 'Toutes les thématiques',
                values: [
                    { value: 'ecospheres-indicateurs-theme-mieux-consommer', label: 'Mieux consommer' },
                    { value: 'ecospheres-indicateurs-theme-mieux-produire', label: 'Mieux produire' },
                    // ...
                ]
            },
            {
                urlParam: 'enjeu',
                label: 'Enjeu',
                defaultLabel: 'Tous les enjeux',
                values: [
                    { value: 'ecospheres-indicateurs-enjeu-adaptation-climat', label: 'Adaptation climat' },
                // ...
                ]
            },
            // secteur, levier, maille…
        ]
    }
]

Selecting "Mieux consommer" in Thème dropdown → theme=ecospheres-indicateurs-theme-mieux-consommer in the URL → API receives tag=ecospheres-indicateurs&tag=ecospheres-indicateurs-theme-mieux-consommer.

Bonus

@abulte
Copy link
Copy Markdown
Contributor Author

abulte commented Apr 9, 2026

CI output, failures seem unrelated? https://github.com/ecolabdata/cdata/actions/runs/24194727780

@abulte abulte marked this pull request as ready for review April 9, 2026 16:09
@abulte
Copy link
Copy Markdown
Contributor Author

abulte commented Apr 9, 2026

@maudetes @ThibaudDauce @nicolaskempf57 don't know why it's not assigning you as reviewers 🤷 And I can't do it myself, hence the ping. Thanks!

abulte added a commit to opendatateam/udata-front-kit that referenced this pull request Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GlobalSearch: support tag-based predefined-value filters (tagFilters)

1 participant