Search Auto Completion Application Class.
More...
Search Auto Completion Application Class.
Definition at line 24 of file class.ilSearchAutoComplete.php.
◆ checkObjectPermission()
static ilSearchAutoComplete::checkObjectPermission |
( |
int |
$a_obj_id | ) |
|
|
static |
◆ getList()
static ilSearchAutoComplete::getList |
( |
string |
$a_str | ) |
|
|
static |
Definition at line 67 of file class.ilSearchAutoComplete.php.
References $DIC, $ilDB, checkObjectPermission(), and ilSearchSettings\getInstance().
Referenced by ilSearchGUI\autoComplete(), and ilSearchBaseGUI\autoComplete().
71 $ilDB = $DIC->database();
74 return self::getLuceneList($a_str);
78 $a_str = str_replace(
'"',
"", $a_str);
82 $object_types = array(
'cat',
'dbk',
'crs',
'fold',
'frm',
'grp',
'lm',
'sahs',
'glo',
'mep',
'htlm',
'exc',
'file',
'qpl',
'tst',
'svy',
'spl',
83 'chat',
'webr',
'mcst',
'sess',
'pg',
'st',
'term',
'wiki',
'copa');
85 $set =
$ilDB->query(
"SELECT title, obj_id FROM object_data WHERE " 86 .
$ilDB->like(
'title',
'text', $a_str .
"%") .
" AND " 87 .
$ilDB->in(
'type', $object_types,
false,
'text') .
" ORDER BY title");
88 $max = ($settings->getAutoCompleteLength() > 0)
89 ? $settings->getAutoCompleteLength()
96 while (($rec =
$ilDB->fetchAssoc($set)) && $cnt < $max) {
97 if (strpos($rec[
"title"],
" ") > 0 || strpos($rec[
"title"],
"-") > 0) {
98 $rec[
"title"] =
'"' . $rec[
"title"] .
'"';
100 if (!in_array($rec[
"title"], $list) && !in_array($rec[
"obj_id"], $checked)) {
102 $list[] = $lim . $rec[
"title"];
105 $checked[] = $rec[
"obj_id"];
109 $set =
$ilDB->query(
"SELECT rbac_id,obj_id,obj_type, keyword FROM il_meta_keyword WHERE " 110 .
$ilDB->like(
'keyword',
'text', $a_str .
"%") .
" AND " 111 .
$ilDB->in(
'obj_type', $object_types,
false,
'text') .
" ORDER BY keyword");
112 while (($rec =
$ilDB->fetchAssoc($set)) && $cnt < $max) {
113 if (strpos($rec[
"keyword"],
" ") > 0) {
114 $rec[
"keyword"] =
'"' . $rec[
"keyword"] .
'"';
116 if (!in_array($rec[
"keyword"], $list) && !in_array($rec[
"rbac_id"], $checked)) {
118 $list[] = $lim . $rec[
"keyword"];
122 $checked[] = $rec[
"rbac_id"];
127 foreach ($list as $l) {
129 $result[$i]->value = $l;
133 return json_encode($result, JSON_THROW_ON_ERROR);
static checkObjectPermission(int $a_obj_id)
◆ getLuceneList()
static ilSearchAutoComplete::getLuceneList |
( |
string |
$a_str | ) |
|
|
static |
The documentation for this class was generated from the following file: