ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
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)
 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)
 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 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 ()
 

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

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

Constructor & Destructor Documentation

◆ __construct()

ilSearchResult::__construct ( int  $a_user_id = 0)

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

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

54  {
55  global $DIC;
56 
57  $this->logger = $DIC->logger()->src();
58  $this->ilAccess = $DIC->access();
59  $this->db = $DIC->database();
60  $this->tree = $DIC->repositoryTree();
61  $this->user = $DIC->user();
62 
63  if ($a_user_id) {
64  $this->user_id = $a_user_id;
65  } else {
66  $this->user_id = $this->user->getId();
67  }
69  $this->initUserSearchCache();
70  }
global $DIC
Definition: shib_login.php:26
+ Here is the call graph for this function:

Member Function Documentation

◆ __initSearchSettingsObject()

ilSearchResult::__initSearchSettingsObject ( )

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

References preventOverwritingMaxhits(), and setMaxHits().

Referenced by __construct().

475  : void
476  {
477  $this->search_settings = new ilSearchSettings();
478  if (!$this->preventOverwritingMaxhits()) {
479  $this->setMaxHits($this->search_settings->getMaxHits());
480  }
481  }
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 
)
Parameters
int$a_obj_id
array$a_childsarray of child ids. E.g 'pg', 'st'
Returns
bool

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

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

448  : bool
449  {
450  if ($this->entries[$a_obj_id] and is_array($a_childs)) {
451  foreach ($a_childs as $child_id) {
452  if ($child_id) {
453  $this->entries[$a_obj_id]['child'][$child_id] = $child_id;
454  }
455  }
456  return true;
457  }
458  return false;
459  }
+ 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 464 of file class.ilSearchResult.php.

Referenced by filter(), and filterResults().

464  : bool
465  {
466  if ($this->results[$a_ref_id] and is_array($a_childs)) {
467  foreach ($a_childs as $child_id) {
468  $this->results[$a_ref_id]['child'][$child_id] = $child_id;
469  }
470  return true;
471  }
472  return false;
473  }
+ 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
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
Returns
void

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

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

131  : void
132  {
133  // Create new entry if it not exists
134  if (!isset($this->entries[$a_obj_id])) {
135  $this->entries[$a_obj_id]['obj_id'] = $a_obj_id;
136  $this->entries[$a_obj_id]['type'] = $a_type;
137  $this->entries[$a_obj_id]['found'] = $found;
138  $this->entries[$a_obj_id]['child'] = [];
139 
140  if ($a_child_id and $a_child_id != $a_obj_id) {
141  $this->entries[$a_obj_id]['child'][$a_child_id] = $a_child_id;
142  }
143  } else {
144  // replace or add child ('pg','st') id
145  if ($a_child_id and $a_child_id != $a_obj_id) {
146  $this->entries[$a_obj_id]['child'][$a_child_id] = $a_child_id;
147  }
148  $counter = 0;
149  foreach ($found as $position) {
150  if ($position) {
151  $this->entries[$a_obj_id]['found'][$counter] = $position;
152  }
153  $counter++;
154  }
155  }
156  }
+ 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
object$a_classclass of callback function
string$a_methodname of callback method

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

515  : bool
516  {
517  $this->observers[] = array('class' => $a_class,
518  'method' => $a_method);
519  return true;
520  }

◆ addResult()

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

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

Referenced by filter(), and filterResults().

224  : void
225  {
226  $this->results[$a_ref_id]['ref_id'] = $a_ref_id;
227  $this->results[$a_ref_id]['obj_id'] = $a_obj_id;
228  $this->results[$a_ref_id]['type'] = $a_type;
229  }
+ Here is the caller graph for this function:

◆ callListeners()

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

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

Referenced by filter().

523  : bool
524  {
525  foreach ($this->observers as $observer) {
526  $class = &$observer['class'];
527  $method = $observer['method'];
528 
529  if (!$class->$method($a_ref_id, $a_data)) {
530  return false;
531  }
532  }
533  return true;
534  }
+ 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 179 of file class.ilSearchResult.php.

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

