ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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...
 
 cancelObject ()
 
 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...
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

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
 
 $favourites
 
 $user
 

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 50 of file class.ilLuceneSearchGUI.php.

References $DIC, $ilTabs, ILIAS\GlobalScreen\Provider\__construct(), fields, ilLuceneAdvancedSearchFields\getInstance(), and initUserSearchCache().

51  {
52  global $DIC;
53 
54  $ilTabs = $DIC['ilTabs'];
55 
56  $this->tabs_gui = $ilTabs;
59  $this->initUserSearchCache();
60  }
$errors fields
Definition: imgupload.php:51
global $DIC
Definition: goto.php:24
initUserSearchCache()
Init user search cache.
__construct(Container $dic, ilPlugin $plugin)
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 514 of file class.ilLuceneSearchGUI.php.

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

◆ executeCommand()

ilLuceneSearchGUI::executeCommand ( )

Execute Command.

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

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

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

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

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

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

◆ getMimeDetails()

ilLuceneSearchGUI::getMimeDetails ( )
protected

Needed for base class search form.

Todo:
rename
Returns
type

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

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

◆ getTabs()

ilLuceneSearchGUI::getTabs ( )
protected

get tabs

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

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

Referenced by prepareOutput().

360  {
361  global $DIC;
362 
363  $ilHelp = $DIC['ilHelp'];
364 
365  $ilHelp->setScreenIdComponent("src_luc");
366 
367  $this->tabs_gui->addTarget('search', $this->ctrl->getLinkTarget($this));
368 
369  if (ilSearchSettings::getInstance()->isLuceneUserSearchEnabled()) {
370  $this->tabs_gui->addTarget('search_user', $this->ctrl->getLinkTargetByClass('illuceneusersearchgui'));
371  }
372 
373  if ($this->fields->getActiveFields() && !ilSearchSettings::getInstance()->getHideAdvancedSearch()) {
374  $this->tabs_gui->addTarget('search_advanced', $this->ctrl->getLinkTargetByClass('illuceneAdvancedSearchgui'));
375  }
376 
377  $this->tabs_gui->setTabActive('search');
378  }
$errors fields
Definition: imgupload.php:51
global $DIC
Definition: goto.php:24
+ 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 121 of file class.ilLuceneSearchGUI.php.

References ilSearchBaseGUI\SEARCH_DETAILS, and ilSearchBaseGUI\SEARCH_FAST.

122  {
123  if (count($this->search_cache)) {
125  }
127  }

◆ initUserSearchCache()

ilLuceneSearchGUI::initUserSearchCache ( )
protected

Init user search cache.

private

Definition at line 386 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().

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

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

References getTabs().

Referenced by executeCommand().

110  {
111  parent::prepareOutput();
112  $this->getTabs();
113  return true;
114  }
+ 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 152 of file class.ilLuceneSearchGUI.php.

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

153  {
154  $query = trim(ilUtil::stripSlashes($_POST['queryString']));
155 
156  include_once './Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
157  $qp = new ilLuceneQueryParser($query);
158  $qp->parseAutoWildcard();
159 
160  $query = $qp->getQuery();
161 
162  $this->search_cache->setRoot((int) $_POST['root_id']);
163  $this->search_cache->setQuery(ilUtil::stripSlashes($query));
164  $this->search_cache->save();
165 
166  $this->search();
167  }
$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 224 of file class.ilLuceneSearchGUI.php.

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

Referenced by remoteSearch().

225  {
226  if (!$this->form->checkInput()) {
227  $this->search_cache->deleteCachedEntries();
228  // Reset details
229  include_once './Services/Object/classes/class.ilSubItemListGUI.php';
231  $this->showSearchForm();
232  return false;
233  }
234 
235  unset($_SESSION['max_page']);
236  $this->search_cache->deleteCachedEntries();
237 
238  // Reset details
239  include_once './Services/Object/classes/class.ilSubItemListGUI.php';
241 
242  $this->performSearch();
243  }
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 523 of file class.ilLuceneSearchGUI.php.

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

◆ setPageFormAction()

ilLuceneSearchGUI::setPageFormAction (   $a_action)
protected

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

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

◆ showSavedResults()

ilLuceneSearchGUI::showSavedResults ( )
protected

Show saved results.

Returns

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

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

