ILIAS  release_8 Revision v8.23
ilSearchResult Class Reference
+ Collaboration diagram for ilSearchResult:

Public Member Functions

 __construct (int $a_user_id=0)
 Constructor public. More...
 
 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)
 add search result entry Entries are stored with 'obj_id'. More...
 
 numEntries ()
 Check number of entries public. More...
 
 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 ()
 get result ids More...
 
 getResultsByObjId ()
 
 getUniqueResults ()
 Get unique results. More...
 
 getResultsForPresentation ()
 
 getSubitemIds ()
 
 filter (int $a_root_node, bool $check_and, ilDate $creation_filter_date=null, int $creation_filter_operator=null)
 Filter search result. More...
 
 filterResults (int $a_root_node)
 Filter search area of result set public. More...
 
 save (int $a_type=ilUserSearchCache::DEFAULT_SEARCH)
 Save search results. More...
 
 read (int $a_type=ilUserSearchCache::DEFAULT_SEARCH)
 read search results More...
 
 __updateEntryChilds (int $a_obj_id, array $a_childs)
 Update childs for a specific entry. More...
 
 __updateResultChilds (int $a_ref_id, array $a_childs)
 Update child ids 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() 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

 initUserSearchCache ()
 Init user search cache. More...
 

Protected Attributes

ilUserSearchCache $search_cache
 
int $offset = 0
 
ilAccess $ilAccess
 
ilDBInterface $db
 
ilTree $tree
 
ilObjUser $user
 
ilSearchSettings $search_settings
 
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

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

Constructor & Destructor Documentation

◆ __construct()

ilSearchResult::__construct ( int  $a_user_id = 0)

Constructor public.

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

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

65  {
66  global $DIC;
67 
68  $this->logger = $DIC->logger()->src();
69  $this->ilAccess = $DIC->access();
70  $this->db = $DIC->database();
71  $this->tree = $DIC->repositoryTree();
72  $this->user = $DIC->user();
73 
74  if ($a_user_id) {
75  $this->user_id = $a_user_id;
76  } else {
77  $this->user_id = $this->user->getId();
78  }
80  $this->initUserSearchCache();
81  }
initUserSearchCache()
Init user search cache.
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ __initSearchSettingsObject()

ilSearchResult::__initSearchSettingsObject ( )

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

References preventOverwritingMaxhits(), and setMaxHits().

Referenced by __construct().

524  : void
525  {
526  $this->search_settings = new ilSearchSettings();
527  if (!$this->preventOverwritingMaxhits()) {
528  $this->setMaxHits($this->search_settings->getMaxHits());
529  }
530  }
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...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __updateEntryChilds()

ilSearchResult::__updateEntryChilds ( int  $a_obj_id,
array  $a_childs 
)

Update childs for a specific entry.

Parameters
intobject object_id
arrayarray of child ids. E.g 'pg', 'st' private

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

Referenced by diffEntriesFromResult(), intersectEntries(), and mergeEntries().

496  : bool
497  {
498  if ($this->entries[$a_obj_id] and is_array($a_childs)) {
499  foreach ($a_childs as $child_id) {
500  if ($child_id) {
501  $this->entries[$a_obj_id]['child'][$child_id] = $child_id;
502  }
503  }
504  return true;
505  }
506  return false;
507  }
+ Here is the caller graph for this function:

◆ __updateResultChilds()

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

Update child ids for a specific result.

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

Referenced by filter(), and filterResults().

511  : bool
512  {
513  if ($this->results[$a_ref_id] and is_array($a_childs)) {
514  foreach ($a_childs as $child_id) {
515  $this->results[$a_ref_id]['child'][$child_id] = $child_id;
516  }
517  return true;
518  }
519  return false;
520  }
+ Here is the caller graph for this function:

◆ addEntry()

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

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

This method is typically called to store db query results.

Parameters
intobject object_id
stringobj_type 'lm' or 'crs' ...
arrayvalue position of query parser words in query string
intchild id e.g id of page or chapter
Returns
void

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

Referenced by diffEntriesFromResult(), intersectEntries(), and mergeEntries().

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

◆ 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
objectclass of callback function
stringname of callback method

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

