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';
68 $ilBench->start(
'Lucene',
'0900_executeCommand');
69 $next_class = $this->ctrl->getNextClass($this);
70 $cmd = $this->ctrl->getCmd();
75 case 'ilobjectcopygui':
76 include_once
'./Services/Object/classes/class.ilObjectCopyGUI.php';
78 $this->ctrl->forwardCommand($cp);
84 $cmd =
"showSavedResults";
89 $ilBench->stop(
'Lucene',
'0900_executeCommand');
107 $GLOBALS[
"tpl"]->setAdminViewButton(
108 $this->ctrl->getLinkTarget($this,
"disableAdministrationPanel"),
109 $this->lng->txt(
"basic_commands"));
111 $GLOBALS[
"tpl"]->addAdminPanelCommand(
"delete",
112 $this->lng->txt(
"delete_selected_items"));
116 $GLOBALS[
"tpl"]->addAdminPanelCommand(
"cut",
117 $this->lng->txt(
"move_selected_items"));
119 $GLOBALS[
"tpl"]->addAdminPanelCommand(
"link",
120 $this->lng->txt(
"link_selected_items"));
124 $GLOBALS[
"tpl"]->addAdminPanelCommand(
"paste",
125 $this->lng->txt(
"paste_clipboard_items"));
126 $GLOBALS[
"tpl"]->addAdminPanelCommand(
"clear",
127 $this->lng->txt(
"clear_clipboard"));
130 elseif($ilUser->getId() != ANONYMOUS_USER_ID)
132 $GLOBALS[
"tpl"]->setAdminViewButton(
133 $this->ctrl->getLinkTarget($this,
"enableAdministrationPanel"),
134 $this->lng->txt(
"all_commands"));
137 $this->ctrl->setParameter($this,
"type",
"");
138 $this->ctrl->setParameter($this,
"item_ref_id",
"");
139 $GLOBALS[
"tpl"]->setPageFormAction($this->ctrl->getFormAction($this));
150 $this->search_cache->setRoot((
int)
$_POST[
'root_id']);
152 $this->search_cache->save();
166 $ilBench->start(
'Lucene',
'1000_savedResults');
167 $ilBench->start(
'Lucene',
'1000_qp');
169 if(!strlen($this->search_cache->getQuery()))
175 include_once
'./Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
176 include_once
'./Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
182 $ilBench->stop(
'Lucene',
'1000_qp');
184 $ilBench->start(
'Lucene',
'1100_lr');
186 include_once
'./Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
189 $ilBench->stop(
'Lucene',
'1100_lr');
192 $ilBench->start(
'Lucene',
'1200_hi');
193 $searcher->highlight(
$filter->getResultObjIds());
194 $ilBench->stop(
'Lucene',
'1200_hi');
196 $ilBench->start(
'Lucene',
'1300_pr');
197 include_once
'./Services/Search/classes/class.ilSearchResultPresentation.php';
199 $presentation->setResults(
$filter->getResultIds());
201 $presentation->setSearcher($searcher);
204 $ilBench->start(
'Lucene',
'1500_fo');
206 $ilBench->stop(
'Lucene',
'1500_fo');
208 $presentation->setPreviousNext($this->prev_link, $this->next_link);
209 $ilBench->stop(
'Lucene',
'1300_pr');
211 $ilBench->start(
'Lucene',
'1400_re');
215 if($presentation->render())
217 $this->tpl->setVariable(
'SEARCH_RESULTS',$presentation->getHTML(
true));
219 elseif(strlen($this->search_cache->getQuery()))
221 ilUtil::sendInfo(sprintf($this->lng->txt(
'search_no_match_hint'),$qp->getQuery()));
223 $ilBench->stop(
'Lucene',
'1400_re');
225 $ilBench->stop(
'Lucene',
'1000_savedResults');
236 if(!$this->form->checkInput())
238 $this->search_cache->deleteCachedEntries();
240 include_once
'./Services/Object/classes/class.ilSubItemListGUI.php';
247 $this->search_cache->deleteCachedEntries();
250 include_once
'./Services/Object/classes/class.ilSubItemListGUI.php';
266 if($this->search_cache->getItemFilter())
269 foreach($this->search_cache->getItemFilter() as $obj => $value)
273 $filter_query .=
'+( ';
277 $filter_query .=
'OR';
279 $filter_query .= (
' '. (string) $filter_settings[$obj][
'filter'].
' ');
281 $filter_query .=
') ';
284 include_once
'./Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
285 include_once
'./Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
292 $ilBench->start(
'Lucene',
'ResultFilter');
293 include_once
'./Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
294 include_once
'./Services/Search/classes/Lucene/class.ilLucenePathFilter.php';
297 $filter->setCandidates($searcher->getResult());
299 $ilBench->stop(
'Lucene',
'ResultFilter');
301 if(
$filter->getResultObjIds()) {
302 $searcher->highlight(
$filter->getResultObjIds());
308 include_once
'./Services/Search/classes/class.ilSearchResultPresentation.php';
310 $presentation->setResults(
$filter->getResultIds());
311 $presentation->setSearcher($searcher);
314 $ilBench->start(
'Lucene',
'1500_fo');
316 $ilBench->stop(
'Lucene',
'1500_fo');
318 $presentation->setPreviousNext($this->prev_link, $this->next_link);
320 if($presentation->render())
322 $this->tpl->setVariable(
'SEARCH_RESULTS',$presentation->getHTML(
true));
326 ilUtil::sendInfo(sprintf($this->lng->txt(
'search_no_match_hint'),$this->search_cache->getQuery()));
331 #$this->fillAdminPanel();
342 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
344 if(is_object($this->form))
350 $this->form->setFormAction($this->ctrl->getFormAction($this,
'search'));
351 $this->form->setTitle($this->lng->txt(
'search'));
352 $this->form->addCommandButton(
'search',$this->lng->txt(
'search'));
354 include_once
'./Services/Search/classes/Form/class.ilLuceneQueryInputGUI.php';
356 $term->
setValue($this->search_cache->getQuery());
358 $term->setMaxLength(255);
359 $term->setRequired(
true);
360 $dsSchema = array(
"resultsList" =>
'response.results',
361 "fields" => array(
'term'));
362 $term->setDataSource($ilCtrl->getLinkTarget($this,
"autoComplete"));
363 $term->setDataSourceSchema($dsSchema);
364 $term->setDataSourceResultFormat($dsFormatCallback);
365 $term->setDataSourceDelimiter($dsDelimiter);
367 $this->form->addItem($term);
371 $tpl =
new ilTemplate(
'tpl.root_selection.html',
true,
true,
'Services/Search');
372 switch($this->search_cache->getRoot())
375 $pathIds = $tree->getPathId($this->search_cache->getRoot(),ROOT_FOLDER_ID);
380 $tpl->touchBlock(
'path_separator');
382 if(($counter % 3) == 0) {
383 $tpl->touchBlock(
'line_break');
385 if($ref_id == ROOT_FOLDER_ID) {
386 $title = $this->lng->txt(
'search_in_magazin');
391 $this->ctrl->setParameter($this,
'root_id',$ref_id);
392 $tpl->setCurrentBlock(
'item');
393 $tpl->setVariable(
'ITEM_LINK',$this->ctrl->getLinkTarget($this,
'selectRoot'));
394 $tpl->setVariable(
'NAME_WITH_DOTS',
$title);
395 $tpl->parseCurrentBlock();
397 $tpl->setVariable(
'LINK_SELECT',$this->ctrl->getLinkTarget($this,
'chooseRoot'));
398 $tpl->setVariable(
'TXT_CHANGE',$this->lng->txt(
'change'));
402 $path->setHTML($tpl->get());
403 $this->form->addItem($path);
407 $currentFilter = $this->search_cache->getItemFilter();
408 if(count($itemFilter))
410 $if =
new ilCheckboxInputGUI($this->lng->txt(
'search_item_filter'),
'item_filter_enabled');
412 $if->setChecked(count($currentFilter));
413 $this->form->addItem($if);
414 foreach($itemFilter as $obj => $def)
417 $ch->setChecked(isset($currentFilter[$obj]));
419 $if->addSubItem($ch);
438 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.search_root_selector.html',
'Services/Search');
440 include_once
'Services/Search/classes/class.ilSearchRootSelector.php';
446 $exp->setExpand(
$_GET[
"search_root_expand"] ?
$_GET[
"search_root_expand"] : $tree->readRootId());
447 $exp->setExpandTarget($this->ctrl->getLinkTarget($this,
'chooseRoot'));
452 $this->tpl->setVariable(
"EXPLORER",$exp->getOutput());
462 $this->search_cache->setRoot((
int)
$_GET[
'root_id']);
463 $this->search_cache->save();
464 $this->search_cache->deleteCachedEntries();
466 include_once
'./Services/Object/classes/class.ilSubItemListGUI.php';
481 $this->tabs_gui->addTarget(
'search',$this->ctrl->getLinkTarget($this));
482 if($this->fields->getActiveFields())
484 $this->tabs_gui->addTarget(
'search_advanced',$this->ctrl->getLinkTargetByClass(
'illuceneAdvancedSearchgui'));
487 $this->tabs_gui->setTabActive(
'search');
501 include_once(
'Services/Search/classes/class.ilUserSearchCache.php');
504 if((
int)
$_GET[
'page_number'])
506 $this->search_cache->setResultPageNumber((
int) $_GET[
'page_number']);
508 if(isset(
$_POST[
'query']))
511 if(
$_POST[
'item_filter_enabled'])
513 $this->search_cache->setItemFilter(
$_POST[
'filter']);
517 $this->search_cache->setItemFilter(array());
531 $adm_view_cmp = $adm_cmds = $creation_selector = $adm_view =
false;
534 if ((count($this->admin_panel_commands) > 0))
536 foreach($this->admin_panel_commands as
$cmd)
538 $this->tpl->setCurrentBlock(
"lucene_admin_panel_cmd");
539 $this->tpl->setVariable(
"LUCENE_PANEL_CMD", $cmd[
"cmd"]);
540 $this->tpl->setVariable(
"LUCENE_TXT_PANEL_CMD", $cmd[
"txt"]);
541 $this->tpl->parseCurrentBlock();
548 $this->tpl->setCurrentBlock(
"lucene_adm_view_components");
550 $this->tpl->setVariable(
"LUCENE_ADM_ALT_ARROW", $lng->txt(
"actions"));
551 $this->tpl->parseCurrentBlock();
552 $adm_view_cmp =
true;
556 if (is_array($this->admin_view_button))
558 if (is_array($this->admin_view_button))
560 $this->tpl->setCurrentBlock(
"lucene_admin_button");
561 $this->tpl->setVariable(
"LUCENE_ADMIN_MODE_LINK",
562 $this->admin_view_button[
"link"]);
563 $this->tpl->setVariable(
"LUCENE_TXT_ADMIN_MODE",
564 $this->admin_view_button[
"txt"]);
565 $this->tpl->parseCurrentBlock();
567 $this->tpl->setCurrentBlock(
"lucene_admin_view");
568 $this->tpl->parseCurrentBlock();
573 if (is_array($this->creation_selector))
575 $this->tpl->setCurrentBlock(
"lucene_add_commands");
578 $this->tpl->setVariable(
"LUCENE_ADD_COM_WIDTH",
'width="1"');
580 $this->tpl->setVariable(
"LUCENE_SELECT_OBJTYPE_REPOS",
581 $this->creation_selector[
"options"]);
582 $this->tpl->setVariable(
"LUCENE_BTN_NAME_REPOS",
583 $this->creation_selector[
"command"]);
584 $this->tpl->setVariable(
"LUCENE_TXT_ADD_REPOS",
585 $this->creation_selector[
"txt"]);
586 $this->tpl->parseCurrentBlock();
587 $creation_selector =
true;
589 if ($adm_view || $creation_selector)
591 $this->tpl->setCurrentBlock(
"lucene_adm_panel");
594 $this->tpl->setVariable(
"LUCENE_ADM_TBL_WIDTH",
'width:"100%";');
596 $this->tpl->parseCurrentBlock();
605 $this->admin_panel_commands[] =
606 array(
"cmd" => $a_cmd,
"txt" => $a_txt);
614 $this->admin_view_button =
615 array(
"link" => $a_link,
"txt" => $a_txt);
620 $this->page_form_action = $a_action;
625 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.lucene_search.html',
'Services/Search');
627 $this->tpl->setVariable(
'SEARCH_TABLE',$this->form->getHTML());