ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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_start=null, ilDate $creation_filter_date_end=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 30 of file class.ilSearchResult.php.

Constructor & Destructor Documentation

◆ __construct()

ilSearchResult::__construct ( int  $a_user_id = 0)

Constructor public.

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

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

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

Member Function Documentation

◆ __initSearchSettingsObject()

ilSearchResult::__initSearchSettingsObject ( )

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

References preventOverwritingMaxhits(), and setMaxHits().

Referenced by __construct().

516  : void
517  {
518  $this->search_settings = new ilSearchSettings();
519  if (!$this->preventOverwritingMaxhits()) {
520  $this->setMaxHits($this->search_settings->getMaxHits());
521  }
522  }
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 488 of file class.ilSearchResult.php.

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

488  : bool
489  {
490  if ($this->entries[$a_obj_id] and is_array($a_childs)) {
491  foreach ($a_childs as $child_id) {
492  if ($child_id) {
493  $this->entries[$a_obj_id]['child'][$child_id] = $child_id;
494  }
495  }
496  return true;
497  }
498  return false;
499  }
+ 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 503 of file class.ilSearchResult.php.

Referenced by filter(), and filterResults().

503  : bool
504  {
505  if ($this->results[$a_ref_id] and is_array($a_childs)) {
506  foreach ($a_childs as $child_id) {
507  $this->results[$a_ref_id]['child'][$child_id] = $child_id;
508  }
509  return true;
510  }
511  return false;
512  }
+ 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 142 of file class.ilSearchResult.php.

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

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

562  : bool
563  {
564  $this->observers[] = array('class' => $a_class,
565  'method' => $a_method);
566  return true;
567  }

◆ addResult()

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

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

Referenced by filter(), and filterResults().

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

◆ callListeners()

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

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

Referenced by filter().

570  : bool
571  {
572  foreach ($this->observers as $observer) {
573  $class = &$observer['class'];
574  $method = $observer['method'];
575 
576  if (!$class->$method($a_ref_id, $a_data)) {
577  return false;
578  }
579  }
580  return true;
581  }
+ 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 197 of file class.ilSearchResult.php.

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

197  : void
198  {
199  $new_entries = $this->getEntries();
200  $this->entries = array();
201 
202  // Get all checked objects
203  foreach ($this->search_cache->getCheckedItems() as $ref_id => $obj_id) {
204  if (isset($new_entries[$obj_id])) {
205  $this->addEntry(
206  $new_entries[$obj_id]['obj_id'],
207  $new_entries[$obj_id]['type'],
208  $new_entries[$obj_id]['found']
209  );
210  $this->__updateEntryChilds(
211  $new_entries[$obj_id]['obj_id'],
212  $new_entries[$obj_id]['child']
213  );
214  }
215  }
216  }
$ref_id
Definition: ltiauth.php:66
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_start = null,
ilDate  $creation_filter_date_end = null 
)

Filter search result.

Do RBAC checks. Allows paging of results for referenced objects

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

References $ref_id, __updateResultChilds(), ilDateTime\_after(), ilDateTime\_before(), ilObject\_exists(), ilObject\_getAllReferences(), ilObject\_lookupCreationDate(), ilObject\_lookupType(), ilDateTime\_within(), addResult(), callListeners(), getEntries(), getMaxHits(), getRequiredPermission(), IL_CAL_DATE, isOffsetReached(), and ROOT_FOLDER_ID.