570  : bool
571  {
572  $this->observers[] = array('class' => $a_class,
573  'method' => $a_method);
574  return true;
575  }

◆ addResult()

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

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

Referenced by filter(), and filterResults().

243  : void
244  {
245  $this->results[$a_ref_id]['ref_id'] = $a_ref_id;
246  $this->results[$a_ref_id]['obj_id'] = $a_obj_id;
247  $this->results[$a_ref_id]['type'] = $a_type;
248  }
+ Here is the caller graph for this function:

◆ callListeners()

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

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

Referenced by filter().

578  : bool
579  {
580  foreach ($this->observers as $observer) {
581  $class = &$observer['class'];
582  $method = $observer['method'];
583 
584  if (!$class->$method($a_ref_id, $a_data)) {
585  return false;
586  }
587  }
588  return true;
589  }
+ Here is the caller graph for this function:

◆ diffEntriesFromResult()

ilSearchResult::diffEntriesFromResult ( )

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

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

References $ref_id, __updateEntryChilds(), addEntry(), and getEntries().

198  : void
199  {
200  $new_entries = $this->getEntries();
201  $this->entries = array();
202 
203  // Get all checked objects
204  foreach ($this->search_cache->getCheckedItems() as $ref_id => $obj_id) {
205  if (isset($new_entries[$obj_id])) {
206  $this->addEntry(
207  $new_entries[$obj_id]['obj_id'],
208  $new_entries[$obj_id]['type'],
209  $new_entries[$obj_id]['found']
210  );
211  $this->__updateEntryChilds(
212  $new_entries[$obj_id]['obj_id'],
213  $new_entries[$obj_id]['child']
214  );
215  }
216  }
217  }
$ref_id
Definition: ltiauth.php:67
addEntry(int $a_obj_id, string $a_type, array $found, int $a_child_id=0)
add search result entry Entries are stored with 'obj_id'.
__updateEntryChilds(int $a_obj_id, array $a_childs)
Update childs for a specific entry.
+ Here is the call graph for this function:

◆ filter()

ilSearchResult::filter ( int  $a_root_node,
bool  $check_and,
ilDate  $creation_filter_date = null,
int  $creation_filter_operator = null 
)

Filter search result.

Do RBAC checks. Allows paging of results for referenced objects

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

References $ref_id, $type, __updateResultChilds(), ilDateTime\_after(), ilDateTime\_before(), ilDateTime\_equals(), ilObject\_exists(), ilObject\_getAllReferences(), ilObject\_lookupCreationDate(), ilObject\_lookupType(), addResult(), callListeners(), ilObjectSearch\CDATE_OPERATOR_AFTER, ilObjectSearch\CDATE_OPERATOR_BEFORE, ilObjectSearch\CDATE_OPERATOR_ON, getEntries(), getMaxHits(), getRequiredPermission(), IL_CAL_DATE, isOffsetReached(), and ROOT_FOLDER_ID.