179  : void
180  {
181  $new_entries = $this->getEntries();
182  $this->entries = array();
183 
184  // Get all checked objects
185  foreach ($this->search_cache->getCheckedItems() as $ref_id => $obj_id) {
186  if (isset($new_entries[$obj_id])) {
187  $this->addEntry(
188  $new_entries[$obj_id]['obj_id'],
189  $new_entries[$obj_id]['type'],
190  $new_entries[$obj_id]['found']
191  );
192  $this->__updateEntryChilds(
193  $new_entries[$obj_id]['obj_id'],
194  $new_entries[$obj_id]['child']
195  );
196  }
197  }
198  }
$ref_id
Definition: ltiauth.php:65
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)
+ 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 302 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.

307  : bool {
308  // get ref_ids and check access
309  $counter = 0;
310  $offset_counter = 0;
311  foreach ($this->getEntries() as $entry) {
312  // boolean and failed continue
313  if ($check_and and in_array(0, $entry['found'])) {
314  continue;
315  }
316  // Types like role, rolt, user do not need rbac checks
317  $type = ilObject::_lookupType($entry['obj_id']);
318  if ($type == 'rolt' or $type == 'usr' or $type == 'role') {
319  if ($this->callListeners($entry['obj_id'], $entry)) {
320  $this->addResult($entry['obj_id'], $entry['obj_id'], $type);
321  if (is_array($entry['child'])) {
322  $counter += count($entry['child']);
323  }
324  // Stop if maximum of hits is reached
325  if (++$counter > $this->getMaxHits()) {
326  $this->limit_reached = true;
327  return true;
328  }
329  }
330  continue;
331  }
332 
333  /*
334  * (Re-)check creation date, needed for searches on other tables than obj_data (35275)
335  * Before- and after-operators also allow matching datetimes, see ilObjectSearch::performSearch.
336  */
337  if (!is_null($creation_filter_date_start) || !is_null($creation_filter_date_end)) {
338  if (
339  !ilObject::_exists($entry['obj_id']) ||
340  ($creation_date_string = ilObject::_lookupCreationDate($entry['obj_id'])) === ''
341  ) {
342  continue;
343  }
344  $creation_date = new ilDate(
345  date('Y-m-d', strtotime($creation_date_string)),
347  );
348 
349  if ($creation_filter_date_start && is_null($creation_filter_date_end)) {
350  if (!ilDate::_after($creation_date, $creation_filter_date_start)) {
351  continue;
352  }
353  } elseif ($creation_filter_date_end && is_null($creation_filter_date_start)) {
354  if (!ilDate::_before($creation_date, $creation_filter_date_end)) {
355  continue;
356  }
357  } elseif (!ilDate::_within($creation_date, $creation_filter_date_start, $creation_filter_date_end)) {
358  continue;
359  }
360  }
361 
362  // Check referenced objects
363  foreach (ilObject::_getAllReferences((int) $entry['obj_id']) as $ref_id) {
364  // Failed check: if ref id check is failed by previous search
365  if ($this->search_cache->isFailed($ref_id)) {
366  continue;
367  }
368  // Offset check
369  if ($this->search_cache->isChecked($ref_id) and !$this->isOffsetReached($offset_counter)) {
370  ++$offset_counter;
371  continue;
372  }
373 
374  if (!$this->callListeners($ref_id, $entry)) {
375  continue;
376  }
377 
378 
379 
380  // RBAC check
381  $type = ilObject::_lookupType($ref_id, true);
382  if ($this->ilAccess->checkAccessOfUser(
383  $this->getUserId(),
384  $this->getRequiredPermission(),
385  '',
386  $ref_id,
387  $type,
388  $entry['obj_id']
389  )) {
390  if ($a_root_node == ROOT_FOLDER_ID or $this->tree->isGrandChild($a_root_node, $ref_id)) {
391  // Call listeners
392  #if($this->callListeners($ref_id,$entry))
393  if (1) {
394  $this->addResult($ref_id, $entry['obj_id'], $type);
395  $this->search_cache->appendToChecked($ref_id, $entry['obj_id']);
396  $this->__updateResultChilds($ref_id, $entry['child']);
397 
398  $counter++;
399  $offset_counter++;
400  // Stop if maximum of hits is reached
401 
402  if ($counter >= $this->getMaxHits()) {
403  $this->limit_reached = true;
404  $this->search_cache->setResults($this->results);
405  return true;
406  }
407  }
408  }
409  continue;
410  }
411  $this->search_cache->appendToFailed($ref_id);
412  }
413  }
414  $this->search_cache->setResults($this->results);
415  return false;
416  }
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:65
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.

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

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

