ISearchQuery.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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 a single request filter
  51. *
  52. * @since 28.0.0
  53. */
  54. public function getFilter(string $name): ?IFilter;
  55. /**
  56. * Get request filters
  57. *
  58. * @since 28.0.0
  59. */
  60. public function getFilters(): IFilterCollection;
  61. /**
  62. * Get the sort order of results as defined as SORT_* constants on this interface
  63. *
  64. * @return int
  65. * @since 20.0.0
  66. */
  67. public function getSortOrder(): int;
  68. /**
  69. * Get the number of items to return for a paginated result
  70. *
  71. * @return int
  72. * @see \OCP\Search\IProvider for details
  73. * @since 20.0.0
  74. */
  75. public function getLimit(): int;
  76. /**
  77. * Get the app-specific cursor of the tail of the previous result entries
  78. *
  79. * @return int|string|null
  80. * @see \OCP\Search\IProvider for details
  81. * @since 20.0.0
  82. */
  83. public function getCursor();
  84. /**
  85. * @return string
  86. * @since 20.0.0
  87. */
  88. public function getRoute(): string;
  89. /**
  90. * @return array
  91. * @since 20.0.0
  92. */
  93. public function getRouteParameters(): array;
  94. }