174  {
175  global $DIC;
176 
177  $ilUser = $DIC['ilUser'];
178  $ilBench = $DIC['ilBench'];
179 
180  if (!strlen($this->search_cache->getQuery())) {
181  $this->showSearchForm();
182  return false;
183  }
184 
185  include_once './Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
186  include_once './Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
187  $qp = new ilLuceneQueryParser($this->search_cache->getQuery());
188  $qp->parse();
189  $searcher = ilLuceneSearcher::getInstance($qp);
190  $searcher->search();
191 
192  // Load saved results
193  include_once './Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
195  $filter->loadFromDb();
196 
197  // Highlight
198  $searcher->highlight($filter->getResultObjIds());
199 
200  include_once './Services/Search/classes/class.ilSearchResultPresentation.php';
201  $presentation = new ilSearchResultPresentation($this);
202  $presentation->setResults($filter->getResultIds());
203 
204  $presentation->setSearcher($searcher);
205 
206  // TODO: other handling required
207  $this->addPager($filter, 'max_page');
208 
209  $presentation->setPreviousNext($this->prev_link, $this->next_link);
210 
211  $this->showSearchForm();
212 
213  if ($presentation->render()) {
214  $this->tpl->setVariable('SEARCH_RESULTS', $presentation->getHTML(true));
215  } elseif (strlen($this->search_cache->getQuery())) {
216  ilUtil::sendInfo(sprintf($this->lng->txt('search_no_match_hint'), $qp->getQuery()));
217  }
218  }
showSearchForm()
Show search form.
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.
global $DIC
Definition: goto.php:24
global $ilBench
Definition: ilias.php:21
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ showSearchForm()

ilLuceneSearchGUI::showSearchForm ( )
protected

Show search form.

Returns
boolean

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

References $DIC, 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().

539  {
540  global $DIC;
541 
542  $ilCtrl = $DIC['ilCtrl'];
543  $lng = $DIC['lng'];
544 
545  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.lucene_search.html', 'Services/Search');
546 
547  // include js needed
548  include_once("./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
550  $this->tpl->addJavascript("./Services/Search/js/Search.js");
551 
552  include_once("./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
553 
554  $this->tpl->setVariable("FORM_ACTION", $ilCtrl->getFormAction($this, 'performSearch'));
555  $this->tpl->setVariable("TERM", ilUtil::prepareFormOutput($this->search_cache->getQuery()));
556  $this->tpl->setVariable("SEARCH_LABEL", $lng->txt("search"));
557  include_once("./Services/UIComponent/Button/classes/class.ilSubmitButton.php");
559  $btn->setCommand("performSearch");
560  $btn->setCaption("search");
561  $this->tpl->setVariable("SUBMIT_BTN", $btn->render());
562  $this->tpl->setVariable("TXT_OPTIONS", $lng->txt("options"));
563  $this->tpl->setVariable("ARR_IMG", ilGlyphGUI::get(ilGlyphGUI::CARET));
564  $this->tpl->setVariable("TXT_COMBINATION", $lng->txt("search_term_combination"));
565  $this->tpl->setVariable('TXT_COMBINATION_DEFAULT', ilSearchSettings::getInstance()->getDefaultOperator() == ilSearchSettings::OPERATOR_AND ? $lng->txt('search_all_words') : $lng->txt('search_any_word'));
566  $this->tpl->setVariable("TXT_AREA", $lng->txt("search_area"));
567 
568  if (ilSearchSettings::getInstance()->isLuceneItemFilterEnabled()) {
569  $this->tpl->setCurrentBlock("type_sel");
570  $this->tpl->setVariable('TXT_TYPE_DEFAULT', $lng->txt("search_off"));
571  $this->tpl->setVariable("ARR_IMGT", ilGlyphGUI::get(ilGlyphGUI::CARET));
572  $this->tpl->setVariable("TXT_FILTER_BY_TYPE", $lng->txt("search_filter_by_type"));
573  $this->tpl->setVariable('FORM', $this->form->getHTML());
574  $this->tpl->parseCurrentBlock();
575  }
576 
577  // search area form
578  $this->tpl->setVariable('SEARCH_AREA_FORM', $this->getSearchAreaForm()->getHTML());
579  $this->tpl->setVariable("TXT_CHANGE", $lng->txt("change"));
580 
581  if (ilSearchSettings::getInstance()->isDateFilterEnabled()) {
582  // begin-patch creation_date
583  $this->tpl->setVariable('TXT_FILTER_BY_CDATE', $this->lng->txt('search_filter_cd'));
584  $this->tpl->setVariable('TXT_CD_OFF', $this->lng->txt('search_off'));
585  $this->tpl->setVariable('TXT_CD_ON', $this->lng->txt('search_on'));
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.
static get($a_glyph, $a_text="")
Get glyph html.
global $DIC
Definition: goto.php:24
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 341 of file class.ilLuceneSearchGUI.php.

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

342  {
343  $form = $this->getSearchAreaForm();
344 
345  $this->root_node = $form->getItemByPostVar('area')->getValue();
346  $this->search_cache->setRoot($this->root_node);
347  $this->search_cache->save();
348  $this->search_cache->deleteCachedEntries();
349 
350  include_once './Services/Object/classes/class.ilSubItemListGUI.php';
352 
353  $this->performSearch();
354  }
getSearchAreaForm()
Init standard search form.
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:

Field Documentation

◆ $ilTabs

ilLuceneSearchGUI::$ilTabs
protected

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

Referenced by __construct().


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