ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilLikeMetaDataSearch.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
31{
32 // Private
33 public function __createKeywordWhereCondition(): string
34 {
35 $concat = ' keyword ';
36 $where = " WHERE (";
37 $counter = 0;
38 foreach ($this->query_parser->getQuotedWords() as $word) {
39 if ($counter++) {
40 $where .= "OR";
41 }
42 $where .= $this->db->like($concat, 'text', '%' . $word . '%');
43 #$where .= $concat;
44 #$where .= (" LIKE ('%".$word."%')");
45 }
46 return $where . ') ';
47 }
48
49 public function __createContributeWhereCondition(): string
50 {
51 $concat = ' entity ';
52 $where = " WHERE (";
53 $counter = 0;
54 foreach ($this->query_parser->getQuotedWords() as $word) {
55 if ($counter++) {
56 $where .= "OR";
57 }
58 #$where .= $concat;
59 #$where .= (" LIKE ('%".$word."%')");
60 $where .= $this->db->like($concat, 'text', '%' . $word . '%');
61 }
62 return $where . ') ';
63 }
64 public function __createTitleWhereCondition(): string
65 {
66 /*
67 $concat = ' CONCAT(title,coverage) '; // broken if coverage is null
68 // DONE: fix coverage search
69 $concat = ' title ';
70 */
71
72 $concat = $this->db->concat(
73 array(
74 array('title','text'),
75 array('coverage','text'))
76 );
77
78
79 $where = " WHERE (";
80 $counter = 0;
81 foreach ($this->query_parser->getQuotedWords() as $word) {
82 if ($counter++) {
83 $where .= "OR";
84 }
85 #$where .= $concat;
86 #$where .= (" LIKE ('%".$word."%')");
87 $where .= $this->db->like($concat, 'text', '%' . $word . '%');
88 }
89 return $where . ' )';
90 }
91
92 public function __createDescriptionWhereCondition(): string
93 {
94 $concat = ' description ';
95 $where = " WHERE (";
96 $counter = 0;
97 foreach ($this->query_parser->getQuotedWords() as $word) {
98 if ($counter++) {
99 $where .= "OR";
100 }
101 #$where .= $concat;
102 #$where .= (" LIKE ('%".$word."%')");
103 $where .= $this->db->like($concat, 'text', '%' . $word . '%');
104 }
105 return $where . ') ';
106 }
107}
$counter