24 include_once
'./Services/Search/classes/class.ilSearchSettings.php';
25 include_once
'./Services/Search/classes/class.ilSearchBaseGUI.php';
26 include_once
'./Services/Search/classes/Lucene/class.ilLuceneAdvancedSearchFields.php';
27 include_once
'./Services/PersonalDesktop/interfaces/interface.ilDesktopItemHandling.php';
28 include_once
'./Services/Administration/interfaces/interface.ilAdministrationCommandHandling.php';
69 $ilBench->start(
'Lucene',
'0900_executeCommand');
70 $next_class = $this->ctrl->getNextClass($this);
71 $cmd = $this->ctrl->getCmd();
76 case "ilpropertyformgui":
81 $ilCtrl->setReturn($this,
'storeRoot');
82 $ilCtrl->forwardCommand($form);
85 case 'ilobjectcopygui':
86 include_once
'./Services/Object/classes/class.ilObjectCopyGUI.php';
88 $this->ctrl->forwardCommand($cp);
95 $cmd =
"showSavedResults";
100 $ilBench->stop(
'Lucene',
'0900_executeCommand');
121 if(count($this->search_cache))
135 return (array) $this->search_cache->getItemFilter();
145 return (array) $this->search_cache->getMimeFilter();
155 include_once
'./Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
157 $qp->parseAutoWildcard();
161 $this->search_cache->setRoot((
int)
$_POST[
'root_id']);
163 $this->search_cache->save();
176 if(!strlen($this->search_cache->getQuery()))
182 include_once
'./Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
183 include_once
'./Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
190 include_once
'./Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
192 $filter->loadFromDb();
195 $searcher->highlight($filter->getResultObjIds());
197 include_once
'./Services/Search/classes/class.ilSearchResultPresentation.php';
199 $presentation->setResults($filter->getResultIds());
201 $presentation->setSearcher($searcher);
204 $this->
addPager($filter,
'max_page');
206 $presentation->setPreviousNext($this->prev_link, $this->next_link);
210 if($presentation->render())
212 $this->tpl->setVariable(
'SEARCH_RESULTS',$presentation->getHTML(
true));
214 elseif(strlen($this->search_cache->getQuery()))
216 ilUtil::sendInfo(sprintf($this->lng->txt(
'search_no_match_hint'),$qp->getQuery()));
226 if(!$this->form->checkInput())
228 $this->search_cache->deleteCachedEntries();
230 include_once
'./Services/Object/classes/class.ilSubItemListGUI.php';
237 $this->search_cache->deleteCachedEntries();
240 include_once
'./Services/Object/classes/class.ilSubItemListGUI.php';
259 foreach((array) $this->search_cache->getItemFilter() as $obj => $value)
263 $filter_query .=
'+( ';
267 $filter_query .=
'OR';
269 $filter_query .= (
' '. (string) $filter_settings[$obj][
'filter'].
' ');
271 $filter_query .=
') ';
278 foreach($this->search_cache->getMimeFilter() as $mime => $value)
282 $mime_query .=
'+( ';
288 $mime_query .= (
' '. (string) $filter_settings[$mime][
'filter'].
' ');
292 $filter_query = $filter_query .
' '. $mime_query;
294 include_once
'./Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
295 include_once
'./Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
302 include_once
'./Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
303 include_once
'./Services/Search/classes/Lucene/class.ilLucenePathFilter.php';
306 $filter->setCandidates($searcher->getResult());
309 if($filter->getResultObjIds()) {
310 $searcher->highlight($filter->getResultObjIds());
316 include_once
'./Services/Search/classes/class.ilSearchResultPresentation.php';
318 $presentation->setResults($filter->getResultIds());
319 $presentation->setSearcher($searcher);
322 $ilBench->start(
'Lucene',
'1500_fo');
323 $this->
addPager($filter,
'max_page');
324 $ilBench->stop(
'Lucene',
'1500_fo');
326 $presentation->setPreviousNext($this->prev_link, $this->next_link);
328 if($presentation->render())
330 $this->tpl->setVariable(
'SEARCH_RESULTS',$presentation->getHTML(
true));
334 ilUtil::sendInfo(sprintf($this->lng->txt(
'search_no_match_hint'),$this->search_cache->getQuery()));
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();
350 include_once
'./Services/Object/classes/class.ilSubItemListGUI.php';
363 $ilHelp->setScreenIdComponent(
"src_luc");
365 $this->tabs_gui->addTarget(
'search',$this->ctrl->getLinkTarget($this));
369 $this->tabs_gui->addTarget(
'search_user',$this->ctrl->getLinkTargetByClass(
'illuceneusersearchgui'));
374 $this->tabs_gui->addTarget(
'search_advanced',$this->ctrl->getLinkTargetByClass(
'illuceneAdvancedSearchgui'));
377 $this->tabs_gui->setTabActive(
'search');
391 include_once(
'Services/Search/classes/class.ilUserSearchCache.php');
394 if((
int)
$_GET[
'page_number'])
396 $this->search_cache->setResultPageNumber((
int) $_GET[
'page_number']);
401 if(
$_POST[
'item_filter_enabled'])
406 if(
$_POST[
'filter_type'][$type])
408 $filtered[$type] = 1;
411 $this->search_cache->setItemFilter($filtered);
417 if(
$_POST[
'filter_type'][$type])
422 $this->search_cache->setMimeFilter($mime);
427 $this->search_cache->setItemFilter(array());
428 $this->search_cache->setMimeFilter(array());
442 $adm_view_cmp = $adm_cmds = $creation_selector = $adm_view =
false;
445 if ((count($this->admin_panel_commands) > 0))
447 foreach($this->admin_panel_commands as
$cmd)
449 $this->tpl->setCurrentBlock(
"lucene_admin_panel_cmd");
450 $this->tpl->setVariable(
"LUCENE_PANEL_CMD", $cmd[
"cmd"]);
451 $this->tpl->setVariable(
"LUCENE_TXT_PANEL_CMD", $cmd[
"txt"]);
452 $this->tpl->parseCurrentBlock();
459 $this->tpl->setCurrentBlock(
"lucene_adm_view_components");
461 $this->tpl->setVariable(
"LUCENE_ADM_ALT_ARROW", $lng->txt(
"actions"));
462 $this->tpl->parseCurrentBlock();
463 $adm_view_cmp =
true;
467 if (is_array($this->admin_view_button))
469 if (is_array($this->admin_view_button))
471 $this->tpl->setCurrentBlock(
"lucene_admin_button");
472 $this->tpl->setVariable(
"LUCENE_ADMIN_MODE_LINK",
473 $this->admin_view_button[
"link"]);
474 $this->tpl->setVariable(
"LUCENE_TXT_ADMIN_MODE",
475 $this->admin_view_button[
"txt"]);
476 $this->tpl->parseCurrentBlock();
478 $this->tpl->setCurrentBlock(
"lucene_admin_view");
479 $this->tpl->parseCurrentBlock();
484 if (is_array($this->creation_selector))
486 $this->tpl->setCurrentBlock(
"lucene_add_commands");
489 $this->tpl->setVariable(
"LUCENE_ADD_COM_WIDTH",
'width="1"');
491 $this->tpl->setVariable(
"LUCENE_SELECT_OBJTYPE_REPOS",
492 $this->creation_selector[
"options"]);
493 $this->tpl->setVariable(
"LUCENE_BTN_NAME_REPOS",
494 $this->creation_selector[
"command"]);
495 $this->tpl->setVariable(
"LUCENE_TXT_ADD_REPOS",
496 $this->creation_selector[
"txt"]);
497 $this->tpl->parseCurrentBlock();
498 $creation_selector =
true;
500 if ($adm_view || $creation_selector)
502 $this->tpl->setCurrentBlock(
"lucene_adm_panel");
505 $this->tpl->setVariable(
"LUCENE_ADM_TBL_WIDTH",
'width:"100%";');
507 $this->tpl->parseCurrentBlock();
516 $this->admin_panel_commands[] =
517 array(
"cmd" => $a_cmd,
"txt" => $a_txt);
525 $this->admin_view_button =
526 array(
"link" => $a_link,
"txt" => $a_txt);
531 $this->page_form_action = $a_action;
542 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.lucene_search.html',
'Services/Search');
545 include_once(
"./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php");
547 $this->tpl->addJavascript(
"./Services/Search/js/Search.js");
549 include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
551 $this->tpl->setVariable(
"FORM_ACTION", $ilCtrl->getFormAction($this,
'performSearch'));
553 include_once(
"./Services/UIComponent/Button/classes/class.ilSubmitButton.php");
555 $btn->setCommand(
"performSearch");
556 $btn->setCaption(
"search");
557 $this->tpl->setVariable(
"SUBMIT_BTN",$btn->render());
558 $this->tpl->setVariable(
"TXT_OPTIONS", $lng->txt(
"options"));
560 $this->tpl->setVariable(
"TXT_COMBINATION", $lng->txt(
"search_term_combination"));
562 $this->tpl->setVariable(
"TXT_AREA", $lng->txt(
"search_area"));
566 $this->tpl->setCurrentBlock(
"type_sel");
567 $this->tpl->setVariable(
'TXT_TYPE_DEFAULT',$lng->txt(
"search_off"));
569 $this->tpl->setVariable(
"TXT_FILTER_BY_TYPE", $lng->txt(
"search_filter_by_type"));
570 $this->tpl->setVariable(
'FORM',$this->form->getHTML());
571 $this->tpl->parseCurrentBlock();
575 $this->tpl->setVariable(
'SEARCH_AREA_FORM', $this->
getSearchAreaForm()->getHTML());
576 $this->tpl->setVariable(
"TXT_CHANGE", $lng->txt(
"change"));