aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/FullTextSearch/Model/ISearchRequest.php
blob: c45a58c8c0ca626ec88dc5b90504f1d304924953 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
<?php

declare(strict_types=1);

/**
 * @copyright 2018
 *
 * @author Maxence Lange <maxence@artificial-owl.com>
 *
 * @license GNU AGPL version 3 or any later version
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 */

namespace OCP\FullTextSearch\Model;

/**
 * Interface ISearchRequest
 *
 * When a search request is initiated, from a request from the front-end or using
 * the IFullTextSearchManager::search() method, FullTextSearch will create a
 * SearchRequest object, based on this interface.
 *
 * The object will be passed to the targeted Content Provider so it can convert
 * search options using available method.
 *
 * The object is then encapsulated in a SearchResult and send to the
 * Search Platform.
 *
 * @since 15.0.0
 *
 *
 * @package OCP\FullTextSearch\Model
 */
interface ISearchRequest {


	/**
	 * Get the maximum number of results to be returns by the Search Platform.
	 *
	 * @since 15.0.0
	 *
	 * @return int
	 */
	public function getSize(): int;


	/**
	 * Get the current page.
	 * Used by pagination.
	 *
	 * @since 15.0.0
	 *
	 * @return int
	 */
	public function getPage(): int;


	/**
	 * Get the author of the request.
	 *
	 * @since 15.0.0
	 *
	 * @return string
	 */
	public function getAuthor(): string;

	/**
	 * Get the searched string.
	 *
	 * @since 15.0.0
	 *
	 * @return string
	 */
	public function getSearch(): string;

	/**
	 * Set the searched string.
	 *
	 * @param string $search
	 *
	 * @since 17.0.0
	 *
	 * @return ISearchRequest
	 */
	public function setSearch(string $search): ISearchRequest;

	/**
	 * Extends the searched string.
	 *
	 * @since 17.0.0
	 *
	 * @param string $search
	 *
	 * @return ISearchRequest
	 */
	public function addSearch(string $search): ISearchRequest;


	/**
	 * Get the value of an option (as string).
	 *
	 * @since 15.0.0
	 *
	 * @param string $option
	 * @param string $default
	 *
	 * @return string
	 */
	public function getOption(string $option, string $default = ''): string;

	/**
	 * Get the value of an option (as array).
	 *
	 * @since 15.0.0
	 *
	 * @param string $option
	 * @param array $default
	 *
	 * @return array
	 */
	public function getOptionArray(string $option, array $default = []): array;


	/**
	 * Limit the search to a part of the document.
	 *
	 * @since 15.0.0
	 *
	 * @param string $part
	 *
	 * @return ISearchRequest
	 */
	public function addPart(string $part): ISearchRequest;

	/**
	 * Limit the search to an array of parts of the document.
	 *
	 * @since 15.0.0
	 *
	 * @param array $parts
	 *
	 * @return ISearchRequest
	 */
	public function setParts(array $parts): ISearchRequest;

	/**
	 * Get the parts the search is limited to.
	 *
	 * @since 15.0.0
	 *
	 * @return array
	 */
	public function getParts(): array;


	/**
	 * Limit the search to a specific meta tag.
	 *
	 * @since 15.0.0
	 *
	 * @param string $tag
	 *
	 * @return ISearchRequest
	 */
	public function addMetaTag(string $tag): ISearchRequest;

	/**
	 * Get the meta tags the search is limited to.
	 *
	 * @since 15.0.0
	 *
	 * @return array
	 */
	public function getMetaTags(): array;

	/**
	 * Limit the search to an array of meta tags.
	 *
	 * @since 15.0.0
	 *
	 * @param array $tags
	 *
	 * @return ISearchRequest
	 */
	public function setMetaTags(array $tags): IsearchRequest;


	/**
	 * Limit the search to a specific sub tag.
	 *
	 * @since 15.0.0
	 *
	 * @param string $source
	 * @param string $tag
	 *
	 * @return ISearchRequest
	 */
	public function addSubTag(string $source, string $tag): ISearchRequest;

	/**
	 * Get the sub tags the search is limited to.
	 *
	 * @since 15.0.0
	 *
	 * @param bool $formatted
	 *
	 * @return array
	 */
	public function getSubTags(bool $formatted): array;

	/**
	 * Limit the search to an array of sub tags.
	 *
	 * @since 15.0.0
	 *
	 * @param array $tags
	 *
	 * @return ISearchRequest
	 */
	public function setSubTags(array $tags): ISearchRequest;


	/**
	 * Limit the search to a specific field of the mapping, using a full string.
	 *
	 * @since 15.0.0
	 *
	 * @param string $field
	 *
	 * @return ISearchRequest
	 */
	public function addLimitField(string $field): ISearchRequest;

	/**
	 * Get the fields the search is limited to.
	 *
	 * @since 15.0.0
	 *
	 * @return array
	 */
	public function getLimitFields(): array;


	/**
	 * Limit the search to a specific field of the mapping, using a wildcard on
	 * the search string.
	 *
	 * @since 15.0.0
	 *
	 * @param string $field
	 *
	 * @return ISearchRequest
	 */
	public function addWildcardField(string $field): ISearchRequest;

	/**
	 * Get the limit to field of the mapping.
	 *
	 * @since 15.0.0
	 *
	 * @return array
	 */
	public function getWildcardFields(): array;


	/**
	 * Filter the results, based on a group of field, using regex
	 *
	 * @since 15.0.0
	 *
	 * @param array $filters
	 *
	 * @return ISearchRequest
	 */
	public function addRegexFilters(array $filters): ISearchRequest;

	/**
	 * Get the regex filters the search is limit to.
	 *
	 * @since 15.0.0
	 *
	 * @return array
	 */
	public function getRegexFilters(): array;


	/**
	 * Filter the results, based on a group of field, using wildcard
	 *
	 * @since 15.0.0
	 *
	 * @param array $filter
	 *
	 * @return ISearchRequest
	 */
	public function addWildcardFilter(array $filter): ISearchRequest;

	/**
	 * Get the wildcard filters the search is limit to.
	 *
	 * @since 15.0.0
	 *
	 * @return array
	 */
	public function getWildcardFilters(): array;


	/**
	 * Add an extra field to the search.
	 *
	 * @since 15.0.0
	 *
	 * @param string $field
	 *
	 * @return ISearchRequest
	 */
	public function addField(string $field): ISearchRequest;

	/**
	 * Get the list of extra field to search into.
	 *
	 * @since 15.0.0
	 *
	 * @return array
	 */
	public function getFields(): array;



	/**
	 * Add a MUST search on an extra field
	 *
	 * @param ISearchRequestSimpleQuery $query
	 *
	 * @return ISearchRequest
	 * @since 17.0.0
	 */
	public function addSimpleQuery(ISearchRequestSimpleQuery $query): ISearchRequest;


	/**
	 * Get the list of queries on extra field.
	 *
	 * @return ISearchRequestSimpleQuery[]
	 * @since 17.0.0
	 */
	public function getSimpleQueries(): array;
}