From cf6792ed7a05be1fa165657594e333bef6899580 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Tue, 15 Mar 2016 12:09:32 -0400
Subject: [PATCH] Prevent unwanted conversion to advanced search.

---
 module/VuFind/src/VuFind/Search/Base/Params.php | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/module/VuFind/src/VuFind/Search/Base/Params.php b/module/VuFind/src/VuFind/Search/Base/Params.php
index cde0619e754..dd09f57a0ea 100644
--- a/module/VuFind/src/VuFind/Search/Base/Params.php
+++ b/module/VuFind/src/VuFind/Search/Base/Params.php
@@ -449,13 +449,18 @@ class Params implements ServiceLocatorAwareInterface
 
         $this->searchType = $this->query instanceof Query ? 'basic' : 'advanced';
 
-        // If we ended up with a basic search, set the default handler if necessary
-        // and convert it to an advanced search:
+        // If we ended up with a basic search, it's probably the result of
+        // submitting an empty form, and more processing may be needed:
         if ($this->searchType == 'basic') {
+            // Set a default handler if necessary:
             if ($this->query->getHandler() === null) {
                 $this->query->setHandler($this->getOptions()->getDefaultHandler());
             }
-            $this->convertToAdvancedSearch();
+            // If the user submitted the advanced search form, we want to treat
+            // the search as advanced even if it evaluated to a basic search.
+            if ($request->offsetExists('lookfor0')) {
+                $this->convertToAdvancedSearch();
+            }
         }
     }
 
-- 
GitLab