329  : bool {
330  // get ref_ids and check access
331  $counter = 0;
332  $offset_counter = 0;
333  foreach ($this->getEntries() as $entry) {
334  // boolean and failed continue
335  if ($check_and and in_array(0, $entry['found'])) {
336  continue;
337  }
338  // Types like role, rolt, user do not need rbac checks
339  $type = ilObject::_lookupType($entry['obj_id']);
340  if ($type == 'rolt' or $type == 'usr' or $type == 'role') {
341  if ($this->callListeners($entry['obj_id'], $entry)) {
342  $this->addResult($entry['obj_id'], $entry['obj_id'], $type);
343  if (is_array($entry['child'])) {
344  $counter += count($entry['child']);
345  }
346  // Stop if maximum of hits is reached
347  if (++$counter > $this->getMaxHits()) {
348  $this->limit_reached = true;
349  return true;
350  }
351  }
352  continue;
353  }
354 
355  /*
356  * (Re-)check creation date, needed for searches on other tables than obj_data (35275)
357  * Before- and after-operators also allow matching datetimes, see ilObjectSearch::performSearch.
358  */
359  if (!is_null($creation_filter_date_start) || !is_null($creation_filter_date_end)) {
360  if (
361  !ilObject::_exists($entry['obj_id']) ||
362  ($creation_date_string = ilObject::_lookupCreationDate($entry['obj_id'])) === ''
363  ) {
364  continue;
365  }
366  $creation_date = new ilDate(
367  date('Y-m-d', strtotime($creation_date_string)),
369  );
370 
371  if ($creation_filter_date_start && is_null($creation_filter_date_end)) {
372  if (!ilDate::_after($creation_date, $creation_filter_date_start)) {
373  continue;
374  }
375  } elseif ($creation_filter_date_end && is_null($creation_filter_date_start)) {
376  if (!ilDate::_before($creation_date, $creation_filter_date_end)) {
377  continue;
378  }
379  } else {
380  if (!ilDate::_within($creation_date, $creation_filter_date_start, $creation_filter_date_end)) {
381  continue;
382  }
383  }
384  }
385 
386  // Check referenced objects
387  foreach (ilObject::_getAllReferences((int) $entry['obj_id']) as $ref_id) {
388  // Failed check: if ref id check is failed by previous search
389  if ($this->search_cache->isFailed($ref_id)) {
390  continue;
391  }
392  // Offset check
393  if ($this->search_cache->isChecked($ref_id) and !$this->isOffsetReached($offset_counter)) {
394  ++$offset_counter;
395  continue;
396  }
397 
398  if (!$this->callListeners($ref_id, $entry)) {
399  continue;
400  }
401 
402 
403 
404  // RBAC check
405  $type = ilObject::_lookupType($ref_id, true);
406  if ($this->ilAccess->checkAccessOfUser(
407  $this->getUserId(),
408  $this->getRequiredPermission(),
409  '',
410  $ref_id,
411  $type,
412  $entry['obj_id']
413  )) {
414  if ($a_root_node == ROOT_FOLDER_ID or $this->tree->isGrandChild($a_root_node, $ref_id)) {
415  // Call listeners
416  #if($this->callListeners($ref_id,$entry))
417  if (1) {
418  $this->addResult($ref_id, $entry['obj_id'], $type);
419  $this->search_cache->appendToChecked($ref_id, $entry['obj_id']);
420  $this->__updateResultChilds($ref_id, $entry['child']);
421 
422  $counter++;
423  $offset_counter++;
424  // Stop if maximum of hits is reached
425 
426  if ($counter >= $this->getMaxHits()) {
427  $this->limit_reached = true;
428  $this->search_cache->setResults($this->results);
429  return true;
430  }
431  }
432  }
433  continue;
434  }
435  $this->search_cache->appendToFailed($ref_id);
436  }
437  }
438  $this->search_cache->setResults($this->results);
439  return false;
440  }
callListeners(int $a_ref_id, array $a_data)
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:66
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 _lookupType(int $id, bool $reference=false)
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.
+ 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 447 of file class.ilSearchResult.php.

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

447  : void
448  {
449  $tmp_results = $this->getResults();
450  $this->results = array();
451  foreach ($tmp_results as $result) {
452  if (isset($result['ref_id']) && $this->tree->isGrandChild($a_root_node, $result['ref_id']) && $this->tree->isInTree($result['ref_id'])) {
453  $this->addResult($result['ref_id'], $result['obj_id'], $result['type']);
454  $this->__updateResultChilds($result['ref_id'], $result['child'] ?? []);
455  }
456  }
457  }
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 105 of file class.ilSearchResult.php.

References $entries.

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

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

◆ getMaxHits()

ilSearchResult::getMaxHits ( )

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

References $max_hits.

Referenced by filter(), and initUserSearchCache().

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

◆ getRequiredPermission()

ilSearchResult::getRequiredPermission ( )

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

References $permission.

Referenced by filter().

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

◆ getResultIds()

ilSearchResult::getResultIds ( )

get result ids

Returns
int[] result ids

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

References $id, and getResults().

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

◆ getResults()

ilSearchResult::getResults ( )

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

References $results.

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

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

◆ getResultsByObjId()

ilSearchResult::getResultsByObjId ( )

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

References $ref_id, and getResults().

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

◆ getResultsForPresentation()

ilSearchResult::getResultsForPresentation ( )

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

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

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

◆ getSubitemIds()

ilSearchResult::getSubitemIds ( )

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

References $res, and getResults().

308  : array
309  {
310  $res = array();
311  foreach ($this->getResults() as $row) {
312  $res[$row['obj_id']] = $row['child'] ?? [];
313  }
314  return $res;
315  }
$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 281 of file class.ilSearchResult.php.

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

