add showSingleSearchHit config option

This commit is contained in:
Uwe Steinmann 2016-10-04 16:54:16 +02:00
parent 074bc975f0
commit 9fa5ececb7
4 changed files with 10 additions and 1 deletions

View File

@ -97,6 +97,8 @@ class Settings { /* {{{ */
var $_fullSearchEngine = 'lucene'; var $_fullSearchEngine = 'lucene';
// default search method // default search method
var $_defaultSearchMethod = 'database'; // or 'fulltext' var $_defaultSearchMethod = 'database'; // or 'fulltext'
// jump straight to the document if it is the only hit of a search
var $_showSingleSearchHit = true;
// contentOffsetDirTo // contentOffsetDirTo
var $_contentOffsetDir = "1048576"; var $_contentOffsetDir = "1048576";
// Maximum number of sub-directories per parent directory // Maximum number of sub-directories per parent directory
@ -397,6 +399,7 @@ class Settings { /* {{{ */
$this->_maxSizeForFullText = intval($tab["maxSizeForFullText"]); $this->_maxSizeForFullText = intval($tab["maxSizeForFullText"]);
$this->_fullSearchEngine = strval($tab["fullSearchEngine"]); $this->_fullSearchEngine = strval($tab["fullSearchEngine"]);
$this->_defaultSearchMethod = strval($tab["defaultSearchMethod"]); $this->_defaultSearchMethod = strval($tab["defaultSearchMethod"]);
$this->_showSingleSearchHit = Settings::boolVal($tab["showSingleSearchHit"]);
$this->_stopWordsFile = strval($tab["stopWordsFile"]); $this->_stopWordsFile = strval($tab["stopWordsFile"]);
$this->_sortUsersInList = strval($tab["sortUsersInList"]); $this->_sortUsersInList = strval($tab["sortUsersInList"]);
$this->_sortFoldersDefault = strval($tab["sortFoldersDefault"]); $this->_sortFoldersDefault = strval($tab["sortFoldersDefault"]);
@ -678,6 +681,7 @@ class Settings { /* {{{ */
$this->setXMLAttributValue($node, "maxSizeForFullText", $this->_maxSizeForFullText); $this->setXMLAttributValue($node, "maxSizeForFullText", $this->_maxSizeForFullText);
$this->setXMLAttributValue($node, "fullSearchEngine", $this->_fullSearchEngine); $this->setXMLAttributValue($node, "fullSearchEngine", $this->_fullSearchEngine);
$this->setXMLAttributValue($node, "defaultSearchMethod", $this->_defaultSearchMethod); $this->setXMLAttributValue($node, "defaultSearchMethod", $this->_defaultSearchMethod);
$this->setXMLAttributValue($node, "showSingleSearchHit", $this->_showSingleSearchHit);
$this->setXMLAttributValue($node, "expandFolderTree", $this->_expandFolderTree); $this->setXMLAttributValue($node, "expandFolderTree", $this->_expandFolderTree);
$this->setXMLAttributValue($node, "stopWordsFile", $this->_stopWordsFile); $this->setXMLAttributValue($node, "stopWordsFile", $this->_stopWordsFile);
$this->setXMLAttributValue($node, "sortUsersInList", $this->_sortUsersInList); $this->setXMLAttributValue($node, "sortUsersInList", $this->_sortUsersInList);

View File

@ -72,6 +72,7 @@ if ($action == "saveSettings")
$settings->_maxSizeForFullText = intval($_POST["maxSizeForFullText"]); $settings->_maxSizeForFullText = intval($_POST["maxSizeForFullText"]);
$settings->_fullSearchEngine = $_POST["fullSearchEngine"]; $settings->_fullSearchEngine = $_POST["fullSearchEngine"];
$settings->_defaultSearchMethod = $_POST["defaultSearchMethod"]; $settings->_defaultSearchMethod = $_POST["defaultSearchMethod"];
$settings->_showSingleSearchHit = $_POST["showSingleSearchHit"];
$settings->_enableClipboard = getBoolValue("enableClipboard"); $settings->_enableClipboard = getBoolValue("enableClipboard");
$settings->_enableDropUpload = getBoolValue("enableDropUpload"); $settings->_enableDropUpload = getBoolValue("enableDropUpload");
$settings->_enableFolderTree = getBoolValue("enableFolderTree"); $settings->_enableFolderTree = getBoolValue("enableFolderTree");

View File

@ -389,7 +389,7 @@ if(isset($_GET["fullsearch"]) && $_GET["fullsearch"] && $settings->_enableFullSe
// -------------- Output results -------------------------------------------- // -------------- Output results --------------------------------------------
if(count($entries) == 1) { if($settings->_showSingleSearchHit && count($entries) == 1) {
$entry = $entries[0]; $entry = $entries[0];
if(get_class($entry) == 'SeedDMS_Core_Document') { if(get_class($entry) == 'SeedDMS_Core_Document') {
header('Location: ../out/out.ViewDocument.php?documentid='.$entry->getID()); header('Location: ../out/out.ViewDocument.php?documentid='.$entry->getID());

View File

@ -208,6 +208,10 @@ if(!is_writeable($settings->_configFilePath)) {
</select> </select>
</td> </td>
</tr> </tr>
<tr title="<?php printMLText("settings_showSingleSearchHit_desc");?>">
<td><?php printMLText("settings_showSingleSearchHit");?>:</td>
<td><input name="showSingleSearchHit" type="checkbox" <?php if ($settings->_showSingleSearchHit) echo "checked" ?> /></td>
</tr>
<tr title="<?php printMLText("settings_stopWordsFile_desc");?>"> <tr title="<?php printMLText("settings_stopWordsFile_desc");?>">
<td><?php printMLText("settings_stopWordsFile");?>:</td> <td><?php printMLText("settings_stopWordsFile");?>:</td>
<td><?php $this->showTextField("stopWordsFile", $settings->_stopWordsFile); ?></td> <td><?php $this->showTextField("stopWordsFile", $settings->_stopWordsFile); ?></td>