1<?php
2/**
3 * @author Andrew Brown <andrew@casabrown.com>
4 * @author Bart Visscher <bartv@thisnet.nl>
5 * @author Jakob Sack <mail@jakobsack.de>
6 * @author Jörn Friedrich Dreyer <jfd@butonic.de>
7 * @author Morris Jobke <hey@morrisjobke.de>
8 * @author Thomas Müller <thomas.mueller@tmit.eu>
9 *
10 * @copyright Copyright (c) 2018, ownCloud GmbH
11 * @license AGPL-3.0
12 *
13 * This code is free software: you can redistribute it and/or modify
14 * it under the terms of the GNU Affero General Public License, version 3,
15 * as published by the Free Software Foundation.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Affero General Public License for more details.
21 *
22 * You should have received a copy of the GNU Affero General Public License, version 3,
23 * along with this program.  If not, see <http://www.gnu.org/licenses/>
24 *
25 */
26
27namespace OCP;
28
29/**
30 * Small Interface for Search
31 * @since 7.0.0
32 */
33interface ISearch {
34
35	/**
36	 * Search all providers for $query
37	 * @param string $query
38	 * @param string[] $inApps optionally limit results to the given apps
39	 * @return array An array of OCP\Search\Result's
40	 * @deprecated 8.0.0 use searchPaged() with page and size
41	 * @since 7.0.0 - parameter $inApps was added in 8.0.0
42	 */
43	public function search($query, array $inApps = []);
44
45	/**
46	 * Search all providers for $query
47	 * @param string $query
48	 * @param string[] $inApps optionally limit results to the given apps
49	 * @param int $page pages start at page 1
50	 * @param int $size
51	 * @return array An array of OCP\Search\Result's
52	 * @since 8.0.0
53	 */
54	public function searchPaged($query, array $inApps = [], $page = 1, $size = 30);
55
56	/**
57	 * Register a new search provider to search with
58	 * @param string $class class name of a OCP\Search\Provider
59	 * @param array $options optional
60	 * @since 7.0.0
61	 */
62	public function registerProvider($class, array $options = []);
63
64	/**
65	 * Remove one existing search provider
66	 * @param string $provider class name of a OCP\Search\Provider
67	 * @since 7.0.0
68	 */
69	public function removeProvider($provider);
70
71	/**
72	 * Remove all registered search providers
73	 * @since 7.0.0
74	 */
75	public function clearProviders();
76}
77