mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-03-11 16:35:38 +00:00
the limit passed to doSearch applys to the filtered result
previous the limit was applied to search befored filtering the result by access rights. This can easily cause empty result sets if the user has access to few documents. Now the search returns all hits and limit will be applied when the documents are filtered by access rights
This commit is contained in:
parent
fd94361b9a
commit
7a1856bc5d
|
@ -679,20 +679,30 @@ function doSearch() { /* {{{ */
|
|||
$querystr = $app->request()->get('query');
|
||||
$mode = $app->request()->get('mode');
|
||||
if(!$limit = $app->request()->get('limit'))
|
||||
$limit = 50;
|
||||
$limit = 8;
|
||||
$resArr = $dms->search($querystr, $limit);
|
||||
$entries = array();
|
||||
$count = 0;
|
||||
if($resArr['folders']) {
|
||||
foreach ($resArr['folders'] as $entry) {
|
||||
if ($entry->getAccessMode($userobj) >= M_READ) {
|
||||
$entries[] = $entry;
|
||||
if($count < $limit)
|
||||
$count++;
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$count = 0;
|
||||
if($resArr['docs']) {
|
||||
foreach ($resArr['docs'] as $entry) {
|
||||
if ($entry->getAccessMode($userobj) >= M_READ) {
|
||||
$entries[] = $entry;
|
||||
if($count < $limit)
|
||||
$count++;
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user