- Merge request !329Issue #3546704 - Cached the facets results after are processed → (Open) created by unstatu
When building a facet form element, all processors are executed. This happens on every page of a view, because the views facet source uses the `url` cache context (see: https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/views...), and each view page has a unique URL.
As a result, in a view with multiple pages, navigating through each page causes all processors to run for every facet present, even though the facet items themselves do not change.
If a facet contains a large number of items, this repeated processing can significantly degrade view performance.
Additionally, this behavior introduces a potential DDoS (Denial of Service) vulnerability: an attacker could trigger many unique URLs (e.g., by rapidly paging through results or crafting URLs), causing the server to repeatedly execute expensive facet processors and potentially overwhelm system resources.
- Install the Standard profile.
- Create 100 articles.
- Create 1,000 tags, ensuring each tag is referenced by at least one article.
- Create a Search API index for nodes.
- Add the `field_tags` field to the index.
- Create a view based on the Search API index.
- Display article titles and add an exposed filter using the tags facet.
- Enable the "Transform entity ID to label" and "Build hierarchy tree" processors, and add some ordering processors.
- Set the view pager to display 10 items per page.
- Save the view and browse through several pages.
Cache the processed result set so it can be retrieved from cache instead of being rebuilt on every request. The cache should take processor contexts into account, ensuring each result set is uniquely identified.
Active
3.0
Code
It affects performance. It is often combined with the Needs profiling tag.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.