URL Parameters not persistent enough for facet filtered VBO/VBE Views

Created on 7 August 2019, about 5 years ago
Updated 13 April 2024, 6 months ago

I've been working on #3068802: Search Facets ignored with VBO "Select All" β†’ . It's part Facets problem, part Views Bulk Operations problem, and part Views Bulk Edit problem.

After about three weeks of consideration, I'm starting to believe the root issue is Facets, and how it deals with filters in QueryString::initializeActiveFilters().

Facets makes the implicit assumption that the Facet Filters can be pulled from the query string in all instances. Every time a facet query is run, it rebuilds the facets from the URL Parameters:

  protected function initializeActiveFilters() {
    $url_parameters = $this->request->query;

That's fine when the facet filtering is immediate. However, these views can be used in other instances, like Views Bulk Operations. There, if "Select All" is chosen, the query is stored and called several times over several page loads. With those page refreshes, the URL parameters are often lost.

Here's the sequence of what's happening when you VBO "Select All" a faceted search result, then attenmpt to Views Bulk Edit it.

1) views_bulk_operations's form submission redirects the browser to /views-bulk-operations/configure/[search_id]/[page_id]
2) view_bulk_edit's ModifyEntityValues::getViewBundles() runs. $this->context['list'] isn't set, so it attempts to build a new view with no limit or offset to figure out what bundles "all" has
3) As the view is executed, facets_search_api_query_alter is triggered. This leads to the calling of facets' QueryString::initializeActiveFilters().
4) QueryString::initializeActiveFilters() looks for the facets in the query string (blown away in step #1) and doesn't find any.
5) views_bulk_edit's ModifyEntityValues::getViewBundles() returns with a query that's not filtered by facets.

I naively thought that if I could only pass the GET parameters into Views Bulk Edit, the problem would go away, but it's much worse than I feared - the view result needs to be passed on into batch processing. By then, the GET params are long since blown away.

I'm wondering if how facets handles its facet parameters needs to be changed somehow. Sure, they can be initialized by GET params, but perhaps those params should stick around in a tempstore if the view gets called again.

I'm really not sure what the best procedure is here and how to proceed.

πŸ’¬ Support request
Status

Closed: outdated

Version

1.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada TrevorBradley

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024