Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2023-04-21 16:53:20 +02:00
commit a1520299a2
8 changed files with 20 additions and 5 deletions

View File

@ -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);

View File

@ -133,6 +133,7 @@ if ($action == "saveSettings")
setIntValue('maxSizeForFullText');
setStrValue('fullSearchEngine');
setStrValue('defaultSearchMethod');
setStrValue('suggestTerms');
setBoolValue("showSingleSearchHit");
setBoolValue("enableSessionList");
setBoolValue("enableClipboard");

View File

@ -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) {

View File

@ -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

View File

@ -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) {

View File

@ -373,6 +373,7 @@ if(($kkk = $this->callHook('getFullSearchEngine')) && is_array($kkk))
<?php $this->showConfigOption('settings_fullSearchEngine', 'fullSearchEngine', $fullsearchengines, false, true); ?>
<?php $this->showConfigOption('settings_defaultSearchMethod', 'defaultSearchMethod', array('database'=>'settings_defaultSearchMethod_valdatabase', 'fulltext'=>'settings_defaultSearchMethod_valfulltext'), false, true); ?>
<?php $this->showConfigCheckbox('settings_showSingleSearchHit', 'showSingleSearchHit'); ?>
<?php $this->showConfigOption('settings_suggestTerms', 'suggestTerms', array('title','comment', 'keywords'), true, true); ?>
<?php $this->showConfigText('settings_stopWordsFile', 'stopWordsFile'); ?>
<?php $this->showConfigCheckbox('settings_enableClipboard', 'enableClipboard'); ?>
<?php $this->showConfigCheckbox('settings_enableMenuTasks', 'enableMenuTasks'); ?>

View File

@ -150,7 +150,7 @@ function initMost() {
else if(item.type.charAt(0) == 'F')
return '<i class="fa fa-folder-o"></i> ' + item.name.replace(/</g, '&lt;') + '<br /><span class="path">' + item.path + '</span>';
else
return '<i class="fa fa-search"></i> ' + item.name.replace(/</g, '&lt;') + (item.occurences > 0 ? ' (' + item.occurences + ')' : '');
return '<i class="fa fa-search"></i> ' + item.name.replace(/</g, '&lt;') + (item.occurences > 0 ? ' (' + item.occurences + ')' : '') + (typeof(item.column) != 'undefined' ? '<br /><span class="path">' + item.column + '</span>' : '');
},
/* This only works with a modified version of bootstrap typeahead located
* in boostrap-typeahead.js Search for 'render'

View File

@ -155,7 +155,7 @@ function initMost() {
else if(item.type.charAt(0) == 'F')
return '<i class="fa fa-folder-o"></i> ' + item.name.replace(/</g, '&lt;') + '<br /><span class="path">' + item.path + '</span>';
else
return '<i class="fa fa-search"></i> ' + item.name.replace(/</g, '&lt;') + (item.occurences > 0 ? ' (' + item.occurences + ')' : '');
return '<i class="fa fa-search"></i> ' + item.name.replace(/</g, '&lt;') + (item.occurences > 0 ? ' (' + item.occurences + ')' : '') + (typeof(item.column) != 'undefined' ? '<br /><span class="path">' + item.column + '</span>' : '');
},
/* This only works with a modified version of bootstrap typeahead located
* in boostrap-typeahead.js Search for 'render'