mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-06-01 14:37:20 +00:00
paging is done by fulltext engine
This commit is contained in:
parent
397d542fb4
commit
0ebd044cac
|
@ -181,8 +181,9 @@ if(isset($_GET["fullsearch"]) && $_GET["fullsearch"] && $settings->_enableFullSe
|
||||||
$startTime = getTime();
|
$startTime = getTime();
|
||||||
$index = $fulltextservice->Indexer();
|
$index = $fulltextservice->Indexer();
|
||||||
if($index) {
|
if($index) {
|
||||||
|
$limit = 20;
|
||||||
$lucenesearch = $fulltextservice->Search();
|
$lucenesearch = $fulltextservice->Search();
|
||||||
$searchresult = $lucenesearch->search($query, array('owner'=>$owner, 'status'=>$status, 'category'=>$categorynames, 'user'=>$user->isAdmin() ? [] : [$user->getLogin()], 'mimetype'=>$mimetype));
|
$searchresult = $lucenesearch->search($query, array('owner'=>$owner, 'status'=>$status, 'category'=>$categorynames, 'user'=>$user->isAdmin() ? [] : [$user->getLogin()], 'mimetype'=>$mimetype), ($pageNumber == 'all' ? array() : array('limit'=>$limit, 'offset'=>$limit * ($pageNumber-1))));
|
||||||
if($searchresult === false) {
|
if($searchresult === false) {
|
||||||
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('splash_invalid_searchterm')));
|
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('splash_invalid_searchterm')));
|
||||||
$dcount = 0;
|
$dcount = 0;
|
||||||
|
@ -207,13 +208,12 @@ if(isset($_GET["fullsearch"]) && $_GET["fullsearch"] && $settings->_enableFullSe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$limit = 20;
|
if($pageNumber != 'all' && $dcount > $limit) {
|
||||||
if($pageNumber != 'all' && count($entries) > $limit) {
|
$totalPages = (int) ($dcount/$limit);
|
||||||
$totalPages = (int) (count($entries)/$limit);
|
if($dcount%$limit)
|
||||||
if(count($entries)%$limit)
|
|
||||||
$totalPages++;
|
$totalPages++;
|
||||||
if($limit > 0)
|
// if($limit > 0)
|
||||||
$entries = array_slice($entries, ($pageNumber-1)*$limit, $limit);
|
// $entries = array_slice($entries, ($pageNumber-1)*$limit, $limit);
|
||||||
} else {
|
} else {
|
||||||
$totalPages = 1;
|
$totalPages = 1;
|
||||||
}
|
}
|
||||||
|
@ -297,13 +297,20 @@ if(isset($_GET["fullsearch"]) && $_GET["fullsearch"] && $settings->_enableFullSe
|
||||||
// Check to see if the search has been restricted to a particular
|
// Check to see if the search has been restricted to a particular
|
||||||
// document owner.
|
// document owner.
|
||||||
$owner = array();
|
$owner = array();
|
||||||
|
$ownerobjs = array();
|
||||||
if (isset($_GET["owner"])) {
|
if (isset($_GET["owner"])) {
|
||||||
if (!is_array($_GET['owner'])) {
|
if (!is_array($_GET['owner'])) {
|
||||||
UI::exitError(getMLText("search"),getMLText("unknown_owner"));
|
if(!empty($_GET['owner']) && $o = $dms->getUserByLogin($_GET['owner'])) {
|
||||||
|
$ownerobjs[] = $o;
|
||||||
|
$owner = $o->getLogin();
|
||||||
|
} else
|
||||||
|
UI::exitError(getMLText("search"),getMLText("unknown_owner"));
|
||||||
} else {
|
} else {
|
||||||
foreach($_GET["owner"] as $l) {
|
foreach($_GET["owner"] as $l) {
|
||||||
if($o = $dms->getUserByLogin($l))
|
if($o = $dms->getUserByLogin($l)) {
|
||||||
$owner[] = $o;
|
$ownerobjs[] = $o;
|
||||||
|
$owner[] = $o->getLogin();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -451,7 +458,7 @@ if(isset($_GET["fullsearch"]) && $_GET["fullsearch"] && $settings->_enableFullSe
|
||||||
'logicalmode'=>$mode,
|
'logicalmode'=>$mode,
|
||||||
'searchin'=>$searchin,
|
'searchin'=>$searchin,
|
||||||
'startFolder'=>$startFolder,
|
'startFolder'=>$startFolder,
|
||||||
'owner'=>$owner,
|
'owner'=>$ownerobjs,
|
||||||
'status'=>$status,
|
'status'=>$status,
|
||||||
'creationstartdate'=>$creationdate ? $startdate : array(),
|
'creationstartdate'=>$creationdate ? $startdate : array(),
|
||||||
'creationenddate'=>$creationdate ? $stopdate : array(),
|
'creationenddate'=>$creationdate ? $stopdate : array(),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user