ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilLuceneSearchGUI Class Reference

GUI for simple Lucene search More...

+ Inheritance diagram for ilLuceneSearchGUI:
+ Collaboration diagram for ilLuceneSearchGUI:

Public Member Functions

 __construct ()
 Constructor. More...
 
 executeCommand ()
 Execute Command. More...
 
 prepareOutput ()
 Add admin panel command. More...
 
- Public Member Functions inherited from ilSearchBaseGUI
 __construct ()
 Constructor public. More...
 
 prepareOutput ()
 
 initStandardSearchForm ($a_mode)
 Init standard search form. More...
 
 getSearchAreaForm ()
 Init standard search form. More...
 
 handleCommand ($a_cmd)
 Handle command. More...
 
 addToDeskObject ()
 Interface methods. More...
 
 removeFromDeskObject ()
 Remove from dektop. More...
 
 delete ()
 Show deletion screen. More...
 
 cancelDelete ()
 Cancel delete. More...
 
 cancelMoveLinkObject ()
 Cancel move/link. More...
 
 performDelete ()
 Delete objects. More...
 
 cut ()
 Interface ilAdministrationCommandHandler. More...
 
 link ()
 Interface ilAdministrationCommandHandler. More...
 
 paste ()
 Paste. More...
 
 showLinkIntoMultipleObjectsTree ()
 Target selection link. More...
 
 showPasteTree ()
 Target selection cut. More...
 
 performPasteIntoMultipleObjects ()
 Perform paste into multiple objects. More...
 
 clear ()
 clear clipboard More...
 
 enableAdministrationPanel ()
 Enable administration panel. More...
 
 disableAdministrationPanel ()
 Disable administration panel. More...
 
 keepObjectsInClipboardObject ()
 cancel action but keep objects in clipboard
Returns
void
More...
 
 addLocator ()
 Add Locator. More...
 
 autoComplete ()
 Data resource for autoComplete. More...
 

Protected Member Functions

 getType ()
 Get type of search (details | fast) More...
 
 getDetails ()
 Needed for base class search form. More...
 
 getMimeDetails ()
 Needed for base class search form. More...
 
 remoteSearch ()
 Search from main menu. More...
 
 showSavedResults ()
 Show saved results. More...
 
 search ()
 Search (button pressed) More...
 
 performSearch ()
 Perform search. More...
 
 storeRoot ()
 Store new root node. More...
 
 getTabs ()
 get tabs More...
 
 initUserSearchCache ()
 Init user search cache. More...
 
 fillAdminPanel ()
 Put admin panel into template: More...
 
 addAdminPanelCommand ($a_cmd, $a_txt)
 Add a command to the admin panel. More...
 
 setAdminViewButton ($a_link, $a_txt)
 Show admin view button. More...
 
 setPageFormAction ($a_action)
 
 showSearchForm ()
 Show search form. More...
 
 parseCreationFilter ()
 Parse creation date. More...
 
- Protected Member Functions inherited from ilSearchBaseGUI
 addPager ($result, $a_session_key)
 Add Pager. More...
 
 buildSearchAreaPath ($a_root_node)
 Build path for search area. More...
 
 getCreationDateForm ()
 
 getSearchCache ()
 Get user search cache. More...
 
 loadCreationFilter ()
 Load creation date filter. More...
 

Protected Attributes

 $ilTabs
 
- Protected Attributes inherited from ilSearchBaseGUI
 $settings = null
 
 $ctrl = null
 

Additional Inherited Members

- Data Fields inherited from ilSearchBaseGUI
const SEARCH_FAST = 1
 
const SEARCH_DETAILS = 2
 
const SEARCH_AND = 'and'
 
const SEARCH_OR = 'or'
 
const SEARCH_FORM_LUCENE = 1
 
const SEARCH_FORM_STANDARD = 2
 
const SEARCH_FORM_USER = 3
 
 $ilias = null
 
 $lng = null
 
 $tpl = null
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilLuceneSearchGUI::__construct ( )

