1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
|
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* FullTextSearch - Full text search framework for Nextcloud |
7
|
|
|
* |
8
|
|
|
* This file is licensed under the Affero General Public License version 3 or |
9
|
|
|
* later. See the COPYING file. |
10
|
|
|
* |
11
|
|
|
* @author Maxence Lange <[email protected]> |
12
|
|
|
* @copyright 2018 |
13
|
|
|
* @license GNU AGPL version 3 or any later version |
14
|
|
|
* |
15
|
|
|
* This program is free software: you can redistribute it and/or modify |
16
|
|
|
* it under the terms of the GNU Affero General Public License as |
17
|
|
|
* published by the Free Software Foundation, either version 3 of the |
18
|
|
|
* License, or (at your option) any later version. |
19
|
|
|
* |
20
|
|
|
* This program is distributed in the hope that it will be useful, |
21
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
22
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
23
|
|
|
* GNU Affero General Public License for more details. |
24
|
|
|
* |
25
|
|
|
* You should have received a copy of the GNU Affero General Public License |
26
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
27
|
|
|
* |
28
|
|
|
*/ |
29
|
|
|
|
30
|
|
|
|
31
|
|
|
namespace OCA\FullTextSearch\Search; |
32
|
|
|
|
33
|
|
|
|
34
|
|
|
use OCP\Search\SearchResultEntry; |
35
|
|
|
|
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Class SearchResultEntry |
39
|
|
|
* |
40
|
|
|
* @package OCA\FullTextSearch\Search |
41
|
|
|
*/ |
42
|
|
|
class UnifiedSearchResult extends SearchResultEntry { |
43
|
|
|
|
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* UnifiedSearchResult constructor. |
47
|
|
|
* |
48
|
|
|
* @param string $thumbnailUrl |
49
|
|
|
* @param string $title |
50
|
|
|
* @param string $subline |
51
|
|
|
* @param string $resourceUrl |
52
|
|
|
* @param string $icon |
53
|
|
|
* @param bool $rounded |
54
|
|
|
*/ |
55
|
|
|
public function __construct( |
56
|
|
|
string $thumbnailUrl = '', string $title = '', string $subline = '', string $resourceUrl = '', |
57
|
|
|
string $icon = '', |
58
|
|
|
bool $rounded = false |
59
|
|
|
) { |
60
|
|
|
parent::__construct($thumbnailUrl, $title, $subline, $resourceUrl, $icon, $rounded); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @return string |
66
|
|
|
*/ |
67
|
|
|
public function getThumbnailUrl(): string { |
68
|
|
|
return $this->thumbnailUrl; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @param string $thumbnailUrl |
73
|
|
|
* |
74
|
|
|
* @return UnifiedSearchResult |
75
|
|
|
*/ |
76
|
|
|
public function setThumbnailUrl(string $thumbnailUrl): self { |
77
|
|
|
$this->thumbnailUrl = $thumbnailUrl; |
78
|
|
|
|
79
|
|
|
return $this; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @return string |
85
|
|
|
*/ |
86
|
|
|
public function getTitle(): string { |
87
|
|
|
return $this->title; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @param string $title |
92
|
|
|
* |
93
|
|
|
* @return UnifiedSearchResult |
94
|
|
|
*/ |
95
|
|
|
public function setTitle(string $title): self { |
96
|
|
|
$this->title = $title; |
97
|
|
|
|
98
|
|
|
return $this; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* @return string |
104
|
|
|
*/ |
105
|
|
|
public function getSubline(): string { |
106
|
|
|
return $this->subline; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @param string $subline |
111
|
|
|
* |
112
|
|
|
* @return UnifiedSearchResult |
113
|
|
|
*/ |
114
|
|
|
public function setSubline(string $subline): self { |
115
|
|
|
$this->subline = $subline; |
116
|
|
|
|
117
|
|
|
return $this; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* @return string |
123
|
|
|
*/ |
124
|
|
|
public function getResourceUrl(): string { |
125
|
|
|
return $this->resourceUrl; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* @param string $resourceUrl |
130
|
|
|
* |
131
|
|
|
* @return UnifiedSearchResult |
132
|
|
|
*/ |
133
|
|
|
public function setResourceUrl(string $resourceUrl): self { |
134
|
|
|
$this->resourceUrl = $resourceUrl; |
135
|
|
|
|
136
|
|
|
return $this; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* @return string |
142
|
|
|
*/ |
143
|
|
|
public function getIcon(): string { |
144
|
|
|
return $this->icon; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* @param string $icon |
149
|
|
|
* |
150
|
|
|
* @return UnifiedSearchResult |
151
|
|
|
*/ |
152
|
|
|
public function setIcon(string $icon): self { |
153
|
|
|
$this->icon = $icon; |
154
|
|
|
|
155
|
|
|
return $this; |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* @return bool |
161
|
|
|
*/ |
162
|
|
|
public function isRounded(): bool { |
163
|
|
|
return $this->rounded; |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* @param bool $rounded |
168
|
|
|
* |
169
|
|
|
* @return UnifiedSearchResult |
170
|
|
|
*/ |
171
|
|
|
public function setRounded(bool $rounded): self { |
172
|
|
|
$this->rounded = $rounded; |
173
|
|
|
|
174
|
|
|
return $this; |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
|