diff --git a/inc/inc.ClassSettings.php b/inc/inc.ClassSettings.php index 4efb5f761..1a1a0e1db 100644 --- a/inc/inc.ClassSettings.php +++ b/inc/inc.ClassSettings.php @@ -140,6 +140,8 @@ class Settings { /* {{{ */ var $_fullSearchEngine = 'lucene'; // default search method var $_defaultSearchMethod = 'database'; // or 'fulltext' + // suggest search term + var $_suggestTerms = array(); // or 'all', 'title' // jump straight to the document if it is the only hit of a search var $_showSingleSearchHit = true; // contentOffsetDirTo @@ -581,6 +583,8 @@ class Settings { /* {{{ */ $this->_maxSizeForFullText = intval($tab["maxSizeForFullText"]); $this->_fullSearchEngine = strval($tab["fullSearchEngine"]); $this->_defaultSearchMethod = strval($tab["defaultSearchMethod"]); + if(trim(strval($tab["suggestTerms"]))) + $this->_suggestTerms = explode(',',strval($tab["suggestTerms"])); $this->_showSingleSearchHit = Settings::boolVal($tab["showSingleSearchHit"]); $this->_stopWordsFile = strval($tab["stopWordsFile"]); $this->_sortUsersInList = strval($tab["sortUsersInList"]); @@ -981,6 +985,7 @@ class Settings { /* {{{ */ $this->setXMLAttributValue($node, "maxSizeForFullText", $this->_maxSizeForFullText); $this->setXMLAttributValue($node, "fullSearchEngine", $this->_fullSearchEngine); $this->setXMLAttributValue($node, "defaultSearchMethod", $this->_defaultSearchMethod); + $this->setXMLAttributValue($node, "suggestTerms", implode(',', $this->_suggestTerms)); $this->setXMLAttributValue($node, "showSingleSearchHit", $this->_showSingleSearchHit); $this->setXMLAttributValue($node, "expandFolderTree", $this->_expandFolderTree); $this->setXMLAttributValue($node, "stopWordsFile", $this->_stopWordsFile); diff --git a/op/op.Settings.php b/op/op.Settings.php index 6fb98e6a4..ddca64938 100644 --- a/op/op.Settings.php +++ b/op/op.Settings.php @@ -133,6 +133,7 @@ if ($action == "saveSettings") setIntValue('maxSizeForFullText'); setStrValue('fullSearchEngine'); setStrValue('defaultSearchMethod'); + setStrValue('suggestTerms'); setBoolValue("showSingleSearchHit"); setBoolValue("enableSessionList"); setBoolValue("enableClipboard"); diff --git a/out/out.Search.php b/out/out.Search.php index 5f91c3ebc..bece5aae0 100644 --- a/out/out.Search.php +++ b/out/out.Search.php @@ -196,7 +196,9 @@ if($fullsearch) { $total = 0; $index = $fulltextservice->Indexer(); if($index) { -// $terms = $index->terms($_GET['query']); + if(!empty($settings->_suggestTerms)) { + $terms = $index->terms($_GET['query'], $settings->_suggestTerms); + } $lucenesearch = $fulltextservice->Search(); $searchresult = $lucenesearch->search($query, array('record_type'=>$record_type, 'owner'=>$ownernames, 'status'=>$status, 'category'=>$categorynames, 'user'=>$user->isAdmin() ? [] : [$user->getLogin()], 'mimetype'=>$mimetype, 'startFolder'=>$startFolder, 'rootFolder'=>$rootFolder, 'attributes'=>$attributes), ($pageNumber == 'all' ? array() : array('limit'=>$limit, 'offset'=>$limit * ($pageNumber-1)))); if($searchresult === false) { diff --git a/views/bootstrap/class.DropFolderChooser.php b/views/bootstrap/class.DropFolderChooser.php index 44105f441..4eb91479a 100644 --- a/views/bootstrap/class.DropFolderChooser.php +++ b/views/bootstrap/class.DropFolderChooser.php @@ -117,12 +117,18 @@ $('.folderselect').click(function(ev) { $form = $this->params['form']; $dropfolderdir = $this->params['dropfolderdir']; $cachedir = $this->params['cachedir']; + $conversionmgr = $this->params['conversionmgr']; $previewwidth = $this->params['previewWidthList']; + $previewconverters = $this->params['previewConverters']; $timeout = $this->params['timeout']; $xsendfile = $this->params['xsendfile']; $showfolders = $this->params['showfolders']; $previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile); + if($conversionmgr) + $previewer->setConversionMgr($conversionmgr); + else + $previewer->setConverters($previewconverters); $dir = $dropfolderdir.'/'.$user->getLogin(); /* Check if we are still looking in the configured directory and diff --git a/views/bootstrap/class.Search.php b/views/bootstrap/class.Search.php index 91a525701..532cb4c3c 100644 --- a/views/bootstrap/class.Search.php +++ b/views/bootstrap/class.Search.php @@ -352,7 +352,7 @@ $(document).ready(function() { echo $content; } /* }}} */ -function typeahead() { /* {{{ */ + function typeahead() { /* {{{ */ $dms = $this->params['dms']; $user = $this->params['user']; $query = $this->params['query']; @@ -362,7 +362,7 @@ function typeahead() { /* {{{ */ $recs[] = array('type'=>'S', 'name'=>$query, 'occurences'=>''); if($terms) { foreach($terms as $term) - $recs[] = array('type'=>'S', 'name'=>$term->text, 'occurences'=>$term->_occurrence); + $recs[] = array('type'=>'S', 'name'=>$term->text, 'occurences'=>$term->_occurrence, 'column'=>$term->field); } if($entries) { foreach ($entries as $entry) { diff --git a/views/bootstrap/class.Settings.php b/views/bootstrap/class.Settings.php index 3c52d39e8..2b79f8ddc 100644 --- a/views/bootstrap/class.Settings.php +++ b/views/bootstrap/class.Settings.php @@ -373,6 +373,7 @@ if(($kkk = $this->callHook('getFullSearchEngine')) && is_array($kkk)) showConfigOption('settings_fullSearchEngine', 'fullSearchEngine', $fullsearchengines, false, true); ?> showConfigOption('settings_defaultSearchMethod', 'defaultSearchMethod', array('database'=>'settings_defaultSearchMethod_valdatabase', 'fulltext'=>'settings_defaultSearchMethod_valfulltext'), false, true); ?> showConfigCheckbox('settings_showSingleSearchHit', 'showSingleSearchHit'); ?> +showConfigOption('settings_suggestTerms', 'suggestTerms', array('title','comment', 'keywords'), true, true); ?> showConfigText('settings_stopWordsFile', 'stopWordsFile'); ?> showConfigCheckbox('settings_enableClipboard', 'enableClipboard'); ?> showConfigCheckbox('settings_enableMenuTasks', 'enableMenuTasks'); ?> diff --git a/views/bootstrap/styles/application.js b/views/bootstrap/styles/application.js index 1eb3d2243..cb261a983 100644 --- a/views/bootstrap/styles/application.js +++ b/views/bootstrap/styles/application.js @@ -150,7 +150,7 @@ function initMost() { else if(item.type.charAt(0) == 'F') return ' ' + item.name.replace(/' + item.path + ''; else - return ' ' + item.name.replace(/ 0 ? ' (' + item.occurences + ')' : ''); + return ' ' + item.name.replace(/ 0 ? ' (' + item.occurences + ')' : '') + (typeof(item.column) != 'undefined' ? '
' + item.column + '' : ''); }, /* This only works with a modified version of bootstrap typeahead located * in boostrap-typeahead.js Search for 'render' diff --git a/views/bootstrap4/styles/application.js b/views/bootstrap4/styles/application.js index 419a92731..f72da452d 100644 --- a/views/bootstrap4/styles/application.js +++ b/views/bootstrap4/styles/application.js @@ -155,7 +155,7 @@ function initMost() { else if(item.type.charAt(0) == 'F') return ' ' + item.name.replace(/' + item.path + ''; else - return ' ' + item.name.replace(/ 0 ? ' (' + item.occurences + ')' : ''); + return ' ' + item.name.replace(/ 0 ? ' (' + item.occurences + ')' : '') + (typeof(item.column) != 'undefined' ? '
' + item.column + '' : ''); }, /* This only works with a modified version of bootstrap typeahead located * in boostrap-typeahead.js Search for 'render'