Constructor.

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

References $DIC, $ilTabs, fields, ilLuceneAdvancedSearchFields\getInstance(), and initUserSearchCache().

52  {
53  global $DIC;
54 
55  $ilTabs = $DIC['ilTabs'];
56 
57  $this->tabs_gui = $ilTabs;
58  parent::__construct();
60  $this->initUserSearchCache();
61  }
global $DIC
Definition: saml.php:7
$errors fields
Definition: imgupload.php:51
initUserSearchCache()
Init user search cache.
static getInstance()
Get singleton instance.
+ Here is the call graph for this function:

Member Function Documentation

◆ addAdminPanelCommand()

ilLuceneSearchGUI::addAdminPanelCommand (   $a_cmd,
  $a_txt 
)
protected

Add a command to the admin panel.

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

516  {
517  $this->admin_panel_commands[] =
518  array("cmd" => $a_cmd, "txt" => $a_txt);
519  }

◆ executeCommand()

ilLuceneSearchGUI::executeCommand ( )

Execute Command.

Definition at line 66 of file class.ilLuceneSearchGUI.php.

References $DIC, $form, $ilBench, $ilCtrl, ilSearchBaseGUI\getSearchAreaForm(), ilSearchBaseGUI\handleCommand(), ilSearchBaseGUI\initStandardSearchForm(), prepareOutput(), and ilSearchBaseGUI\SEARCH_FORM_LUCENE.

67  {
68  global $DIC;
69 
70  $ilBench = $DIC['ilBench'];
71  $ilCtrl = $DIC['ilCtrl'];
72 
73  $ilBench->start('Lucene', '0900_executeCommand');
74  $next_class = $this->ctrl->getNextClass($this);
75  $cmd = $this->ctrl->getCmd();
76 
77  $this->prepareOutput();
78  switch ($next_class) {
79  case "ilpropertyformgui":
80  /*$this->initStandardSearchForm(ilSearchBaseGUI::SEARCH_FORM_LUCENE);
81  $ilCtrl->setReturn($this, 'storeRoot');
82  $ilCtrl->forwardCommand($this->form);*/
83  $form = $this->getSearchAreaForm();
84  $ilCtrl->setReturn($this, 'storeRoot');
85  $ilCtrl->forwardCommand($form);
86  break;
87 
88  case 'ilobjectcopygui':
89  $this->ctrl->setReturn($this, '');
90  include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
91  $cp = new ilObjectCopyGUI($this);
92  $this->ctrl->forwardCommand($cp);
93  break;
94 
95  default:
97  if (!$cmd) {
98  $cmd = "showSavedResults";
99  }
100  $this->handleCommand($cmd);
101  break;
102  }
103  $ilBench->stop('Lucene', '0900_executeCommand');
104  return true;
105  }
getSearchAreaForm()
Init standard search form.
GUI class for the workflow of copying objects.
global $DIC
Definition: saml.php:7
prepareOutput()
Add admin panel command.
global $ilCtrl
Definition: ilias.php:18
if(isset($_POST['submit'])) $form
initStandardSearchForm($a_mode)
Init standard search form.
handleCommand($a_cmd)
Handle command.
global $ilBench
Definition: ilias.php:18
+ Here is the call graph for this function:

◆ fillAdminPanel()

ilLuceneSearchGUI::fillAdminPanel ( )
protected

Put admin panel into template:

  • creation selector
  • admin view on/off button

Definition at line 436 of file class.ilLuceneSearchGUI.php.

References $DIC, ilSearchBaseGUI\$lng, and ilUtil\getImagePath().

