ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilAdvancedMDSearch.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23
33include_once 'Services/Search/classes/class.ilAbstractSearch.php';
34
36{
37 protected $definition;
38 protected $adt;
39
47 public function __construct($query_parser)
48 {
49 parent::__construct($query_parser);
50 }
51
59 public function setDefinition($a_def)
60 {
61 $this->definition = $a_def;
62 }
63
70 public function getDefinition()
71 {
72 return $this->definition;
73 }
74
82 public function setSearchElement($a_adt)
83 {
84 $this->adt = $a_adt;
85 }
86
93 public function getSearchElement()
94 {
95 return $this->adt;
96 }
97
105 public function performSearch()
106 {
107 $this->query_parser->parse();
108
109 $locate = null;
110 $parser_value = $this->getDefinition()->getSearchQueryParserValue($this->getSearchElement());
111 if ($parser_value) {
112 $this->setFields(array("value"));
113 $locate = $this->__createLocateString();
114 }
115
116 $search_type = strtolower(substr(get_class($this), 12, -6));
117
118 $res_field = $this->getDefinition()->searchObjects(
119 $this->getSearchElement(),
120 $this->query_parser,
121 $this->getFilter(),
122 $locate,
123 $search_type
124 );
125
126 if (is_array($res_field)) {
127 foreach ($res_field as $row) {
128 $found = is_array($row["found"]) ? $row["found"] : array();
129 $this->search_result->addEntry($row["obj_id"], $row["type"], $found);
130 }
132 }
133 }
134}
An exception for terminatinating execution or to throw for unit testing.
__createLocateString()
build locate string in case of AND search
setFields($a_fields)
Set fields to search.
getFilter()
get object type to search in
getSearchElement()
get search element
__construct($query_parser)
Constructor.
setDefinition($a_def)
set Definition
setSearchElement($a_adt)
set search element
$row