From 31f7b08b8d46ccdafc2b9886ef35aa7c175f4fcf Mon Sep 17 00:00:00 2001 From: Santeri Hurnanen Date: Thu, 7 Dec 2023 08:01:59 +0200 Subject: [PATCH] UHF-X: Fix caching issue in address search --- .../src/Plugin/views/filter/AddressSearch.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/helfi_address_search/src/Plugin/views/filter/AddressSearch.php b/modules/helfi_address_search/src/Plugin/views/filter/AddressSearch.php index 4fb9a1a..eac1d0b 100644 --- a/modules/helfi_address_search/src/Plugin/views/filter/AddressSearch.php +++ b/modules/helfi_address_search/src/Plugin/views/filter/AddressSearch.php @@ -90,6 +90,10 @@ public static function sortByAddress(ViewExecutable $view): ViewExecutable { (float) $result->_entity->get('latitude')->getString(), (float) $result->_entity->get('longitude')->getString()); + // The entity should not be cached since it relies on high-cardinality + // user input. + $result->_entity->mergeCacheMaxAge(0); + // Set the distance to computed field. $result->_entity->set('distance', $distances[$result->_entity->get('id')->getString()]); }