ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilLikeMetaDataSearch.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2001 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
35include_once 'Services/Search/classes/class.ilMetaDataSearch.php';
36
38{
39
40 // Private
42 {
43 global $ilDB;
44
45 $concat = ' keyword ';
46 $where = " WHERE (";
47 $counter = 0;
48 foreach($this->query_parser->getQuotedWords() as $word)
49 {
50 if($counter++)
51 {
52 $where .= "OR";
53 }
54 $where .= $ilDB->like($concat,'text','%'.$word.'%');
55 #$where .= $concat;
56 #$where .= (" LIKE ('%".$word."%')");
57 }
58 return $where.') ';
59 }
60
62 {
63 global $ilDB;
64
65 $concat = ' entity ';
66 $where = " WHERE (";
67 $counter = 0;
68 foreach($this->query_parser->getQuotedWords() as $word)
69 {
70 if($counter++)
71 {
72 $where .= "OR";
73 }
74 #$where .= $concat;
75 #$where .= (" LIKE ('%".$word."%')");
76 $where .= $ilDB->like($concat,'text','%'.$word.'%');
77 }
78 return $where.') ';
79 }
81 {
82 global $ilDB;
83
84 /*
85 $concat = ' CONCAT(title,coverage) '; // broken if coverage is null
86 // DONE: fix coverage search
87 $concat = ' title ';
88 */
89
90 $concat = $ilDB->concat(
91 array(
92 array('title','text'),
93 array('coverage','text')));
94
95
96 $where = " WHERE (";
97 $counter = 0;
98 foreach($this->query_parser->getQuotedWords() as $word)
99 {
100 if($counter++)
101 {
102 $where .= "OR";
103 }
104 #$where .= $concat;
105 #$where .= (" LIKE ('%".$word."%')");
106 $where .= $ilDB->like($concat,'text','%'.$word.'%');
107 }
108 return $where.' )';
109 }
110
112 {
113 global $ilDB;
114
115 $concat = ' description ';
116 $where = " WHERE (";
117 $counter = 0;
118 foreach($this->query_parser->getQuotedWords() as $word)
119 {
120 if($counter++)
121 {
122 $where .= "OR";
123 }
124 #$where .= $concat;
125 #$where .= (" LIKE ('%".$word."%')");
126 $where .= $ilDB->like($concat,'text','%'.$word.'%');
127 }
128 return $where.') ';
129 }
130}
131?>
An exception for terminatinating execution or to throw for unit testing.
$counter
global $ilDB