437  {
438  global $DIC;
439 
440  $lng = $DIC['lng'];
441 
442  $adm_view_cmp = $adm_cmds = $creation_selector = $adm_view = false;
443 
444  // admin panel commands
445  if ((count((array) $this->admin_panel_commands) > 0)) {
446  foreach ($this->admin_panel_commands as $cmd) {
447  $this->tpl->setCurrentBlock("lucene_admin_panel_cmd");
448  $this->tpl->setVariable("LUCENE_PANEL_CMD", $cmd["cmd"]);
449  $this->tpl->setVariable("LUCENE_TXT_PANEL_CMD", $cmd["txt"]);
450  $this->tpl->parseCurrentBlock();
451  }
452 
453  $adm_cmds = true;
454  }
455  if ($adm_cmds) {
456  $this->tpl->setCurrentBlock("lucene_adm_view_components");
457  $this->tpl->setVariable("LUCENE_ADM_IMG_ARROW", ilUtil::getImagePath("arrow_upright.svg"));
458  $this->tpl->setVariable("LUCENE_ADM_ALT_ARROW", $lng->txt("actions"));
459  $this->tpl->parseCurrentBlock();
460  $adm_view_cmp = true;
461  }
462 
463  // admin view button
464  if (is_array($this->admin_view_button)) {
465  if (is_array($this->admin_view_button)) {
466  $this->tpl->setCurrentBlock("lucene_admin_button");
467  $this->tpl->setVariable(
468  "LUCENE_ADMIN_MODE_LINK",
469  $this->admin_view_button["link"]
470  );
471  $this->tpl->setVariable(
472  "LUCENE_TXT_ADMIN_MODE",
473  $this->admin_view_button["txt"]
474  );
475  $this->tpl->parseCurrentBlock();
476  }
477  $this->tpl->setCurrentBlock("lucene_admin_view");
478  $this->tpl->parseCurrentBlock();
479  $adm_view = true;
480  }
481 
482  // creation selector
483  if (is_array($this->creation_selector)) {
484  $this->tpl->setCurrentBlock("lucene_add_commands");
485  if ($adm_cmds) {
486  $this->tpl->setVariable("LUCENE_ADD_COM_WIDTH", 'width="1"');
487  }
488  $this->tpl->setVariable(
489  "LUCENE_SELECT_OBJTYPE_REPOS",
490  $this->creation_selector["options"]
491  );
492  $this->tpl->setVariable(
493  "LUCENE_BTN_NAME_REPOS",
494  $this->creation_selector["command"]
495  );
496  $this->tpl->setVariable(
497  "LUCENE_TXT_ADD_REPOS",
498  $this->creation_selector["txt"]
499  );
500  $this->tpl->parseCurrentBlock();
501  $creation_selector = true;
502  }
503  if ($adm_view || $creation_selector) {
504  $this->tpl->setCurrentBlock("lucene_adm_panel");
505  if ($adm_view_cmp) {
506  $this->tpl->setVariable("LUCENE_ADM_TBL_WIDTH", 'width:"100%";');
507  }
508  $this->tpl->parseCurrentBlock();
509  }
510  }
global $DIC
Definition: saml.php:7
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
+ Here is the call graph for this function:

◆ getDetails()

ilLuceneSearchGUI::getDetails ( )
protected

Needed for base class search form.

Todo:
rename
Returns
type

Definition at line 135 of file class.ilLuceneSearchGUI.php.

136  {
137  return (array) $this->search_cache->getItemFilter();
138  }

◆ getMimeDetails()

ilLuceneSearchGUI::getMimeDetails ( )
protected

Needed for base class search form.

Todo:
rename
Returns
type

Definition at line 145 of file class.ilLuceneSearchGUI.php.

146  {
147  return (array) $this->search_cache->getMimeFilter();
148  }

◆ getTabs()

ilLuceneSearchGUI::getTabs ( )
protected

get tabs

Definition at line 360 of file class.ilLuceneSearchGUI.php.

References $DIC, fields, and ilSearchSettings\getInstance().

Referenced by prepareOutput().