330  : bool {
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) && !is_null($creation_filter_operator)) {
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  switch ($creation_filter_operator) {
375  if (ilDate::_before($creation_date, $creation_filter_date)) {
376  continue 2;
377  }
378  break;
379 
381  if (ilDate::_after($creation_date, $creation_filter_date)) {
382  continue 2;
383  }
384  break;
385 
387  if (!ilDate::_equals($creation_date, $creation_filter_date)) {
388  continue 2;
389  }
390  break;
391  }
392  }
393 
394  // Check referenced objects
395  foreach (ilObject::_getAllReferences((int) $entry['obj_id']) as $ref_id) {
396  // Failed check: if ref id check is failed by previous search
397  if ($this->search_cache->isFailed($ref_id)) {
398  continue;
399  }
400  // Offset check
401  if ($this->search_cache->isChecked($ref_id) and !$this->isOffsetReached($offset_counter)) {
402  ++$offset_counter;
403  continue;
404  }
405 
406  if (!$this->callListeners($ref_id, $entry)) {
407  continue;
408  }
409 
410 
411 
412  // RBAC check
413  $type = ilObject::_lookupType($ref_id, true);
414  if ($this->ilAccess->checkAccessOfUser(
415  $this->getUserId(),
416  $this->getRequiredPermission(),
417  '',
418  $ref_id,
419  $type,
420  $entry['obj_id']
421  )) {
422  if ($a_root_node == ROOT_FOLDER_ID or $this->tree->isGrandChild($a_root_node, $ref_id)) {
423  // Call listeners
424  #if($this->callListeners($ref_id,$entry))
425  if (1) {
426  $this->addResult($ref_id, $entry['obj_id'], $type);
427  $this->search_cache->appendToChecked($ref_id, $entry['obj_id']);
428  $this->__updateResultChilds($ref_id, $entry['child']);
429 
430  $counter++;
431  $offset_counter++;
432  // Stop if maximum of hits is reached
433 
434  if ($counter >= $this->getMaxHits()) {
435  $this->limit_reached = true;
436  $this->search_cache->setResults($this->results);
437  return true;
438  }
439  }
440  }
441  continue;
442  }
443  $this->search_cache->appendToFailed($ref_id);
444  }
445  }
446  $this->search_cache->setResults($this->results);
447  return false;
448  }
callListeners(int $a_ref_id, array $a_data)
$type
const ROOT_FOLDER_ID
Definition: constants.php:32
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.
static _getAllReferences(int $id)
get all reference ids for object ID
addResult(int $a_ref_id, int $a_obj_id, string $a_type)
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
$ref_id
Definition: ltiauth.php:67
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.
__updateResultChilds(int $a_ref_id, array $a_childs)
Update child ids for a specific result.
isOffsetReached(int $a_counter)
Check if offset is reached.
const IL_CAL_DATE
static _lookupCreationDate(int $obj_id)
static _equals(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
Check if two date are equal.
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:

◆ filterResults()

ilSearchResult::filterResults ( int  $a_root_node)

Filter search area of result set public.

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

References __updateResultChilds(), addResult(), and getResults().

455  : void
456  {
457  $tmp_results = $this->getResults();
458  $this->results = array();
459  foreach ($tmp_results as $result) {
460  if ($this->tree->isGrandChild($a_root_node, $result['ref_id']) && $this->tree->isInTree($result['ref_id'])) {
461  $this->addResult($result['ref_id'], $result['obj_id'], $result['type']);
462  $this->__updateResultChilds($result['ref_id'], $result['child'] ?? []);
463  }
464  }
465  }
addResult(int $a_ref_id, int $a_obj_id, string $a_type)
__updateResultChilds(int $a_ref_id, array $a_childs)
Update child ids for a specific result.
+ Here is the call graph for this function:

◆ getEntries()

ilSearchResult::getEntries ( )

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

References $entries.

Referenced by diffEntriesFromResult(), filter(), intersectEntries(), mergeEntries(), and numEntries().

106  : array
107  {
108  return $this->entries;
109  }
+ Here is the caller graph for this function:

◆ getMaxHits()

ilSearchResult::getMaxHits ( )

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

References $max_hits.

Referenced by filter(), and initUserSearchCache().

120  : int
121  {
122  return $this->max_hits;
123  }
+ Here is the caller graph for this function:

◆ getRequiredPermission()

ilSearchResult::getRequiredPermission ( )

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

References $permission.

Referenced by filter().

91  : string
92  {
93  return $this->permission;
94  }
+ Here is the caller graph for this function:

◆ getResultIds()

ilSearchResult::getResultIds ( )

get result ids

Returns
int[] result ids

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

References $id, and getResults().

259  : array
260  {
261  $ids = [];
262  foreach ($this->getResults() as $id => $tmp) {
263  $ids[] = $id;
264  }
265  return $ids;
266  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ getResults()

ilSearchResult::getResults ( )

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

References $results.

Referenced by filterResults(), getResultIds(), getResultsByObjId(), getResultsForPresentation(), and getSubitemIds().

250  : array
251  {
252  return $this->results;
253  }
+ Here is the caller graph for this function:

◆ getResultsByObjId()

ilSearchResult::getResultsByObjId ( )

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

References $ref_id, and getResults().

268  : array
269  {
270  $tmp_res = [];
271  foreach ($this->getResults() as $ref_id => $res_data) {
272  $tmp_res[$res_data['obj_id']][] = $ref_id;
273  }
274  return $tmp_res;
275  }
$ref_id
Definition: ltiauth.php:67
+ Here is the call graph for this function:

◆ getResultsForPresentation()

ilSearchResult::getResultsForPresentation ( )

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

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

296  : array
297  {
298  $res = [];
299  foreach ($this->getResults() as $result) {
300  if (!is_array($result)) {
301  continue;
302  }
303 
304  $res[(int) $result['ref_id']] = (int) $result['obj_id'];
305  }
306  return $res;
307  }
$res
Definition: ltiservices.php:69
+ Here is the call graph for this function:

◆ getSubitemIds()

ilSearchResult::getSubitemIds ( )

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

References $res, and getResults().

309  : array
310  {
311  $res = array();
312  foreach ($this->getResults() as $row) {
313  $res[$row['obj_id']] = $row['child'] ?? [];
314  }
315  return $res;
316  }
$res
Definition: ltiservices.php:69
+ Here is the call graph for this function:

◆ 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 282 of file class.ilSearchResult.php.

282  : array
283  {
284  $obj_ids = [];
285  $objects = [];
286  foreach ($this->results as $result) {
287  if (in_array($result['obj_id'], $obj_ids)) {
288  continue;
289  }
290  $obj_ids[] = $result['obj_id'];
291  $objects[] = $result;
292  }
293  return $objects;
294  }

◆ getUserId()

ilSearchResult::getUserId ( )

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

References $user_id.

Referenced by initUserSearchCache().

101  : int
102  {
103  return $this->user_id;
104  }
+ Here is the caller graph for this function:

◆ initUserSearchCache()

ilSearchResult::initUserSearchCache ( )
protected

Init user search cache.

private

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

References ilUserSearchCache\_getInstance(), getMaxHits(), and getUserId().

Referenced by __construct().

538  : void
539  {
540  $this->search_cache = ilUserSearchCache::_getInstance($this->getUserId());
541  $this->offset = $this->getMaxHits() * ($this->search_cache->getResultPageNumber() - 1) ;
542  }
static _getInstance(int $a_usr_id)
+ 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 222 of file class.ilSearchResult.php.

References __updateEntryChilds(), addEntry(), and getEntries().

Referenced by ilAdvancedSearchGUI\__storeEntries().

222  : void
223  {
224  $new_entries = $this->getEntries();
225  $this->entries = [];
226  foreach ($result_obj->getEntries() as $entry) {
227  $obj_id = $entry['obj_id'];
228  if (isset($new_entries[$obj_id])) {
229  $this->addEntry(
230  $new_entries[$obj_id]['obj_id'],
231  $new_entries[$obj_id]['type'],
232  $new_entries[$obj_id]['found']
233  );
234 
235  $this->__updateEntryChilds(
236  $new_entries[$obj_id]['obj_id'],
237  $new_entries[$obj_id]['child']
238  );
239  }
240  }
241  }
addEntry(int $a_obj_id, string $a_type, array $found, int $a_child_id=0)
add search result entry Entries are stored with 'obj_id'.
__updateEntryChilds(int $a_obj_id, array $a_childs)
Update childs for a specific entry.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isLimitReached()

ilSearchResult::isLimitReached ( )

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

References $limit_reached.

111  : bool
112  {
113  return $this->limit_reached;
114  }

◆ isOffsetReached()

ilSearchResult::isOffsetReached ( int  $a_counter)

Check if offset is reached.

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

References $offset.

Referenced by filter().

128  : bool
129  {
130  return !($a_counter < $this->offset);
131  }
+ Here is the caller graph for this function:

◆ mergeEntries()

ilSearchResult::mergeEntries ( ilSearchResult  $result_obj)

merge entries of this instance and another result object

Parameters
objectresult_obj public

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

References __updateEntryChilds(), addEntry(), and getEntries().

Referenced by ilSearchGUI\__performDetailsSearch(), and ilAdvancedSearchGUI\__storeEntries().

186  : void
187  {
188  foreach ($result_obj->getEntries() as $obj_id => $entry) {
189  $this->addEntry($entry['obj_id'], $entry['type'], $entry['found']);
190  $this->__updateEntryChilds($entry['obj_id'], $entry['child']);
191  }
192  }
addEntry(int $a_obj_id, string $a_type, array $found, int $a_child_id=0)
add search result entry Entries are stored with &#39;obj_id&#39;.
__updateEntryChilds(int $a_obj_id, array $a_childs)
Update childs for a specific entry.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ numEntries()

ilSearchResult::numEntries ( )

Check number of entries public.

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

References getEntries().

175  : int
176  {
177  return count($this->getEntries());
178  }
+ Here is the call graph for this function:

◆ preventOverwritingMaxhits()

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

If you call this function and pass "true" the maxhits setting will not be overwritten in __initSearchSettingsObject() 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 551 of file class.ilSearchResult.php.

References $preventOverwritingMaxhits.

Referenced by __initSearchSettingsObject().

552  {
553  if (null === $a_flag) {
555  }
556 
557  $this->preventOverwritingMaxhits = $a_flag;
558 
559  return $this;
560  }
preventOverwritingMaxhits(?bool $a_flag=null)
If you call this function and pass "true" the maxhits setting will not be overwritten in __initSearch...
+ Here is the caller graph for this function:

◆ read()

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

read search results

Parameters
intDEFAULT_SEARCH or ADVANCED_SEARCH public

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

Referenced by ilAdvancedSearchGUI\performAdvMDSearch(), ilAdvancedSearchGUI\performSearch(), ilSearchGUI\performSearch(), ilAdvancedSearchGUI\showSavedAdvMDResults(), ilSearchGUI\showSavedResults(), and ilAdvancedSearchGUI\showSavedResults().

483  : void
484  {
485  $this->results = $this->search_cache->getResults();
486  }
+ Here is the caller graph for this function:

◆ save()

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

Save search results.

Parameters
intDEFAULT_SEARCH or ADVANCED_SEARCH

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

473  : void
474  {
475  $this->search_cache->save();
476  }

◆ setMaxHits()

ilSearchResult::setMaxHits ( int  $a_max_hits)

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

Referenced by __initSearchSettingsObject().

116  : void
117  {
118  $this->max_hits = $a_max_hits;
119  }
+ Here is the caller graph for this function:

◆ setRequiredPermission()

ilSearchResult::setRequiredPermission ( string  $a_permission)

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

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

86  : void
87  {
88  $this->permission = $a_permission;
89  }

◆ setUserId()

ilSearchResult::setUserId ( int  $a_user_id)

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

97  : void
98  {
99  $this->user_id = $a_user_id;
100  }

Field Documentation

◆ $db

ilDBInterface ilSearchResult::$db
protected

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

◆ $entries

array ilSearchResult::$entries = array()
private

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

Referenced by getEntries().

◆ $ilAccess

ilAccess ilSearchResult::$ilAccess
protected

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

◆ $limit_reached

bool ilSearchResult::$limit_reached = false

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

Referenced by isLimitReached().

◆ $logger

ilLogger ilSearchResult::$logger
protected

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

◆ $max_hits

int ilSearchResult::$max_hits = 0
private

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

Referenced by getMaxHits().

◆ $observers

array ilSearchResult::$observers = array()
private

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

◆ $offset

int ilSearchResult::$offset = 0
protected

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

Referenced by isOffsetReached().

◆ $permission

string ilSearchResult::$permission = 'visible'
private

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

Referenced by getRequiredPermission().

◆ $preventOverwritingMaxhits

bool ilSearchResult::$preventOverwritingMaxhits = false
protected

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

Referenced by preventOverwritingMaxhits().

◆ $results

array ilSearchResult::$results = array()
private

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

Referenced by getResults().

◆ $search_cache

ilUserSearchCache ilSearchResult::$search_cache
protected

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

◆ $search_settings

ilSearchSettings ilSearchResult::$search_settings
protected

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

◆ $tree

ilTree ilSearchResult::$tree
protected

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

◆ $user

ilObjUser ilSearchResult::$user
protected

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

◆ $user_id

int ilSearchResult::$user_id
private

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

Referenced by getUserId().


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