mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-10-12 06:54:04 +00:00
Configurable Limit in search
This commit is contained in:
@@ -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'] = "
|
||||
|
||||
@@ -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'] = [
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user