From 69d669f030cf7bfa414f769b520b6efe86b88754 Mon Sep 17 00:00:00 2001 From: Jon Stovell Date: Thu, 28 Mar 2024 14:48:49 -0600 Subject: [PATCH] Fixes a couple of places where search APIs were using obsolete globals Signed-off-by: Jon Stovell --- Sources/Search/APIs/Custom.php | 6 ++---- Sources/Search/APIs/Fulltext.php | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Sources/Search/APIs/Custom.php b/Sources/Search/APIs/Custom.php index 05f8e800f4..e9ff8727fb 100644 --- a/Sources/Search/APIs/Custom.php +++ b/Sources/Search/APIs/Custom.php @@ -114,10 +114,8 @@ public function isValid(): bool */ public function searchSort(string $a, string $b): int { - global $excludedWords; - - $x = strlen($a) - (in_array($a, $excludedWords) ? 1000 : 0); - $y = strlen($b) - (in_array($b, $excludedWords) ? 1000 : 0); + $x = strlen($a) - (in_array($a, $this->excludedWords) ? 1000 : 0); + $y = strlen($b) - (in_array($b, $this->excludedWords) ? 1000 : 0); return $y < $x ? 1 : ($y > $x ? -1 : 0); } diff --git a/Sources/Search/APIs/Fulltext.php b/Sources/Search/APIs/Fulltext.php index a252ffdc56..763e0d7259 100644 --- a/Sources/Search/APIs/Fulltext.php +++ b/Sources/Search/APIs/Fulltext.php @@ -129,10 +129,8 @@ protected function _getMinWordLength(): int */ public function searchSort(string $a, string $b): int { - global $excludedWords; - - $x = Utils::entityStrlen($a) - (in_array($a, $excludedWords) ? 1000 : 0); - $y = Utils::entityStrlen($b) - (in_array($b, $excludedWords) ? 1000 : 0); + $x = Utils::entityStrlen($a) - (in_array($a, $this->excludedWords) ? 1000 : 0); + $y = Utils::entityStrlen($b) - (in_array($b, $this->excludedWords) ? 1000 : 0); return $x < $y ? 1 : ($x > $y ? -1 : 0); }