421  : void
422  {
423  $tmp_results = $this->getResults();
424  $this->results = array();
425  foreach ($tmp_results as $result) {
426  if (isset($result['ref_id']) && $this->tree->isGrandChild($a_root_node, $result['ref_id']) && $this->tree->isInTree($result['ref_id'])) {
427  $this->addResult($result['ref_id'], $result['obj_id'], $result['type']);
428  $this->__updateResultChilds($result['ref_id'], $result['child'] ?? []);
429  }
430  }
431  }
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 94 of file class.ilSearchResult.php.

References $entries.

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

94  : array
95  {
96  return $this->entries;
97  }
+ Here is the caller graph for this function:

◆ getMaxHits()

ilSearchResult::getMaxHits ( )

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

References $max_hits.

Referenced by filter(), and initUserSearchCache().

108  : int
109  {
110  return $this->max_hits;
111  }
+ Here is the caller graph for this function:

◆ getRequiredPermission()

ilSearchResult::getRequiredPermission ( )

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

References $permission.

Referenced by filter().

80  : string
81  {
82  return $this->permission;
83  }
+ Here is the caller graph for this function:

◆ getResultIds()

ilSearchResult::getResultIds ( )
Returns
int[]

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

References $id, and getResults().

239  : array
240  {
241  $ids = [];
242  foreach ($this->getResults() as $id => $tmp) {
243  $ids[] = $id;
244  }
245  return $ids;
246  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ getResults()

ilSearchResult::getResults ( )

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

References $results.

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

231  : array
232  {
233  return $this->results;
234  }
+ Here is the caller graph for this function:

◆ getResultsByObjId()

ilSearchResult::getResultsByObjId ( )

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

References $ref_id, and getResults().

248  : array
249  {
250  $tmp_res = [];
251  foreach ($this->getResults() as $ref_id => $res_data) {
252  $tmp_res[$res_data['obj_id']][] = $ref_id;
253  }
254  return $tmp_res;
255  }
$ref_id
Definition: ltiauth.php:65
+ Here is the call graph for this function:

◆ getResultsForPresentation()

ilSearchResult::getResultsForPresentation ( )

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

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

275  : array
276  {
277  $res = [];
278  foreach ($this->getResults() as $result) {
279  if (!is_array($result)) {
280  continue;
281  }
282 
283  $res[(int) $result['ref_id']] = (int) $result['obj_id'];
284  }
285  return $res;
286  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:

◆ getSubitemIds()

ilSearchResult::getSubitemIds ( )

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

References $res, and getResults().

288  : array
289  {
290  $res = array();
291  foreach ($this->getResults() as $row) {
292  $res[$row['obj_id']] = $row['child'] ?? [];
293  }
294  return $res;
295  }
$res
Definition: ltiservices.php:66
+ 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 261 of file class.ilSearchResult.php.

261  : array
262  {
263  $obj_ids = [];
264  $objects = [];
265  foreach ($this->results as $result) {
266  if (in_array($result['obj_id'], $obj_ids)) {
267  continue;
268  }
269  $obj_ids[] = $result['obj_id'];
270  $objects[] = $result;
271  }
272  return $objects;
273  }

◆ getUserId()

ilSearchResult::getUserId ( )

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

References $user_id.

Referenced by initUserSearchCache().

89  : int
90  {
91  return $this->user_id;
92  }
+ Here is the caller graph for this function:

◆ initUserSearchCache()

ilSearchResult::initUserSearchCache ( )
protected

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

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

Referenced by __construct().

483  : void
484  {
485  $this->search_cache = ilUserSearchCache::_getInstance($this->getUserId());
486  $this->offset = $this->getMaxHits() * ($this->search_cache->getResultPageNumber() - 1) ;
487  }
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 203 of file class.ilSearchResult.php.

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

203  : void
204  {
205  $new_entries = $this->getEntries();
206  $this->entries = [];
207  foreach ($result_obj->getEntries() as $entry) {
208  $obj_id = $entry['obj_id'];
209  if (isset($new_entries[$obj_id])) {
210  $this->addEntry(
211  $new_entries[$obj_id]['obj_id'],
212  $new_entries[$obj_id]['type'],
213  $new_entries[$obj_id]['found']
214  );
215 
216  $this->__updateEntryChilds(
217  $new_entries[$obj_id]['obj_id'],
218  $new_entries[$obj_id]['child']
219  );
220  }
221  }
222  }
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)
+ Here is the call graph for this function:

◆ isLimitReached()

ilSearchResult::isLimitReached ( )

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

References $limit_reached.

99  : bool
100  {
101  return $this->limit_reached;
102  }

◆ isOffsetReached()

ilSearchResult::isOffsetReached ( int  $a_counter)

Check if offset is reached.

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

References $offset.

Referenced by filter().

116  : bool
117  {
118  return !($a_counter < $this->offset);
119  }
+ Here is the caller graph for this function:

◆ mergeEntries()

ilSearchResult::mergeEntries ( ilSearchResult  $result_obj)

merge entries of this instance and another result object

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

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

Referenced by ilSearchGUI\__performDetailsSearch().

167  : void
168  {
169  foreach ($result_obj->getEntries() as $obj_id => $entry) {
170  $this->addEntry($entry['obj_id'], $entry['type'], $entry['found']);
171  $this->__updateEntryChilds($entry['obj_id'], $entry['child']);
172  }
173  }
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)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ numEntries()

