2014-12-11 06:58:22 -05:00
|
|
|
<?php
|
2024-05-23 03:26:56 -04:00
|
|
|
|
2014-12-11 06:58:22 -05:00
|
|
|
/**
|
2024-05-23 03:26:56 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2014-12-11 06:58:22 -05:00
|
|
|
*/
|
|
|
|
|
namespace OCP\Search;
|
|
|
|
|
|
|
|
|
|
/**
|
2015-04-16 11:00:08 -04:00
|
|
|
* Provides a template for search functionality throughout ownCloud;
|
|
|
|
|
* @since 8.0.0
|
2020-06-22 04:57:40 -04:00
|
|
|
* @deprecated 20.0.0
|
2014-12-11 06:58:22 -05:00
|
|
|
*/
|
|
|
|
|
abstract class PagedProvider extends Provider {
|
2014-12-30 18:11:58 -05:00
|
|
|
/**
|
|
|
|
|
* show all results
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 8.0.0
|
2020-06-22 04:57:40 -04:00
|
|
|
* @deprecated 20.0.0
|
2014-12-30 18:11:58 -05:00
|
|
|
*/
|
2020-04-10 10:54:27 -04:00
|
|
|
public const SIZE_ALL = 0;
|
2014-12-30 18:11:58 -05:00
|
|
|
|
2014-12-11 06:58:22 -05:00
|
|
|
/**
|
|
|
|
|
* Constructor
|
|
|
|
|
* @param array $options
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 8.0.0
|
2020-06-22 04:57:40 -04:00
|
|
|
* @deprecated 20.0.0
|
2014-12-11 06:58:22 -05:00
|
|
|
*/
|
|
|
|
|
public function __construct($options) {
|
2017-07-22 15:10:16 -04:00
|
|
|
parent::__construct($options);
|
2014-12-11 06:58:22 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Search for $query
|
|
|
|
|
* @param string $query
|
|
|
|
|
* @return array An array of OCP\Search\Result's
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 8.0.0
|
2020-06-22 04:57:40 -04:00
|
|
|
* @deprecated 20.0.0
|
2014-12-11 06:58:22 -05:00
|
|
|
*/
|
|
|
|
|
public function search($query) {
|
2014-12-30 18:11:58 -05:00
|
|
|
// old apps might assume they get all results, so we use SIZE_ALL
|
2017-07-19 13:44:10 -04:00
|
|
|
return $this->searchPaged($query, 1, self::SIZE_ALL);
|
2014-12-11 06:58:22 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Search for $query
|
|
|
|
|
* @param string $query
|
2014-12-17 12:49:39 -05:00
|
|
|
* @param int $page pages start at page 1
|
2016-02-18 04:50:00 -05:00
|
|
|
* @param int $size 0 = SIZE_ALL
|
2014-12-11 06:58:22 -05:00
|
|
|
* @return array An array of OCP\Search\Result's
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 8.0.0
|
2020-06-22 04:57:40 -04:00
|
|
|
* @deprecated 20.0.0
|
2014-12-11 06:58:22 -05:00
|
|
|
*/
|
2014-12-17 12:49:39 -05:00
|
|
|
abstract public function searchPaged($query, $page, $size);
|
2014-12-11 06:58:22 -05:00
|
|
|
}
|