fix checking if search result came from database or fulltext

This commit is contained in:
Uwe Steinmann 2020-12-14 10:46:05 +01:00
parent e69f7125bc
commit 31e45022f1
2 changed files with 7 additions and 2 deletions

View File

@ -60,7 +60,7 @@ if (isset($_GET["navBar"])) {
$accessop = new SeedDMS_AccessOperation($dms, null, $user, $settings);
if((!empty($_GET["fullsearch"]) || $settings->_defaultSearchMethod == 'fulltext') && $settings->_enableFullSearch) {
if(((!isset($_GET["fullsearch"]) && $settings->_defaultSearchMethod == 'fulltext') || !empty($_GET["fullsearch"])) && $settings->_enableFullSearch) {
// Search in Fulltext {{{
if (isset($_GET["query"]) && is_string($_GET["query"])) {
$query = $_GET["query"];
@ -188,6 +188,7 @@ if((!empty($_GET["fullsearch"]) || $settings->_defaultSearchMethod == 'fulltext'
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('splash_invalid_searchterm')));
$dcount = 0;
$fcount = 0;
$total = 0;
$totalPages = 0;
$entries = array();
$facets = array();
@ -227,6 +228,7 @@ if((!empty($_GET["fullsearch"]) || $settings->_defaultSearchMethod == 'fulltext'
$totalPages = 1;
}
}
$total = $searchresult['total'];
$searchTime = getTime() - $startTime;
$searchTime = round($searchTime, 2);
} else {
@ -480,6 +482,7 @@ if((!empty($_GET["fullsearch"]) || $settings->_defaultSearchMethod == 'fulltext'
'expirationenddate'=>$expirationdate ? $expstopdate : array(),
'orderby'=>$orderby
));
$total = $resArr['totalDocs'] + $res['totalFolders'];
$searchTime = getTime() - $startTime;
$searchTime = round($searchTime, 2);
@ -535,9 +538,10 @@ if($settings->_showSingleSearchHit && count($entries) == 1) {
$view->setParam('showtree', showtree());
$view->setParam('enableRecursiveCount', $settings->_enableRecursiveCount);
$view->setParam('maxRecursiveCount', $settings->_maxRecursiveCount);
$view->setParam('total', $total);
$view->setParam('totaldocs', $dcount /*resArr['totalDocs']*/);
$view->setParam('totalfolders', $fcount /*resArr['totalFolders']*/);
$view->setParam('fullsearch', ((!empty($_GET["fullsearch"]) || $settings->_defaultSearchMethod == 'fulltext') && $settings->_enableFullSearch) ? true : false);
$view->setParam('fullsearch', (!empty($_GET["fullsearch"]) && $settings->_enableFullSearch) ? true : false);
$view->setParam('mode', isset($mode) ? $mode : '');
$view->setParam('orderby', isset($orderby) ? $orderby : '');
$view->setParam('defaultsearchmethod', !empty($_GET["fullsearch"]) || $settings->_defaultSearchMethod);

View File

@ -182,6 +182,7 @@ function typeahead() { /* {{{ */
<div class="tab-content">
<div class="tab-pane <?php echo ($fullsearch == false) ? 'active' : ''; ?>" id="database">
<form action="../out/out.Search.php" name="form1">
<input type="hidden" name="fullsearch" value="0" />
<?php
// Database search Form {{{
$this->contentContainerStart();