◆ getUserId()

ilSearchResult::getUserId ( )

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

References $user_id.

Referenced by initUserSearchCache().

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

◆ initUserSearchCache()

ilSearchResult::initUserSearchCache ( )
protected

Init user search cache.

private

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

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

Referenced by __construct().

530  : void
531  {
532  $this->search_cache = ilUserSearchCache::_getInstance($this->getUserId());
533  $this->offset = $this->getMaxHits() * ($this->search_cache->getResultPageNumber() - 1) ;
534  }
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 221 of file class.ilSearchResult.php.

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

Referenced by ilAdvancedSearchGUI\__storeEntries().

221  : void
222  {
223  $new_entries = $this->getEntries();
224  $this->entries = [];
225  foreach ($result_obj->getEntries() as $entry) {
226  $obj_id = $entry['obj_id'];
227  if (isset($new_entries[$obj_id])) {
228  $this->addEntry(
229  $new_entries[$obj_id]['obj_id'],
230  $new_entries[$obj_id]['type'],
231  $new_entries[$obj_id]['found']
232  );
233 
234  $this->__updateEntryChilds(
235  $new_entries[$obj_id]['obj_id'],
236  $new_entries[$obj_id]['child']
237  );
238  }
239  }
240  }
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 110 of file class.ilSearchResult.php.

References $limit_reached.

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

◆ isOffsetReached()

ilSearchResult::isOffsetReached ( int  $a_counter)

Check if offset is reached.

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

References $offset.

Referenced by filter().

127  : bool
128  {
129  return !($a_counter < $this->offset);
130  }
+ 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 185 of file class.ilSearchResult.php.

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

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

185  : void
186  {
187  foreach ($result_obj->getEntries() as $obj_id => $entry) {
188  $this->addEntry($entry['obj_id'], $entry['type'], $entry['found']);
189  $this->__updateEntryChilds($entry['obj_id'], $entry['child']);
190  }
191  }
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 174 of file class.ilSearchResult.php.

References getEntries().

174  : int
175  {
176  return count($this->getEntries());
177  }
+ 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 543 of file class.ilSearchResult.php.

References $preventOverwritingMaxhits.

Referenced by __initSearchSettingsObject().

544  {
545  if (null === $a_flag) {
547  }
548 
549  $this->preventOverwritingMaxhits = $a_flag;
550 
551  return $this;
552  }
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 475 of file class.ilSearchResult.php.

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

475  : void
476  {
477  $this->results = $this->search_cache->getResults();
478  }
+ 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 465 of file class.ilSearchResult.php.

465  : void
466  {
467  $this->search_cache->save();
468  }

◆ setMaxHits()

ilSearchResult::setMaxHits ( int  $a_max_hits)

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

Referenced by __initSearchSettingsObject().

115  : void
116  {
117  $this->max_hits = $a_max_hits;
118  }
+ 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 85 of file class.ilSearchResult.php.

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

◆ setUserId()

ilSearchResult::setUserId ( int  $a_user_id)

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

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

Field Documentation

◆ $db

ilDBInterface ilSearchResult::$db
protected

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

◆ $entries

array ilSearchResult::$entries = array()
private

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

Referenced by getEntries().

◆ $ilAccess

ilAccess ilSearchResult::$ilAccess
protected

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

◆ $limit_reached

bool ilSearchResult::$limit_reached = false

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

Referenced by isLimitReached().

◆ $logger

ilLogger ilSearchResult::$logger
protected

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

◆ $max_hits

int ilSearchResult::$max_hits = 0
private

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

Referenced by getMaxHits().

◆ $observers

array ilSearchResult::$observers = array()
private

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

◆ $offset

int ilSearchResult::$offset = 0
protected

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

Referenced by isOffsetReached().

◆ $permission

string ilSearchResult::$permission = 'visible'
private

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

Referenced by getRequiredPermission().

◆ $preventOverwritingMaxhits

bool ilSearchResult::$preventOverwritingMaxhits = false
protected

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

Referenced by preventOverwritingMaxhits().

◆ $results

array ilSearchResult::$results = array()
private

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

Referenced by getResults().

◆ $search_cache

ilUserSearchCache ilSearchResult::$search_cache
protected

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

◆ $search_settings

ilSearchSettings ilSearchResult::$search_settings
protected

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

◆ $tree

ilTree ilSearchResult::$tree
protected

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

◆ $user

ilObjUser ilSearchResult::$user
protected

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

◆ $user_id

int ilSearchResult::$user_id
private

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

Referenced by getUserId().


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