361  {
362  global $DIC;
363 
364  $ilHelp = $DIC['ilHelp'];
365 
366  $ilHelp->setScreenIdComponent("src_luc");
367 
368  $this->tabs_gui->addTarget('search', $this->ctrl->getLinkTarget($this));
369 
370  if (ilSearchSettings::getInstance()->isLuceneUserSearchEnabled()) {
371  $this->tabs_gui->addTarget('search_user', $this->ctrl->getLinkTargetByClass('illuceneusersearchgui'));
372  }
373 
374  if ($this->fields->getActiveFields() && !ilSearchSettings::getInstance()->getHideAdvancedSearch()) {
375  $this->tabs_gui->addTarget('search_advanced', $this->ctrl->getLinkTargetByClass('illuceneAdvancedSearchgui'));
376  }
377 
378  $this->tabs_gui->setTabActive('search');
379  }
global $DIC
Definition: saml.php:7
$errors fields
Definition: imgupload.php:51
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getType()

ilLuceneSearchGUI::getType ( )
protected

Get type of search (details | fast)

Todo:
rename Needed for base class search form

Definition at line 122 of file class.ilLuceneSearchGUI.php.

References ilSearchBaseGUI\SEARCH_DETAILS, and ilSearchBaseGUI\SEARCH_FAST.

123  {
124  if (count($this->search_cache)) {
126  }
128  }

◆ initUserSearchCache()

ilLuceneSearchGUI::initUserSearchCache ( )
protected

Init user search cache.

private

Definition at line 387 of file class.ilLuceneSearchGUI.php.

References $_GET, $_POST, $data, $DIC, $ilUser, $type, ilUserSearchCache\_getInstance(), ilSearchSettings\getInstance(), ilSearchBaseGUI\loadCreationFilter(), ilUserSearchCache\LUCENE_DEFAULT, and ilUtil\stripSlashes().

Referenced by __construct().

388  {
389  global $DIC;
390 
391  $ilUser = $DIC['ilUser'];
392 
393  include_once('Services/Search/classes/class.ilUserSearchCache.php');
394  $this->search_cache = ilUserSearchCache::_getInstance($ilUser->getId());
395  $this->search_cache->switchSearchType(ilUserSearchCache::LUCENE_DEFAULT);
396  if ((int) $_GET['page_number']) {
397  $this->search_cache->setResultPageNumber((int) $_GET['page_number']);
398  }
399  if (isset($_POST['term'])) {
400  $this->search_cache->setQuery(ilUtil::stripSlashes($_POST['term']));
401  if ($_POST['item_filter_enabled']) {
402  $filtered = array();
403  foreach (ilSearchSettings::getInstance()->getEnabledLuceneItemFilterDefinitions() as $type => $data) {
404  if ($_POST['filter_type'][$type]) {
405  $filtered[$type] = 1;
406  }
407  }
408  $this->search_cache->setItemFilter($filtered);
409 
410  // Mime filter
411  $mime = array();
412  foreach (ilSearchSettings::getInstance()->getEnabledLuceneMimeFilterDefinitions() as $type => $data) {
413  if ($_POST['filter_type'][$type]) {
414  $mime[$type] = 1;
415  }
416  }
417  $this->search_cache->setMimeFilter($mime);
418  }
419  $this->search_cache->setCreationFilter($this->loadCreationFilter());
420  if (!$_POST['item_filter_enabled']) {
421  // @todo: keep item filter settings
422  $this->search_cache->setItemFilter(array());
423  $this->search_cache->setMimeFilter(array());
424  }
425  if (!$_POST['screation']) {
426  $this->search_cache->setCreationFilter(array());
427  }
428  }
429  }
loadCreationFilter()
Load creation date filter.
$type
global $DIC
Definition: saml.php:7
$_GET["client_id"]
static _getInstance($a_usr_id)
Get singleton instance.
$ilUser
Definition: imgupload.php:18
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$_POST["username"]
$data
Definition: bench.php:6
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseCreationFilter()

ilLuceneSearchGUI::parseCreationFilter ( )
protected

Parse creation date.

Returns
string

Definition at line 600 of file class.ilLuceneSearchGUI.php.

