mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-03-12 00:45:34 +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();
|
||||
$index = $fulltextservice->Indexer();
|
||||
if($index) {
|
||||
$limit = 20;
|
||||
$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) {
|
||||
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('splash_invalid_searchterm')));
|
||||
$dcount = 0;
|
||||
|
@ -207,13 +208,12 @@ if(isset($_GET["fullsearch"]) && $_GET["fullsearch"] && $settings->_enableFullSe
|
|||
}
|
||||
}
|
||||
}
|
||||
$limit = 20;
|
||||
if($pageNumber != 'all' && count($entries) > $limit) {
|
||||
$totalPages = (int) (count($entries)/$limit);
|
||||
if(count($entries)%$limit)
|
||||
if($pageNumber != 'all' && $dcount > $limit) {
|
||||
$totalPages = (int) ($dcount/$limit);
|
||||
if($dcount%$limit)
|
||||
$totalPages++;
|
||||
if($limit > 0)
|
||||
$entries = array_slice($entries, ($pageNumber-1)*$limit, $limit);
|
||||
// if($limit > 0)
|
||||
// $entries = array_slice($entries, ($pageNumber-1)*$limit, $limit);
|
||||
} else {
|
||||
$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
|
||||
// document owner.
|
||||
$owner = array();
|
||||
$ownerobjs = array();
|
||||
if (isset($_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 {
|
||||
foreach($_GET["owner"] as $l) {
|
||||
if($o = $dms->getUserByLogin($l))
|
||||
$owner[] = $o;
|
||||
if($o = $dms->getUserByLogin($l)) {
|
||||
$ownerobjs[] = $o;
|
||||
$owner[] = $o->getLogin();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -451,7 +458,7 @@ if(isset($_GET["fullsearch"]) && $_GET["fullsearch"] && $settings->_enableFullSe
|
|||
'logicalmode'=>$mode,
|
||||
'searchin'=>$searchin,
|
||||
'startFolder'=>$startFolder,
|
||||
'owner'=>$owner,
|
||||
'owner'=>$ownerobjs,
|
||||
'status'=>$status,
|
||||
'creationstartdate'=>$creationdate ? $startdate : array(),
|
||||
'creationenddate'=>$creationdate ? $stopdate : array(),
|
||||
|
|
Loading…
Reference in New Issue
Block a user