Problem/Motivation

My website had a redesign some time ago. In this redesign, some facet machine names were changed.

My problem is that search engine bots have indexed urls with the old names such as:

/my/page?f[0]=foobar

When no facet with this name is found, I get a 500 response with this error.

Uncaught PHP Exception InvalidArgumentException: "The Facet  could not be loaded." at /mnt/www/html/dkrweb/docroot/modules/contrib/facets/src/Utility/FacetsUrlGenerator.php

What I want to achieve is that, if a facet with the non-valid name is supplied on the query string, that this is ignored.

Proposed resolution

The solution I came up with is in the attached patch, which I apply against version 8.x-1.1. It works for me, because I have a RangeSlider on my page, I'm not sure if it will work for everyone.

CommentFileSizeAuthor
#2 3012047-2.patch837 bytesmichaellenahan
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

michaellenahan created an issue. See original summary.

michaellenahan’s picture

FileSize
837 bytes

Here's the patch, it simply removes invalid items from the $active_filters array in \Drupal\facets_range_widget\Plugin\facets\processor\RangeSliderProcessor::build

vdenis’s picture

Status: Active » Needs review

borisson_’s picture

Status: Needs review » Fixed

Yep, looks very solid and really simple. Committed and pushed, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.