Configurable Limit in search

This commit is contained in:
chfhtw
2026-10-01 11:38:24 +02:00
parent 3d8c4fa4d0
commit deca039c35
3 changed files with 10 additions and 2 deletions
+1
View File
@@ -5,6 +5,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
$CI =& get_instance();
$config['LIMIT'] = 100;
$config['employee'] = $CI->config->item('employee', 'search');
$config['employee']['resultjoin'] = "
+1
View File
@@ -5,6 +5,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
$CI =& get_instance();
#$config['LIMIT'] = 1000;
$config['student'] = $CI->config->item('student', 'search');
$config['student']['searchfields']['pkz'] = [
+8 -2
View File
@@ -109,6 +109,9 @@ class SearchLib
$types = $tmp;
}
// LIMIT is never a type it's a reserved config
if(isset($types['LIMIT']))
unset($types['LIMIT']);
// Convert searchstring into array
list($searchArray, $searchstring) = $this->_convertQuery($searchstring, $types);
@@ -272,13 +275,16 @@ class SearchLib
SELECT " . $this->_ci->db->escape(getAuthUID()) . " AS uid
)");
$limit = $this->_ci->config->item('LIMIT', 'search') ?: "";
if ($limit)
$limit = " LIMIT " . $limit;
return success("
WITH " . $recursive . implode(", ", $with) . "
SELECT *
FROM (" . implode(" UNION ", $selects) . ") q
ORDER BY rank DESC
LIMIT 100
");
" . $limit);
}
//------------------------------------------------------------------------------------------------------------------