ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
33 include_once 'Services/Search/classes/class.ilAbstractSearch.php';
34 
36 {
37  protected $definition;
38  protected $adt;
39 
47  public function __construct($query_parser)
48  {
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  {
113  $this->setFields(array("value"));
114  $locate = $this->__createLocateString();
115  }
116 
117  $search_type = strtolower(substr(get_class($this), 12, -6));
118 
119  $res_field = $this->getDefinition()->searchObjects($this->getSearchElement(), $this->query_parser, $this->getFilter(), $locate, $search_type);
120  if(is_array($res_field))
121  {
122  foreach($res_field as $row)
123  {
124  $found = is_array($row["found"]) ? $row["found"] : array();
125  $this->search_result->addEntry($row["obj_id"],$row["type"],$found);
126  }
127  return $this->search_result;
128  }
129  }
130 }
131 
132 ?>