PagedProvider.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCP\Search;
  8. /**
  9. * Provides a template for search functionality throughout ownCloud;
  10. * @since 8.0.0
  11. * @deprecated 20.0.0
  12. */
  13. abstract class PagedProvider extends Provider {
  14. /**
  15. * show all results
  16. * @since 8.0.0
  17. * @deprecated 20.0.0
  18. */
  19. public const SIZE_ALL = 0;
  20. /**
  21. * Constructor
  22. * @param array $options
  23. * @since 8.0.0
  24. * @deprecated 20.0.0
  25. */
  26. public function __construct($options) {
  27. parent::__construct($options);
  28. }
  29. /**
  30. * Search for $query
  31. * @param string $query
  32. * @return array An array of OCP\Search\Result's
  33. * @since 8.0.0
  34. * @deprecated 20.0.0
  35. */
  36. public function search($query) {
  37. // old apps might assume they get all results, so we use SIZE_ALL
  38. return $this->searchPaged($query, 1, self::SIZE_ALL);
  39. }
  40. /**
  41. * Search for $query
  42. * @param string $query
  43. * @param int $page pages start at page 1
  44. * @param int $size 0 = SIZE_ALL
  45. * @return array An array of OCP\Search\Result's
  46. * @since 8.0.0
  47. * @deprecated 20.0.0
  48. */
  49. abstract public function searchPaged($query, $page, $size);
  50. }