ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ilSearchResult Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilSearchResult:

Public Member Functions

 __construct (int $a_user_id=0)
 
 setRequiredPermission (string $a_permission)
 Set the required permission for the rbac checks in function 'filter()'. More...
 
 getRequiredPermission ()
 
 setUserId (int $a_user_id)
 
 getUserId ()
 
 getEntries ()
 
 isLimitReached ()
 
 setMaxHits (int $a_max_hits)
 
 getMaxHits ()
 
 isOffsetReached (int $a_counter)
 Check if offset is reached. More...
 
 addEntry (int $a_obj_id, string $a_type, array $found, int $a_child_id=0, string $a_child_type='')
 add search result entry Entries are stored with 'obj_id'. More...
 
 numEntries ()
 
 mergeEntries (ilSearchResult $result_obj)
 merge entries of this instance and another result object More...
 
 diffEntriesFromResult ()
 diff entries of this instance and another result object Used for search in results More...
 
 intersectEntries (ilSearchResult $result_obj)
 Build intersection of entries (all entries that are present in both result sets) More...
 
 addResult (int $a_ref_id, int $a_obj_id, string $a_type)
 
 getResults ()
 
 getResultIds ()
 
 getResultsByObjId ()
 
 getUniqueResults ()
 Get unique results. More...
 
 getResultsForPresentation ()
 
 getSubitemIds ()
 
 filter (int $a_root_node, bool $check_and, ?ilDate $creation_filter_date_start=null, ?ilDate $creation_filter_date_end=null, array $copyright_identifiers=[])
 Filter search result. More...
 
 filterResults (int $a_root_node)
 Filter search area of result set. More...
 
 save (int $a_type=ilUserSearchCache::DEFAULT_SEARCH)
 
 read (int $a_type=ilUserSearchCache::DEFAULT_SEARCH)
 
 __updateEntryChilds (int $a_obj_id, array $a_childs)
 
 __updateResultChilds (int $a_ref_id, array $a_childs)
 Update children for a specific result. More...
 
 __initSearchSettingsObject ()
 
 preventOverwritingMaxhits (?bool $a_flag=null)
 If you call this function and pass "true" the maxhits setting will not be overwritten in __initSearchSettingsObject() @access public. More...
 
 addObserver (object $a_class, string $a_method)
 The observer is used to call functions for filtering result. More...
 
 callListeners (int $a_ref_id, array $a_data)
 

Data Fields

bool $limit_reached = false
 

Protected Member Functions

 findEntriesWithCopyright (string ... $copyright_identifiers)
 
 initUserSearchCache ()
 

Protected Attributes

ilUserSearchCache $search_cache
 
int $offset = 0
 
ilAccess $ilAccess
 
ilDBInterface $db
 
ilTree $tree
 
ilObjUser $user
 
ilSearchSettings $search_settings
 
LOMServices $lom_services
 
bool $preventOverwritingMaxhits = false
 
ilLogger $logger
 

Private Attributes

string $permission = 'visible'
 
int $user_id
 
array $entries = array()
 
array $results = array()
 
array $observers = array()
 
int $max_hits = 0
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning searchResult stores all result of a search query. Offers methods like mergeResults. To merge result sets of different queries.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 28 of file class.ilSearchResult.php.

Constructor & Destructor Documentation

◆ __construct()

ilSearchResult::__construct ( int  $a_user_id = 0)

Definition at line 56 of file class.ilSearchResult.php.

57 {
58 global $DIC;
59
60 $this->logger = $DIC->logger()->src();
61 $this->ilAccess = $DIC->access();
62 $this->db = $DIC->database();
63 $this->tree = $DIC->repositoryTree();
64 $this->user = $DIC->user();
65 $this->lom_services = $DIC->learningObjectMetadata();
66
67 if ($a_user_id) {
68 $this->user_id = $a_user_id;
69 } else {
70 $this->user_id = $this->user->getId();
71 }
73 $this->initUserSearchCache();
74 }
Class ilAccessHandler Checks access for ILIAS objects.
global $DIC
Definition: shib_login.php:26

