From 7d1f941a97e0a682b5bddaffad6510963bee3779 Mon Sep 17 00:00:00 2001
From: Ere Maijala <ere.maijala@helsinki.fi>
Date: Thu, 26 Nov 2015 14:15:46 +0200
Subject: [PATCH] Optimize saving a search a tiny bit.

---
 module/VuFind/src/VuFind/Db/Table/Search.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/module/VuFind/src/VuFind/Db/Table/Search.php b/module/VuFind/src/VuFind/Db/Table/Search.php
index db33c561595..52cbb15b2b6 100644
--- a/module/VuFind/src/VuFind/Db/Table/Search.php
+++ b/module/VuFind/src/VuFind/Db/Table/Search.php
@@ -151,6 +151,7 @@ class Search extends Gateway
         $newSearch, $sessionId, $searchHistory = []
     ) {
         // Duplicate elimination
+        $newUrl = $newSearch->getUrlQuery()->getParams();
         foreach ($searchHistory as $oldSearch) {
             // Deminify the old search (note that if we have a resource, we need
             // to grab the contents -- this is necessary for PostgreSQL compatibility
@@ -159,7 +160,6 @@ class Search extends Gateway
             $dupSearch = $minSO->deminify($manager);
             // See if the classes and urls match
             $oldUrl = $dupSearch->getUrlQuery()->getParams();
-            $newUrl = $newSearch->getUrlQuery()->getParams();
             if (get_class($dupSearch) == get_class($newSearch)
                 && $oldUrl == $newUrl
             ) {
-- 
GitLab