ilSearchResult::numEntries ( )

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

References getEntries().

158  : int
159  {
160  return count($this->getEntries());
161  }
+ 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 496 of file class.ilSearchResult.php.

References $preventOverwritingMaxhits, and null.

Referenced by __initSearchSettingsObject().

497  {
498  if (null === $a_flag) {
500  }
501 
502  $this->preventOverwritingMaxhits = $a_flag;
503 
504  return $this;
505  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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)

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

Referenced by ilSearchGUI\performSearch(), and ilSearchGUI\showSavedResults().

438  : void
439  {
440  $this->results = $this->search_cache->getResults();
441  }
+ Here is the caller graph for this function:

◆ save()

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

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

433  : void
434  {
435  $this->search_cache->save();
436  }

◆ setMaxHits()

ilSearchResult::setMaxHits ( int  $a_max_hits)

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

Referenced by __initSearchSettingsObject().

104  : void
105  {
106  $this->max_hits = $a_max_hits;
107  }
+ 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 75 of file class.ilSearchResult.php.

75  : void
76  {
77  $this->permission = $a_permission;
78  }

◆ setUserId()

ilSearchResult::setUserId ( int  $a_user_id)

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

85  : void
86  {
87  $this->user_id = $a_user_id;
88  }

Field Documentation

◆ $db

ilDBInterface ilSearchResult::$db
protected

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

◆ $entries

array ilSearchResult::$entries = array()
private

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

Referenced by getEntries().

◆ $ilAccess

ilAccess ilSearchResult::$ilAccess
protected

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

◆ $limit_reached

bool ilSearchResult::$limit_reached = false

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

Referenced by isLimitReached().

◆ $logger

ilLogger ilSearchResult::$logger
protected

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

◆ $max_hits

int ilSearchResult::$max_hits = 0
private

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

Referenced by getMaxHits().

◆ $observers

array ilSearchResult::$observers = array()
private

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

◆ $offset

int ilSearchResult::$offset = 0
protected

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

Referenced by isOffsetReached().

◆ $permission

string ilSearchResult::$permission = 'visible'
private

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

Referenced by getRequiredPermission().

◆ $preventOverwritingMaxhits

bool ilSearchResult::$preventOverwritingMaxhits = false
protected

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

Referenced by preventOverwritingMaxhits().

◆ $results

array ilSearchResult::$results = array()
private

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

Referenced by getResults().

◆ $search_cache

ilUserSearchCache ilSearchResult::$search_cache
protected

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

◆ $search_settings

ilSearchSettings ilSearchResult::$search_settings
protected

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

◆ $tree

ilTree ilSearchResult::$tree
protected

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

◆ $user

ilObjUser ilSearchResult::$user
protected

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

◆ $user_id

int ilSearchResult::$user_id
private

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

Referenced by getUserId().


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