References $DIC, __initSearchSettingsObject(), initUserSearchCache(), ILIAS\Repository\logger(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ __initSearchSettingsObject()

ilSearchResult::__initSearchSettingsObject ( )

Definition at line 555 of file class.ilSearchResult.php.

555 : void
556 {
557 $this->search_settings = new ilSearchSettings();
558 if (!$this->preventOverwritingMaxhits()) {
559 $this->setMaxHits($this->search_settings->getMaxHits());
560 }
561 }
setMaxHits(int $a_max_hits)
preventOverwritingMaxhits(?bool $a_flag=null)
If you call this function and pass "true" the maxhits setting will not be overwritten in __initSearch...

Referenced by __construct().

+ Here is the caller graph for this function:

◆ __updateEntryChilds()

ilSearchResult::__updateEntryChilds ( int  $a_obj_id,
array  $a_childs 
)
Parameters
int$a_obj_id
array$a_childsarray of children as ['id' => $id, 'type' => $type]. E.g 'pg', 'st'
Returns
bool

Definition at line 528 of file class.ilSearchResult.php.

528 : bool
529 {
530 if ($this->entries[$a_obj_id] and is_array($a_childs)) {
531 foreach ($a_childs as $child_info) {
532 if ($child_info) {
533 $this->entries[$a_obj_id]['child'][$child_info['type'] . '__' . $child_info['id']] = $child_info;
534 }
535 }
536 return true;
537 }
538 return false;
539 }

◆ __updateResultChilds()

ilSearchResult::__updateResultChilds ( int  $a_ref_id,
array  $a_childs 
)

Update children for a specific result.

Definition at line 544 of file class.ilSearchResult.php.

544 : bool
545 {
546 if ($this->results[$a_ref_id] and is_array($a_childs)) {
547 foreach ($a_childs as $child_info) {
548 $this->results[$a_ref_id]['child'][$child_info['type'] . '__' . $child_info['id']] = $child_info;
549 }
550 return true;
551 }
552 return false;
553 }

◆ addEntry()

ilSearchResult::addEntry ( int  $a_obj_id,
string  $a_type,
array  $found,
int  $a_child_id = 0,
string  $a_child_type = '' 
)

add search result entry Entries are stored with 'obj_id'.

This method is typically called to store db query results.

Parameters
int$a_obj_idobject object_id
string$a_typeobj_type 'lm' or 'crs' ...
array$foundvalue position of query parser words in query string
int$a_child_idchild id e.g id of page or chapter
string$a_child_typechild type e.g 'pg' or 'st'
Returns
void

Definition at line 136 of file class.ilSearchResult.php.

142 : void {
143 // Create new entry if it not exists
144 if (!isset($this->entries[$a_obj_id])) {
145 $this->entries[$a_obj_id]['obj_id'] = $a_obj_id;
146 $this->entries[$a_obj_id]['type'] = $a_type;
147 $this->entries[$a_obj_id]['found'] = $found;
148 $this->entries[$a_obj_id]['child'] = [];
149
150 if ($a_child_id and $a_child_id != $a_obj_id) {
151 $this->entries[$a_obj_id]['child'][$a_child_type . '__' . $a_child_id] = [
152 'id' => $a_child_id, 'type' => $a_child_type
153 ];
154 }
155 } else {
156 // replace or add child ('pg','st') id and type
157 if ($a_child_id and $a_child_id != $a_obj_id) {
158 $this->entries[$a_obj_id]['child'][$a_child_type . '__' . $a_child_id] = [
159 'id' => $a_child_id, 'type' => $a_child_type
160 ];
161 }
162 $counter = 0;
163 foreach ($found as $position) {
164 if ($position) {
165 $this->entries[$a_obj_id]['found'][$counter] = $position;
166 }
167 $counter++;
168 }
169 }
170 }
$counter

◆ addObserver()

ilSearchResult::addObserver ( object  $a_class,
string  $a_method 
)

The observer is used to call functions for filtering result.

Every callback function should support the following parameters: array of ids. E.g: ref_id = 5,array(obj_id = 1,type = 'crs'), The function should return true or false.

Parameters
object$a_classclass of callback function
string$a_methodname of callback method

Definition at line 595 of file class.ilSearchResult.php.

595 : bool
596 {
597 $this->observers[] = array('class' => $a_class,
598 'method' => $a_method);
599 return true;
600 }

◆ addResult()

ilSearchResult::addResult ( int  $a_ref_id,
int  $a_obj_id,
string  $a_type 
)

Definition at line 238 of file class.ilSearchResult.php.

238 : void
239 {
240 $this->results[$a_ref_id]['ref_id'] = $a_ref_id;
241 $this->results[$a_ref_id]['obj_id'] = $a_obj_id;
242 $this->results[$a_ref_id]['type'] = $a_type;
243 }

◆ callListeners()

ilSearchResult::callListeners ( int  $a_ref_id,
array  $a_data 
)

Definition at line 603 of file class.ilSearchResult.php.

603 : bool
604 {
605 foreach ($this->observers as $observer) {
606 $class = &$observer['class'];
607 $method = $observer['method'];
608
609 if (!$class->$method($a_ref_id, $a_data)) {
610 return false;
611 }
612 }
613 return true;
614 }

◆ diffEntriesFromResult()

ilSearchResult::diffEntriesFromResult ( )

diff entries of this instance and another result object Used for search in results

Definition at line 193 of file class.ilSearchResult.php.

193 : void
194 {
195 $new_entries = $this->getEntries();
196 $this->entries = array();
197
198 // Get all checked objects
199 foreach ($this->search_cache->getCheckedItems() as $ref_id => $obj_id) {
200 if (isset($new_entries[$obj_id])) {
201 $this->addEntry(
202 $new_entries[$obj_id]['obj_id'],
203 $new_entries[$obj_id]['type'],
204 $new_entries[$obj_id]['found']
205 );
206 $this->__updateEntryChilds(
207 $new_entries[$obj_id]['obj_id'],
208 $new_entries[$obj_id]['child']
209 );
210 }
211 }
212 }
addEntry(int $a_obj_id, string $a_type, array $found, int $a_child_id=0, string $a_child_type='')
add search result entry Entries are stored with 'obj_id'.
__updateEntryChilds(int $a_obj_id, array $a_childs)
$ref_id
Definition: ltiauth.php:66

References $ref_id.

◆ filter()

ilSearchResult::filter ( int  $a_root_node,
bool  $check_and,
?ilDate  $creation_filter_date_start = null,
?ilDate  $creation_filter_date_end = null,
array  $copyright_identifiers = [] 
)

Filter search result.

Do RBAC checks. Allows paging of results for referenced objects

Parameters
string[]$copyright_identifiers

Definition at line 320 of file class.ilSearchResult.php.

326 : bool {
327 // check for copyright of all entries at once
328 if ($copyright_identifiers !== []) {
329 $entries_with_copyright = $this->findEntriesWithCopyright(...$copyright_identifiers);
330 }
331
332 // get ref_ids and check access
333 $counter = 0;
334 $offset_counter = 0;
335 foreach ($this->getEntries() as $entry) {
336 // boolean and failed continue
337 if ($check_and and in_array(0, $entry['found'])) {
338 continue;
339 }
340 // Types like role, rolt, user do not need rbac checks
341 $type = ilObject::_lookupType($entry['obj_id']);
342 if ($type == 'rolt' or $type == 'usr' or $type == 'role') {
343 if ($this->callListeners($entry['obj_id'], $entry)) {
344 $this->addResult($entry['obj_id'], $entry['obj_id'], $type);
345 if (is_array($entry['child'])) {
346 $counter += count($entry['child']);
347 }
348 // Stop if maximum of hits is reached
349 if (++$counter > $this->getMaxHits()) {
350 $this->limit_reached = true;
351 return true;
352 }
353 }
354 continue;
355 }
356
357 /*
358 * (Re-)check creation date, needed for searches on other tables than obj_data (35275)
359 * Before- and after-operators also allow matching datetimes, see ilObjectSearch::performSearch.
360 */
361 if (!is_null($creation_filter_date_start) || !is_null($creation_filter_date_end)) {
362 if (
363 !ilObject::_exists($entry['obj_id']) ||
364 ($creation_date_string = ilObject::_lookupCreationDate($entry['obj_id'])) === ''
365 ) {
366 continue;
367 }
368 $creation_date = new ilDate(
369 date('Y-m-d', strtotime($creation_date_string)),
371 );
372
373 if ($creation_filter_date_start && is_null($creation_filter_date_end)) {
374 if (!ilDate::_after($creation_date, $creation_filter_date_start)) {
375 continue;
376 }
377 } elseif ($creation_filter_date_end && is_null($creation_filter_date_start)) {
378 if (!ilDate::_before($creation_date, $creation_filter_date_end)) {
379 continue;
380 }
381 } elseif (!ilDate::_within($creation_date, $creation_filter_date_start, $creation_filter_date_end)) {
382 continue;
383 }
384 }
385
386 // filter by copyright
387 $filtered_children = $entry['child'];
388 if ($copyright_identifiers !== []) {
389 foreach ($filtered_children as $key => $child) {
390 if (in_array(
391 $entry['obj_id'] . '__' . $child['id'] . '__' . $child['type'],
392 $entries_with_copyright
393 )) {
394 continue;
395 }
396 unset($filtered_children[$key]);
397 }
398 if (
399 empty($filtered_children) &&
400 !in_array(
401 $entry['obj_id'] . '__' . $entry['obj_id'] . '__' . $entry['type'],
402 $entries_with_copyright
403 )
404 ) {
405 continue;
406 }
407
408 }
409
410 // Check referenced objects
411 foreach (ilObject::_getAllReferences((int) $entry['obj_id']) as $ref_id) {
412 // Failed check: if ref id check is failed by previous search
413 if ($this->search_cache->isFailed($ref_id)) {
414 continue;
415 }
416 // Offset check
417 if ($this->search_cache->isChecked($ref_id) and !$this->isOffsetReached($offset_counter)) {
418 ++$offset_counter;
419 continue;
420 }
421
422 if (!$this->callListeners($ref_id, $entry)) {
423 continue;
424 }
425
426
427
428 // RBAC check
429 $type = ilObject::_lookupType($ref_id, true);
430 if ($this->ilAccess->checkAccessOfUser(
431 $this->getUserId(),
432 $this->getRequiredPermission(),
433 '',
434 $ref_id,
435 $type,
436 $entry['obj_id']
437 )) {
438 if ($a_root_node == ROOT_FOLDER_ID or $this->tree->isGrandChild($a_root_node, $ref_id)) {
439 // Call listeners
440 #if($this->callListeners($ref_id,$entry))
441 if (1) {
442 $this->addResult($ref_id, $entry['obj_id'], $type);
443 $this->search_cache->appendToChecked($ref_id, $entry['obj_id']);
444 $this->__updateResultChilds($ref_id, $filtered_children);
445 ilObject::_lookupType($entry['obj_id']);
446 $counter++;
447 $offset_counter++;
448 // Stop if maximum of hits is reached
449
450 if ($counter >= $this->getMaxHits()) {
451 $this->limit_reached = true;
452 $this->search_cache->setResults($this->results);
453 return true;
454 }
455 }
456 }
457 continue;
458 }
459 $this->search_cache->appendToFailed($ref_id);
460 }
461 }
462 $this->search_cache->setResults($this->results);
463 return false;
464 }
const IL_CAL_DATE
checkAccessOfUser(int $a_user_id, string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=0, ?int $a_tree_id=0)
check access for an object (provide $a_type and $a_obj_id if available for better performance)
static _after(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
compare two dates and check start is after end This method does not consider tz offsets.
static _within(ilDateTime $dt, ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
Check whether an date is within a date duration given by start and end.
static _before(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
compare two dates and check start is before end This method does not consider tz offsets.
Class for single dates.
static _lookupType(int $id, bool $reference=false)
static _getAllReferences(int $id)
get all reference ids for object ID
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
static _lookupCreationDate(int $obj_id)
callListeners(int $a_ref_id, array $a_data)
addResult(int $a_ref_id, int $a_obj_id, string $a_type)
findEntriesWithCopyright(string ... $copyright_identifiers)
__updateResultChilds(int $a_ref_id, array $a_childs)
Update children for a specific result.
const ROOT_FOLDER_ID
Definition: constants.php:32

◆ filterResults()

ilSearchResult::filterResults ( int  $a_root_node)

Filter search area of result set.

Definition at line 501 of file class.ilSearchResult.php.

501 : void
502 {
503 $tmp_results = $this->getResults();
504 $this->results = array();
505 foreach ($tmp_results as $result) {
506 if (isset($result['ref_id']) && $this->tree->isGrandChild($a_root_node, $result['ref_id']) && $this->tree->isInTree($result['ref_id'])) {
507 $this->addResult($result['ref_id'], $result['obj_id'], $result['type']);
508 $this->__updateResultChilds($result['ref_id'], $result['child'] ?? []);
509 }
510 }
511 }

◆ findEntriesWithCopyright()

ilSearchResult::findEntriesWithCopyright ( string ...  $copyright_identifiers)
protected
Parameters
string...$copyright_identifiers
Returns
string[] in the format {OBJ_ID}__{SUB_ID}__{TYPE}

Definition at line 470 of file class.ilSearchResult.php.

470 : array
471 {
472 $filters = [];
473 foreach ($this->entries as $entry) {
474 $filters[] = $this->lom_services->search()->getFilter(
475 $entry['obj_id'],
476 0,
477 $entry['type']
478 );
479 foreach ($entry['child'] as $child) {
480 $filters[] = $this->lom_services->search()->getFilter(
481 $entry['obj_id'],
482 $child['id'],
483 $child['type']
484 );
485 }
486 }
487
488 $clause = $this->lom_services->copyrightHelper()->getCopyrightSearchClause(...$copyright_identifiers);
489 $results = $this->lom_services->search()->execute($clause, null, null, ...$filters);
490
491 $ids = [];
492 foreach ($results as $result) {
493 $ids[] = $result->objID() . '__' . $result->subID() . '__' . $result->type();
494 }
495 return $ids;
496 }

References $results.

◆ getEntries()

ilSearchResult::getEntries ( )

Definition at line 98 of file class.ilSearchResult.php.

98 : array
99 {
100 return $this->entries;
101 }

References $entries.

Referenced by intersectEntries(), and mergeEntries().

+ Here is the caller graph for this function:

◆ getMaxHits()

ilSearchResult::getMaxHits ( )

Definition at line 112 of file class.ilSearchResult.php.

112 : int
113 {
114 return $this->max_hits;
115 }

References $max_hits.

◆ getRequiredPermission()

ilSearchResult::getRequiredPermission ( )

Definition at line 84 of file class.ilSearchResult.php.

84 : string
85 {
86 return $this->permission;
87 }

References $permission.

◆ getResultIds()

ilSearchResult::getResultIds ( )
Returns
int[]

Definition at line 253 of file class.ilSearchResult.php.

253 : array
254 {
255 $ids = [];
256 foreach ($this->getResults() as $id => $tmp) {
257 $ids[] = $id;
258 }
259 return $ids;
260 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id.

◆ getResults()

ilSearchResult::getResults ( )

Definition at line 245 of file class.ilSearchResult.php.

245 : array
246 {
247 return $this->results;
248 }

References $results.

◆ getResultsByObjId()

ilSearchResult::getResultsByObjId ( )

Definition at line 262 of file class.ilSearchResult.php.

262 : array
263 {
264 $tmp_res = [];
265 foreach ($this->getResults() as $ref_id => $res_data) {
266 $tmp_res[$res_data['obj_id']][] = $ref_id;
267 }
268 return $tmp_res;
269 }

References $ref_id.

◆ getResultsForPresentation()

ilSearchResult::getResultsForPresentation ( )

Definition at line 289 of file class.ilSearchResult.php.

289 : array
290 {
291 $res = [];
292 foreach ($this->getResults() as $result) {
293 if (!is_array($result)) {
294 continue;
295 }
296
297 $res[(int) $result['ref_id']] = (int) $result['obj_id'];
298 }
299 return $res;
300 }
$res
Definition: ltiservices.php:69

References $res, and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getSubitemIds()

ilSearchResult::getSubitemIds ( )
Returns
list<array{id: int, type: string}>

Definition at line 305 of file class.ilSearchResult.php.

305 : array
306 {
307 $res = array();
308 foreach ($this->getResults() as $row) {
309 $res[$row['obj_id']] = $row['child'] ?? [];
310 }
311 return $res;
312 }

References $res.

◆ getUniqueResults()

ilSearchResult::getUniqueResults ( )

Get unique results.

Return an array of obj_id (No multiple results for references) Results are stored with 'ref_id'. This method is typically called after checking access of entries.

Definition at line 275 of file class.ilSearchResult.php.

275 : array
276 {
277 $obj_ids = [];
278 $objects = [];
279 foreach ($this->results as $result) {
280 if (in_array($result['obj_id'], $obj_ids)) {
281 continue;
282 }
283 $obj_ids[] = $result['obj_id'];
284 $objects[] = $result;
285 }
286 return $objects;
287 }

◆ getUserId()

ilSearchResult::getUserId ( )

Definition at line 93 of file class.ilSearchResult.php.

93 : int
94 {
95 return $this->user_id;
96 }

References $user_id.

◆ initUserSearchCache()

ilSearchResult::initUserSearchCache ( )
protected

Definition at line 563 of file class.ilSearchResult.php.

563 : void
564 {
565 $this->search_cache = ilUserSearchCache::_getInstance($this->getUserId());
566 $this->offset = $this->getMaxHits() * ($this->search_cache->getResultPageNumber() - 1) ;
567 }
static _getInstance(int $a_usr_id)

References ilUserSearchCache\_getInstance().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ intersectEntries()

ilSearchResult::intersectEntries ( ilSearchResult  $result_obj)

Build intersection of entries (all entries that are present in both result sets)

Definition at line 217 of file class.ilSearchResult.php.

217 : void
218 {
219 $new_entries = $this->getEntries();
220 $this->entries = [];
221 foreach ($result_obj->getEntries() as $entry) {
222 $obj_id = $entry['obj_id'];
223 if (isset($new_entries[$obj_id])) {
224 $this->addEntry(
225 $new_entries[$obj_id]['obj_id'],
226 $new_entries[$obj_id]['type'],
227 $new_entries[$obj_id]['found']
228 );
229
230 $this->__updateEntryChilds(
231 $new_entries[$obj_id]['obj_id'],
232 $new_entries[$obj_id]['child']
233 );
234 }
235 }
236 }

References getEntries().

+ Here is the call graph for this function:

◆ isLimitReached()

ilSearchResult::isLimitReached ( )

Definition at line 103 of file class.ilSearchResult.php.

103 : bool
104 {
106 }

References $limit_reached.

◆ isOffsetReached()

ilSearchResult::isOffsetReached ( int  $a_counter)

Check if offset is reached.

Definition at line 120 of file class.ilSearchResult.php.

120 : bool
121 {
122 return !($a_counter < $this->offset);
123 }

References $offset.

◆ mergeEntries()

ilSearchResult::mergeEntries ( ilSearchResult  $result_obj)

merge entries of this instance and another result object

Definition at line 181 of file class.ilSearchResult.php.

181 : void
182 {
183 foreach ($result_obj->getEntries() as $obj_id => $entry) {
184 $this->addEntry($entry['obj_id'], $entry['type'], $entry['found']);
185 $this->__updateEntryChilds($entry['obj_id'], $entry['child']);
186 }
187 }

References getEntries().

Referenced by ILIAS\Search\GUI\Direct\SearcherImpl\searchDetails().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ numEntries()

ilSearchResult::numEntries ( )

Definition at line 172 of file class.ilSearchResult.php.

172 : int
173 {
174 return count($this->getEntries());
175 }

◆ preventOverwritingMaxhits()

ilSearchResult::preventOverwritingMaxhits ( ?bool  $a_flag = null)

If you call this function and pass "true" the maxhits setting will not be overwritten in __initSearchSettingsObject() @access public.

Parameters
bool | null$a_flagtrue or false to set the flag or leave blank to get the status of the flag
Returns
bool|ilSearchResult if called without parameter the status of the flag will be returned, otherwise $this

Definition at line 576 of file class.ilSearchResult.php.

577 {
578 if (null === $a_flag) {
580 }
581
582 $this->preventOverwritingMaxhits = $a_flag;
583
584 return $this;
585 }

◆ read()

ilSearchResult::read ( int  $a_type = ilUserSearchCache::DEFAULT_SEARCH)

Definition at line 518 of file class.ilSearchResult.php.

518 : void
519 {
520 $this->results = $this->search_cache->getResults();
521 }

◆ save()

ilSearchResult::save ( int  $a_type = ilUserSearchCache::DEFAULT_SEARCH)

Definition at line 513 of file class.ilSearchResult.php.

513 : void
514 {
515 $this->search_cache->save();
516 }

◆ setMaxHits()

ilSearchResult::setMaxHits ( int  $a_max_hits)

Definition at line 108 of file class.ilSearchResult.php.

108 : void
109 {
110 $this->max_hits = $a_max_hits;
111 }

◆ setRequiredPermission()

ilSearchResult::setRequiredPermission ( string  $a_permission)

Set the required permission for the rbac checks in function 'filter()'.

Definition at line 79 of file class.ilSearchResult.php.

79 : void
80 {
81 $this->permission = $a_permission;
82 }

◆ setUserId()

ilSearchResult::setUserId ( int  $a_user_id)

Definition at line 89 of file class.ilSearchResult.php.

89 : void
90 {
91 $this->user_id = $a_user_id;
92 }

Field Documentation

◆ $db

ilDBInterface ilSearchResult::$db
protected

Definition at line 43 of file class.ilSearchResult.php.

◆ $entries

array ilSearchResult::$entries = array()
private

Definition at line 33 of file class.ilSearchResult.php.

Referenced by getEntries().

◆ $ilAccess

ilAccess ilSearchResult::$ilAccess
protected

Definition at line 42 of file class.ilSearchResult.php.

◆ $limit_reached

bool ilSearchResult::$limit_reached = false

Definition at line 50 of file class.ilSearchResult.php.

Referenced by isLimitReached().

◆ $logger

ilLogger ilSearchResult::$logger
protected

Definition at line 54 of file class.ilSearchResult.php.

◆ $lom_services

LOMServices ilSearchResult::$lom_services
protected

Definition at line 47 of file class.ilSearchResult.php.

◆ $max_hits

int ilSearchResult::$max_hits = 0
private

Definition at line 36 of file class.ilSearchResult.php.

Referenced by getMaxHits().

◆ $observers

array ilSearchResult::$observers = array()
private

Definition at line 35 of file class.ilSearchResult.php.

◆ $offset

int ilSearchResult::$offset = 0
protected

Definition at line 39 of file class.ilSearchResult.php.

Referenced by isOffsetReached().

◆ $permission

string ilSearchResult::$permission = 'visible'
private

Definition at line 30 of file class.ilSearchResult.php.

Referenced by getRequiredPermission().

◆ $preventOverwritingMaxhits

bool ilSearchResult::$preventOverwritingMaxhits = false
protected

Definition at line 52 of file class.ilSearchResult.php.

◆ $results

array ilSearchResult::$results = array()
private

Definition at line 34 of file class.ilSearchResult.php.

◆ $search_cache

ilUserSearchCache ilSearchResult::$search_cache
protected

Definition at line 38 of file class.ilSearchResult.php.

◆ $search_settings

ilSearchSettings ilSearchResult::$search_settings
protected

Definition at line 46 of file class.ilSearchResult.php.

◆ $tree

ilTree ilSearchResult::$tree
protected

Definition at line 44 of file class.ilSearchResult.php.

◆ $user

ilObjUser ilSearchResult::$user
protected

Definition at line 45 of file class.ilSearchResult.php.

◆ $user_id

int ilSearchResult::$user_id
private

Definition at line 32 of file class.ilSearchResult.php.

Referenced by getUserId().


The documentation for this class was generated from the following file: