You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
2.2 KiB

3 years ago
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright 2020 Christoph Wurst <christoph@winzerhof-wurst.at>
  5. *
  6. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  7. * @author Joas Schilling <coding@schilljs.com>
  8. *
  9. * @license GNU AGPL version 3 or any later version
  10. *
  11. * This program is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU Affero General Public License as
  13. * published by the Free Software Foundation, either version 3 of the
  14. * License, or (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  23. *
  24. */
  25. namespace OCP\Search;
  26. /**
  27. * The query objected passed into \OCP\Search\IProvider::search
  28. *
  29. * This mainly wraps the search term, but will ensure that Nextcloud can add new
  30. * optional properties to a search request without having break the interface of
  31. * \OCP\Search\IProvider::search.
  32. *
  33. * @see \OCP\Search\IProvider::search
  34. *
  35. * @since 20.0.0
  36. */
  37. interface ISearchQuery {
  38. /**
  39. * @since 20.0.0
  40. */
  41. public const SORT_DATE_DESC = 1;
  42. /**
  43. * Get the user-entered search term to find matches for
  44. *
  45. * @return string the search term
  46. * @since 20.0.0
  47. */
  48. public function getTerm(): string;
  49. /**
  50. * Get the sort order of results as defined as SORT_* constants on this interface
  51. *
  52. * @return int
  53. * @since 20.0.0
  54. */
  55. public function getSortOrder(): int;
  56. /**
  57. * Get the number of items to return for a paginated result
  58. *
  59. * @return int
  60. * @see \OCP\Search\IProvider for details
  61. * @since 20.0.0
  62. */
  63. public function getLimit(): int;
  64. /**
  65. * Get the app-specific cursor of the tail of the previous result entries
  66. *
  67. * @return int|string|null
  68. * @see \OCP\Search\IProvider for details
  69. * @since 20.0.0
  70. */
  71. public function getCursor();
  72. /**
  73. * @return string
  74. * @since 20.0.0
  75. */
  76. public function getRoute(): string;
  77. /**
  78. * @return array
  79. * @since 20.0.0
  80. */
  81. public function getRouteParameters(): array;
  82. }