ILIAS  release_8 Revision v8.24
class.ilLikeMetaDataSearch.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4/*
5 +-----------------------------------------------------------------------------+
6 | ILIAS open source |
7 +-----------------------------------------------------------------------------+
8 | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
9 | |
10 | This program is free software; you can redistribute it and/or |
11 | modify it under the terms of the GNU General Public License |
12 | as published by the Free Software Foundation; either version 2 |
13 | of the License, or (at your option) any later version. |
14 | |
15 | This program is distributed in the hope that it will be useful, |
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 | GNU General Public License for more details. |
19 | |
20 | You should have received a copy of the GNU General Public License |
21 | along with this program; if not, write to the Free Software |
22 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
23 +-----------------------------------------------------------------------------+
24*/
25
38{
39 // Private
40 public function __createKeywordWhereCondition(): string
41 {
42 $concat = ' keyword ';
43 $where = " WHERE (";
44 $counter = 0;
45 foreach ($this->query_parser->getQuotedWords() as $word) {
46 if ($counter++) {
47 $where .= "OR";
48 }
49 $where .= $this->db->like($concat, 'text', '%' . $word . '%');
50 #$where .= $concat;
51 #$where .= (" LIKE ('%".$word."%')");
52 }
53 return $where . ') ';
54 }
55
56 public function __createContributeWhereCondition(): string
57 {
58 $concat = ' entity ';
59 $where = " WHERE (";
60 $counter = 0;
61 foreach ($this->query_parser->getQuotedWords() as $word) {
62 if ($counter++) {
63 $where .= "OR";
64 }
65 #$where .= $concat;
66 #$where .= (" LIKE ('%".$word."%')");
67 $where .= $this->db->like($concat, 'text', '%' . $word . '%');
68 }
69 return $where . ') ';
70 }
71 public function __createTitleWhereCondition(): string
72 {
73
74 /*
75 $concat = ' CONCAT(title,coverage) '; // broken if coverage is null
76 // DONE: fix coverage search
77 $concat = ' title ';
78 */
79
80 $concat = $this->db->concat(
81 array(
82 array('title','text'),
83 array('coverage','text'))
84 );
85
86
87 $where = " WHERE (";
88 $counter = 0;
89 foreach ($this->query_parser->getQuotedWords() as $word) {
90 if ($counter++) {
91 $where .= "OR";
92 }
93 #$where .= $concat;
94 #$where .= (" LIKE ('%".$word."%')");
95 $where .= $this->db->like($concat, 'text', '%' . $word . '%');
96 }
97 return $where . ' )';
98 }
99
100 public function __createDescriptionWhereCondition(): string
101 {
102 $concat = ' description ';
103 $where = " WHERE (";
104 $counter = 0;
105 foreach ($this->query_parser->getQuotedWords() as $word) {
106 if ($counter++) {
107 $where .= "OR";
108 }
109 #$where .= $concat;
110 #$where .= (" LIKE ('%".$word."%')");
111 $where .= $this->db->like($concat, 'text', '%' . $word . '%');
112 }
113 return $where . ') ';
114 }
115}