From 9fa5ececb7251a8ac8693067f395df6774af3a12 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 4 Oct 2016 16:54:16 +0200 Subject: [PATCH] add showSingleSearchHit config option --- inc/inc.ClassSettings.php | 4 ++++ op/op.Settings.php | 1 + out/out.Search.php | 2 +- views/bootstrap/class.Settings.php | 4 ++++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/inc/inc.ClassSettings.php b/inc/inc.ClassSettings.php index 604df1eea..00aabc562 100644 --- a/inc/inc.ClassSettings.php +++ b/inc/inc.ClassSettings.php @@ -97,6 +97,8 @@ class Settings { /* {{{ */ var $_fullSearchEngine = 'lucene'; // default search method var $_defaultSearchMethod = 'database'; // or 'fulltext' + // jump straight to the document if it is the only hit of a search + var $_showSingleSearchHit = true; // contentOffsetDirTo var $_contentOffsetDir = "1048576"; // Maximum number of sub-directories per parent directory @@ -397,6 +399,7 @@ class Settings { /* {{{ */ $this->_maxSizeForFullText = intval($tab["maxSizeForFullText"]); $this->_fullSearchEngine = strval($tab["fullSearchEngine"]); $this->_defaultSearchMethod = strval($tab["defaultSearchMethod"]); + $this->_showSingleSearchHit = Settings::boolVal($tab["showSingleSearchHit"]); $this->_stopWordsFile = strval($tab["stopWordsFile"]); $this->_sortUsersInList = strval($tab["sortUsersInList"]); $this->_sortFoldersDefault = strval($tab["sortFoldersDefault"]); @@ -678,6 +681,7 @@ class Settings { /* {{{ */ $this->setXMLAttributValue($node, "maxSizeForFullText", $this->_maxSizeForFullText); $this->setXMLAttributValue($node, "fullSearchEngine", $this->_fullSearchEngine); $this->setXMLAttributValue($node, "defaultSearchMethod", $this->_defaultSearchMethod); + $this->setXMLAttributValue($node, "showSingleSearchHit", $this->_showSingleSearchHit); $this->setXMLAttributValue($node, "expandFolderTree", $this->_expandFolderTree); $this->setXMLAttributValue($node, "stopWordsFile", $this->_stopWordsFile); $this->setXMLAttributValue($node, "sortUsersInList", $this->_sortUsersInList); diff --git a/op/op.Settings.php b/op/op.Settings.php index da55f7ddc..7873ea292 100644 --- a/op/op.Settings.php +++ b/op/op.Settings.php @@ -72,6 +72,7 @@ if ($action == "saveSettings") $settings->_maxSizeForFullText = intval($_POST["maxSizeForFullText"]); $settings->_fullSearchEngine = $_POST["fullSearchEngine"]; $settings->_defaultSearchMethod = $_POST["defaultSearchMethod"]; + $settings->_showSingleSearchHit = $_POST["showSingleSearchHit"]; $settings->_enableClipboard = getBoolValue("enableClipboard"); $settings->_enableDropUpload = getBoolValue("enableDropUpload"); $settings->_enableFolderTree = getBoolValue("enableFolderTree"); diff --git a/out/out.Search.php b/out/out.Search.php index 3bf6bf7d1..24559d48d 100644 --- a/out/out.Search.php +++ b/out/out.Search.php @@ -389,7 +389,7 @@ if(isset($_GET["fullsearch"]) && $_GET["fullsearch"] && $settings->_enableFullSe // -------------- Output results -------------------------------------------- -if(count($entries) == 1) { +if($settings->_showSingleSearchHit && count($entries) == 1) { $entry = $entries[0]; if(get_class($entry) == 'SeedDMS_Core_Document') { header('Location: ../out/out.ViewDocument.php?documentid='.$entry->getID()); diff --git a/views/bootstrap/class.Settings.php b/views/bootstrap/class.Settings.php index 181fc97a5..d680b5ed3 100644 --- a/views/bootstrap/class.Settings.php +++ b/views/bootstrap/class.Settings.php @@ -208,6 +208,10 @@ if(!is_writeable($settings->_configFilePath)) { + "> + : + _showSingleSearchHit) echo "checked" ?> /> + "> : showTextField("stopWordsFile", $settings->_stopWordsFile); ?>