References PHPMailer\PHPMailer\$options, IL_CAL_DATE, IL_CAL_DAY, and IL_CAL_UNIX.

Referenced by performSearch().

601  {
602  $options = $this->search_cache->getCreationFilter();
603 
604  if (!$options['enabled']) {
605  return '';
606  }
607  $limit = new ilDate($options['date'], IL_CAL_UNIX);
608 
609  switch ($options['ontype']) {
610  case 1:
611  // after
612  $limit->increment(IL_CAL_DAY, 1);
613  $now = new ilDate(time(), IL_CAL_UNIX);
614  return '+(cdate:[' . $limit->get(IL_CAL_DATE) . ' TO ' . $now->get(IL_CAL_DATE) . '*]) ';
615 
616  case 2:
617  // before
618  return '+(cdate:[* TO ' . $limit->get(IL_CAL_DATE) . ']) ';
619 
620  case 3:
621  // on
622  return '+(cdate:' . $limit->get(IL_CAL_DATE) . '*) ';
623 
624  }
625  return '';
626  }
const IL_CAL_UNIX
const IL_CAL_DAY
Class for single dates.
const IL_CAL_DATE
+ Here is the caller graph for this function:

◆ performSearch()

ilLuceneSearchGUI::performSearch ( )
protected

Perform search.

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

References $_SESSION, $DIC, $ilBench, $ilUser, $query, ilSearchBaseGUI\addPager(), ilLuceneSearcher\getInstance(), ilSearchSettings\getInstance(), ilLuceneSearchResultFilter\getInstance(), parseCreationFilter(), ilUtil\sendInfo(), and showSearchForm().

Referenced by search(), and storeRoot().

250  {
251  global $DIC;
252 
253  $ilUser = $DIC['ilUser'];
254  $ilBench = $DIC['ilBench'];
255 
256  unset($_SESSION['vis_references']);
257 
258  $filter_query = '';
259  if ($this->search_cache->getItemFilter() and ilSearchSettings::getInstance()->isLuceneItemFilterEnabled()) {
260  $filter_settings = ilSearchSettings::getInstance()->getEnabledLuceneItemFilterDefinitions();
261  foreach ((array) $this->search_cache->getItemFilter() as $obj => $value) {
262  if (!$filter_query) {
263  $filter_query .= '+( ';
264  } else {
265  $filter_query .= 'OR';
266  }
267  $filter_query .= (' ' . (string) $filter_settings[$obj]['filter'] . ' ');
268  }
269  $filter_query .= ') ';
270  }
271  // begin-patch mime_filter
272  $mime_query = '';
273  if ($this->search_cache->getMimeFilter() and ilSearchSettings::getInstance()->isLuceneMimeFilterEnabled()) {
274  $filter_settings = ilSearchSettings::getInstance()->getEnabledLuceneMimeFilterDefinitions();
275  foreach ($this->search_cache->getMimeFilter() as $mime => $value) {
276  if (!$mime_query) {
277  $mime_query .= '+( ';
278  } else {
279  $mime_query .= 'OR';
280  }
281  $mime_query .= (' ' . (string) $filter_settings[$mime]['filter'] . ' ');
282  }
283  $mime_query .= ') ';
284  }
285 
286  // begin-patch creation_date
287  $cdate_query = $this->parseCreationFilter();
288 
289 
290 
291  $filter_query = $filter_query . ' ' . $mime_query . ' ' . $cdate_query;
292 
293  include_once './Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
294  include_once './Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
295 
296  $query = $this->search_cache->getQuery();
297  if ($query) {
298  $query = ' +(' . $query . ')';
299  }
300  $qp = new ilLuceneQueryParser($filter_query . $query);
301  $qp->parse();
302  $searcher = ilLuceneSearcher::getInstance($qp);
303  $searcher->search();
304 
305  // Filter results
306  include_once './Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
307  include_once './Services/Search/classes/Lucene/class.ilLucenePathFilter.php';
309  $filter->addFilter(new ilLucenePathFilter($this->search_cache->getRoot()));
310  $filter->setCandidates($searcher->getResult());
311  $filter->filter();
312 
313  if ($filter->getResultObjIds()) {
314  $searcher->highlight($filter->getResultObjIds());
315  }
316 
317  // Show results
318  $this->showSearchForm();
319 
320  include_once './Services/Search/classes/class.ilSearchResultPresentation.php';
321  $presentation = new ilSearchResultPresentation($this);
322  $presentation->setResults($filter->getResultIds());
323  $presentation->setSearcher($searcher);
324 
325  // TODO: other handling required
326  $ilBench->start('Lucene', '1500_fo');
327  $this->addPager($filter, 'max_page');
328  $ilBench->stop('Lucene', '1500_fo');
329 
330  $presentation->setPreviousNext($this->prev_link, $this->next_link);
331 
332  if ($presentation->render()) {
333  $this->tpl->setVariable('SEARCH_RESULTS', $presentation->getHTML(true));
334  } else {
335  ilUtil::sendInfo(sprintf($this->lng->txt('search_no_match_hint'), $this->search_cache->getQuery()));
336  }
337  }
showSearchForm()
Show search form.
$_SESSION["AccountId"]
global $DIC
Definition: saml.php:7
static getInstance(ilLuceneQueryParser $qp)
Get singleton instance.
parseCreationFilter()
Parse creation date.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
addPager($result, $a_session_key)
Add Pager.
Presentation of search results using object list gui.
$ilUser
Definition: imgupload.php:18
$query
global $ilBench
Definition: ilias.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareOutput()

