19 declare(strict_types=1);
68 $this->
ilias = $DIC[
'ilias'];
69 $this->setting = $DIC->settings();
76 return self::$instance;
78 return self::$instance =
new ilSearchSettings();
88 'crs' => array(
'filter' =>
'type:crs',
'trans' =>
'objs_crs'),
89 'grp' => array(
'filter' =>
'type:grp',
'trans' =>
'objs_grp'),
90 'lms' => array(
'filter' =>
'type:lm OR type:htlm',
'trans' =>
'obj_lrss'),
91 'glo' => array(
'filter' =>
'type:glo',
'trans' =>
'objs_glo'),
92 'mep' => array(
'filter' =>
'type:mep',
'trans' =>
'objs_mep'),
93 'tst' => array(
'filter' =>
'type:tst OR type:svy OR type:qpl OR type:spl',
'trans' =>
'search_tst_svy'),
94 'frm' => array(
'filter' =>
'type:frm',
'trans' =>
'objs_frm'),
95 'exc' => array(
'filter' =>
'type:exc',
'trans' =>
'objs_exc'),
96 'file' => array(
'filter' =>
'type:file',
'trans' =>
'objs_file'),
97 'mcst' => array(
'filter' =>
'type:mcst',
'trans' =>
'objs_mcst'),
98 'wiki' => array(
'filter' =>
'type:wiki',
'trans' =>
'objs_wiki'),
99 'copa' => array(
'filter' =>
'type:copa',
'trans' =>
'objs_copa'),
106 'pdf' => array(
'filter' =>
'mimeType:pdf',
'trans' =>
'search_mime_pdf'),
107 'word' => array(
'filter' =>
'mimeType:word',
'trans' =>
'search_mime_word'),
108 'excel' => array(
'filter' =>
'mimeType:excel',
'trans' =>
'search_mime_excel'),
109 'powerpoint' => array(
'filter' =>
'mimeType:powerpoint',
'trans' =>
'search_mime_powerpoint'),
110 'image' => array(
'filter' =>
'mimeType:image',
'trans' =>
'search_mime_image')
126 foreach (self::getLuceneItemFilterDefinitions() as $obj => $def) {
127 if (isset($filter[$obj]) and $filter[$obj]) {
128 $enabled[$obj] = $def;
143 foreach (self::getLuceneMimeFilterDefinitions() as $mime => $def) {
144 if (isset($filter[$mime]) and $filter[$mime]) {
145 $enabled[$mime] = $def;
153 $this->prefix_wildcard = $a_stat;
168 $ilDB = $DIC->database();
170 static $seas_ref_id = 0;
175 $query =
"SELECT object_reference.ref_id as ref_id FROM object_reference,tree,object_data " .
177 "AND object_data.type = 'seas' " .
178 "AND object_reference.ref_id = tree.child " .
179 "AND object_reference.obj_id = object_data.obj_id";
184 return $seas_ref_id = (
int) $row->ref_id;
193 $this->lucene = $a_status;
202 $this->max_hits = $a_max_hits;
212 $this->default_operator = $a_op;
217 $this->fragmentSize = $a_size;
227 $this->fragmentCount = $a_count;
236 $this->hide_adv_search = $a_status;
254 $this->numSubitems = $a_max;
264 return $this->last_index_date instanceof
ilDateTime ?
265 $this->last_index_date :
271 $this->lucene_item_filter_enabled = $a_status;
287 $this->lucene_item_filter = $a_filter;
292 $this->lucene_offline_filter = $a_stat;
302 $this->lucene_mime_filter = $a_filter;
320 $this->lucene_mime_filter_enabled = $a_stat;
326 $this->last_index_date = $time;
343 $this->user_search = $a_status;
351 $this->show_inactiv_user = $a_visible;
368 $this->show_limited_user = $a_visible;
384 $this->date_filter = $a_filter;
389 $this->setting->set(
'search_max_hits', (
string) $this->
getMaxHits());
390 $this->setting->set(
'search_lucene', (
string) $this->
enabledLucene());
393 $this->setting->set(
'lucene_fragment_size', (
string) $this->
getFragmentSize());
394 $this->setting->set(
'lucene_fragment_count', (
string) $this->
getFragmentCount());
395 $this->setting->set(
'lucene_max_subitems', (
string) $this->
getMaxSubitems());
414 $this->
setMaxHits((
int) $this->setting->get(
'search_max_hits',
'10'));
415 $this->
enableLucene((
bool) $this->setting->get(
'search_lucene',
'0'));
416 $this->
setDefaultOperator((
int) $this->setting->get(
'lucene_default_operator', (
string) self::OPERATOR_AND));
417 $this->
setFragmentSize((
int) $this->setting->get(
'lucene_fragment_size',
"50"));
418 $this->
setFragmentCount((
int) $this->setting->get(
'lucene_fragment_count',
"3"));
419 $this->
setMaxSubitems((
int) $this->setting->get(
'lucene_max_subitems',
"5"));
420 if ($time = $this->setting->get(
'lucene_last_index_time',
'0')) {
426 $this->
setAutoCompleteLength((
int) $this->setting->get(
'auto_complete_length', (
string) $this->getAutoCompleteLength()));
427 $this->
enableLuceneItemFilter((
bool) $this->setting->get(
'lucene_item_filter_enabled', (
string) $this->isLuceneItemFilterEnabled()));
428 $filter = (string) $this->setting->get(
'lucene_item_filter', serialize($this->
getLuceneItemFilter()));
430 $this->
enableLuceneOfflineFilter((
bool) $this->setting->get(
'lucene_offline_filter', (
string) $this->isLuceneOfflineFilterEnabled()));
431 $this->
enableLuceneMimeFilter((
bool) $this->setting->get(
'lucene_mime_filter_enabled', (
string) $this->lucene_item_filter_enabled));
432 $filter = (string) $this->setting->get(
'lucene_mime_filter', serialize($this->
getLuceneMimeFilter()));
435 $this->
enableLuceneUserSearch((
bool) $this->setting->get(
'lucene_user_search', (
string) $this->user_search));
436 $this->
showInactiveUser((
bool) $this->setting->get(
'search_show_inactiv_user', (
string) $this->show_inactiv_user));
437 $this->
showLimitedUser((
bool) $this->setting->get(
'search_show_limited_user', (
string) $this->show_limited_user));
438 $this->
enableDateFilter((
bool) $this->setting->get(
'search_date_filter', (
string) $this->date_filter));
setHideAdvancedSearch(bool $a_status)
isLuceneMimeFilterEnabled()
Check if lucene mime filter is enabled.
setDefaultOperator(int $a_op)
int $auto_complete_length
static getLuceneItemFilterDefinitions()
Get lucene item filter definitions.
static ilSearchSettings $instance
Interface Observer Contains several chained tasks and infos about them.
isInactiveUserVisible()
are inactive user visible in user search
getEnabledLuceneItemFilterDefinitions()
Get lucene item filter definitions.
setLuceneItemFilter(array $a_filter)
ilDateTime $last_index_date
setMaxSubitems(int $a_max)
isLuceneItemFilterEnabled()
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
setLastIndexTime(?ilDateTime $time)
getEnabledLuceneMimeFilterDefinitions()
static getLuceneMimeFilterDefinitions()
setFragmentCount(int $a_count)
array $lucene_mime_filter
setLuceneMimeFilter(array $a_filter)
enablePrefixWildcardQuery(bool $a_stat)
bool $lucene_mime_filter_enabled
enableLuceneUserSearch(bool $a_status)
Enable lucene user search.
static _getSearchSettingRefId()
Read the ref_id of Search Settings object.
setAutoCompleteLength(int $auto_complete_length)
Class ilObjForumAdministration.
array $lucene_item_filter
enableLucene(bool $a_status)
bool $lucene_item_filter_enabled
showLimitedUser(bool $a_visible)
show user with limited access in user search
enableLuceneItemFilter(bool $a_status)
enableLuceneOfflineFilter(bool $a_stat)
setFragmentSize(int $a_size)
isLuceneUserSearchEnabled()
Check if user search is enabled.
enableDateFilter(bool $a_filter)
showInactiveUser(bool $a_visible)
show inactive user in user search
bool $lucene_offline_filter
isLuceneOfflineFilterEnabled()
enableLuceneMimeFilter(bool $a_stat)
setMaxHits(int $a_max_hits)
isPrefixWildcardQueryEnabled()