ISearchQuery.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\Search;
  8. /**
  9. * The query objected passed into \OCP\Search\IProvider::search
  10. *
  11. * This mainly wraps the search term, but will ensure that Nextcloud can add new
  12. * optional properties to a search request without having break the interface of
  13. * \OCP\Search\IProvider::search.
  14. *
  15. * @see \OCP\Search\IProvider::search
  16. *
  17. * @since 20.0.0
  18. */
  19. interface ISearchQuery {
  20. /**
  21. * @since 20.0.0
  22. */
  23. public const SORT_DATE_DESC = 1;
  24. /**
  25. * Get the user-entered search term to find matches for
  26. *
  27. * @return string the search term
  28. * @since 20.0.0
  29. */
  30. public function getTerm(): string;
  31. /**
  32. * Get a single request filter
  33. *
  34. * @since 28.0.0
  35. */
  36. public function getFilter(string $name): ?IFilter;
  37. /**
  38. * Get request filters
  39. *
  40. * @since 28.0.0
  41. */
  42. public function getFilters(): IFilterCollection;
  43. /**
  44. * Get the sort order of results as defined as SORT_* constants on this interface
  45. *
  46. * @return int
  47. * @since 20.0.0
  48. */
  49. public function getSortOrder(): int;
  50. /**
  51. * Get the number of items to return for a paginated result
  52. *
  53. * @return int
  54. * @see \OCP\Search\IProvider for details
  55. * @since 20.0.0
  56. */
  57. public function getLimit(): int;
  58. /**
  59. * Get the app-specific cursor of the tail of the previous result entries
  60. *
  61. * @return int|string|null
  62. * @see \OCP\Search\IProvider for details
  63. * @since 20.0.0
  64. */
  65. public function getCursor();
  66. /**
  67. * @return string
  68. * @since 20.0.0
  69. */
  70. public function getRoute(): string;
  71. /**
  72. * @return array
  73. * @since 20.0.0
  74. */
  75. public function getRouteParameters(): array;
  76. }