ilLuceneSearchGUI::prepareOutput ( )

Add admin panel command.

Definition at line 110 of file class.ilLuceneSearchGUI.php.

References getTabs().

Referenced by executeCommand().

111  {
112  parent::prepareOutput();
113  $this->getTabs();
114  return true;
115  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ remoteSearch()

ilLuceneSearchGUI::remoteSearch ( )
protected

Search from main menu.

Definition at line 153 of file class.ilLuceneSearchGUI.php.

References $_POST, $query, search(), and ilUtil\stripSlashes().

154  {
155  $query = trim(ilUtil::stripSlashes($_POST['queryString']));
156 
157  include_once './Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
158  $qp = new ilLuceneQueryParser($query);
159  $qp->parseAutoWildcard();
160 
161  $query = $qp->getQuery();
162 
163  $this->search_cache->setRoot((int) $_POST['root_id']);
164  $this->search_cache->setQuery(ilUtil::stripSlashes($query));
165  $this->search_cache->save();
166 
167  $this->search();
168  }
$query
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
search()
Search (button pressed)
$_POST["username"]
+ Here is the call graph for this function:

◆ search()

ilLuceneSearchGUI::search ( )
protected

Search (button pressed)

Returns

Definition at line 225 of file class.ilLuceneSearchGUI.php.

References $_SESSION, performSearch(), ilSubItemListGUI\resetDetails(), and showSearchForm().

Referenced by remoteSearch().

226  {
227  if (!$this->form->checkInput()) {
228  $this->search_cache->deleteCachedEntries();
229  // Reset details
230  include_once './Services/Object/classes/class.ilSubItemListGUI.php';
232  $this->showSearchForm();
233  return false;
234  }
235 
236  unset($_SESSION['max_page']);
237  $this->search_cache->deleteCachedEntries();
238 
239  // Reset details
240  include_once './Services/Object/classes/class.ilSubItemListGUI.php';
242 
243  $this->performSearch();
244  }
showSearchForm()
Show search form.
$_SESSION["AccountId"]
static resetDetails()
reset details As long as static::resetDetails is not possible this method is final ...
performSearch()
Perform search.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAdminViewButton()

ilLuceneSearchGUI::setAdminViewButton (   $a_link,
  $a_txt 
)
protected

Show admin view button.

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

525  {
526  $this->admin_view_button =
527  array("link" => $a_link, "txt" => $a_txt);
528  }

◆ setPageFormAction()

ilLuceneSearchGUI::setPageFormAction (   $a_action)
protected

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

531  {
532  $this->page_form_action = $a_action;
533  }

◆ showSavedResults()

ilLuceneSearchGUI::showSavedResults ( )
protected

Show saved results.

Returns

Definition at line 174 of file class.ilLuceneSearchGUI.php.

References $DIC, $ilBench, $ilUser, ilSearchBaseGUI\addPager(), ilLuceneSearcher\getInstance(), ilLuceneSearchResultFilter\getInstance(), ilLuceneQueryParser\parse(), ilUtil\sendInfo(), and showSearchForm().

175  {
176  global $DIC;
177 
178  $ilUser = $DIC['ilUser'];
179  $ilBench = $DIC['ilBench'];
180 
181  if (!strlen($this->search_cache->getQuery())) {
182  $this->showSearchForm();
183  return false;
184  }
185 
186  include_once './Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
187  include_once './Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
188  $qp = new ilLuceneQueryParser($this->search_cache->getQuery());
189  $qp->parse();
190  $searcher = ilLuceneSearcher::getInstance($qp);
191  $searcher->search();
192 
193  // Load saved results
194  include_once './Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
196  $filter->loadFromDb();
197 
198  // Highlight
199  $searcher->highlight($filter->getResultObjIds());
200 
201  include_once './Services/Search/classes/class.ilSearchResultPresentation.php';
202  $presentation = new ilSearchResultPresentation($this);
203  $presentation->setResults($filter->getResultIds());
204 
205  $presentation->setSearcher($searcher);
206 
207  // TODO: other handling required
208  $this->addPager($filter, 'max_page');
209 
210  $presentation->setPreviousNext($this->prev_link, $this->next_link);
211 
212  $this->showSearchForm();
213 
214  if ($presentation->render()) {
215  $this->tpl->setVariable('SEARCH_RESULTS', $presentation->getHTML(true));
216  } elseif (strlen($this->search_cache->getQuery())) {
217  ilUtil::sendInfo(sprintf($this->lng->txt('search_no_match_hint'), $qp->getQuery()));
218  }
219  }
showSearchForm()
Show search form.
global $DIC
Definition: saml.php:7
parse()
parse query string
static getInstance(ilLuceneQueryParser $qp)
Get singleton instance.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
addPager($result, $a_session_key)
Add Pager.
Presentation of search results using object list gui.
$ilUser
Definition: imgupload.php:18
global $ilBench
Definition: ilias.php:18
+ Here is the call graph for this function:

◆ showSearchForm()

ilLuceneSearchGUI::showSearchForm ( )
protected

Show search form.

Returns
boolean

Definition at line 539 of file class.ilLuceneSearchGUI.php.

References $DIC, $ilCtrl, ilSearchBaseGUI\$lng, ilGlyphGUI\CARET, ilGlyphGUI\get(), ilSearchBaseGUI\getCreationDateForm(), ilSubmitButton\getInstance(), ilSearchSettings\getInstance(), ilSearchBaseGUI\getSearchAreaForm(), ilOverlayGUI\initJavascript(), ilSearchSettings\OPERATOR_AND, and ilUtil\prepareFormOutput().

Referenced by performSearch(), search(), and showSavedResults().

540  {
541  global $DIC;
542 
543  $ilCtrl = $DIC['ilCtrl'];
544  $lng = $DIC['lng'];
545 
546  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.lucene_search.html', 'Services/Search');
547 
548  // include js needed
549  include_once("./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
551  $this->tpl->addJavascript("./Services/Search/js/Search.js");
552 
553  include_once("./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
554 
555  $this->tpl->setVariable("FORM_ACTION", $ilCtrl->getFormAction($this, 'performSearch'));
556  $this->tpl->setVariable("TERM", ilUtil::prepareFormOutput($this->search_cache->getQuery()));
557  $this->tpl->setVariable("SEARCH_LABEL", $lng->txt("search"));
558  include_once("./Services/UIComponent/Button/classes/class.ilSubmitButton.php");
560  $btn->setCommand("performSearch");
561  $btn->setCaption("search");
562  $this->tpl->setVariable("SUBMIT_BTN", $btn->render());
563  $this->tpl->setVariable("TXT_OPTIONS", $lng->txt("options"));
564  $this->tpl->setVariable("ARR_IMG", ilGlyphGUI::get(ilGlyphGUI::CARET));
565  $this->tpl->setVariable("TXT_COMBINATION", $lng->txt("search_term_combination"));
566  $this->tpl->setVariable('TXT_COMBINATION_DEFAULT', ilSearchSettings::getInstance()->getDefaultOperator() == ilSearchSettings::OPERATOR_AND ? $lng->txt('search_all_words') : $lng->txt('search_any_word'));
567  $this->tpl->setVariable("TXT_AREA", $lng->txt("search_area"));
568 
569  if (ilSearchSettings::getInstance()->isLuceneItemFilterEnabled()) {
570  $this->tpl->setCurrentBlock("type_sel");
571  $this->tpl->setVariable('TXT_TYPE_DEFAULT', $lng->txt("search_off"));
572  $this->tpl->setVariable("ARR_IMGT", ilGlyphGUI::get(ilGlyphGUI::CARET));
573  $this->tpl->setVariable("TXT_FILTER_BY_TYPE", $lng->txt("search_filter_by_type"));
574  $this->tpl->setVariable('FORM', $this->form->getHTML());
575  $this->tpl->parseCurrentBlock();
576  }
577 
578  // search area form
579  $this->tpl->setVariable('SEARCH_AREA_FORM', $this->getSearchAreaForm()->getHTML());
580  $this->tpl->setVariable("TXT_CHANGE", $lng->txt("change"));
581 
582  if (ilSearchSettings::getInstance()->isDateFilterEnabled()) {
583  // begin-patch creation_date
584  $this->tpl->setVariable('TXT_FILTER_BY_CDATE', $this->lng->txt('search_filter_cd'));
585  $this->tpl->setVariable('TXT_CD_OFF', $this->lng->txt('search_off'));
586  $this->tpl->setVariable('FORM_CD', $this->getCreationDateForm()->getHTML());
587  $this->tpl->setVariable("ARR_IMG_CD", ilGlyphGUI::get(ilGlyphGUI::CARET));
588  // end-patch creation_date
589  }
590 
591 
592  return true;
593  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
getSearchAreaForm()
Init standard search form.
global $DIC
Definition: saml.php:7
static get($a_glyph, $a_text="")
Get glyph html.
global $ilCtrl
Definition: ilias.php:18
static initJavascript()
Init javascript.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ storeRoot()

ilLuceneSearchGUI::storeRoot ( )
protected

Store new root node.

Definition at line 342 of file class.ilLuceneSearchGUI.php.

References $form, ilSearchBaseGUI\getSearchAreaForm(), performSearch(), and ilSubItemListGUI\resetDetails().

343  {
344  $form = $this->getSearchAreaForm();
345 
346  $this->root_node = $form->getItemByPostVar('area')->getValue();
347  $this->search_cache->setRoot($this->root_node);
348  $this->search_cache->save();
349  $this->search_cache->deleteCachedEntries();
350 
351  include_once './Services/Object/classes/class.ilSubItemListGUI.php';
353 
354  $this->performSearch();
355  }
getSearchAreaForm()
Init standard search form.
static resetDetails()
reset details As long as static::resetDetails is not possible this method is final ...
if(isset($_POST['submit'])) $form
performSearch()
Perform search.
+ Here is the call graph for this function:

Field Documentation

◆ $ilTabs

ilLuceneSearchGUI::$ilTabs
protected

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

Referenced by __construct().


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