feat(search): configurable facets size - #3738
Open
abulte wants to merge 2 commits into
Open
Conversation
abulte
marked this pull request as ready for review
April 24, 2026 08:37
Contributor
Author
|
@ThibaudDauce can't assign you as reviewer from a fork... Can you have a look? 🙏 |
Contributor
Author
|
Idea: use SOLR DSL for url queries https://solr.apache.org/guide/solr/latest/query-guide/faceting.html (thanks @streino) |
This was referenced Jun 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related datagouv/data.gouv.fr#1432
Related datagouv/cdata#1054
This lets the consumer use a query parameter
?facet_size__{facet_name}={value}to request more bucket values for a facet from ElasticSearch.There's a configurable
MAX_FACET_SIZEthat defaults to 500. Increasing the facet size leads to more resource usage in ES, this a defensive value that needs to be discussed.Not all facets can be configured, it's in a
configurable_size_facets[]list on the adapter. Onlyorganization_id_with_nameis in there for now. Listing the facts was needed to generate a proper query arg parser, and I took the opportunity to limit the facets that can be configured. We could include more facets by default. We could also refactor to auto-list all the supported facets, but it's a bigger rework ⬇️.⬆️ This rework is proposed in ecolabdata#10, I can merge that one into this one if it makes sense.
For ecologie.data.gouv.fr, this would let use
facet_size__organization_id_with_name=200for the filter from datagouv/cdata#1054 to have all the values from our universe. It would also need to be wired up in cdata'sGlobalSearch.Reference: https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-terms-aggregation#search-aggregations-bucket-terms-aggregation-size