ISearchRequestSimpleQuery.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright 2018
  5. *
  6. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  7. * @author Maxence Lange <maxence@artificial-owl.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\FullTextSearch\Model;
  26. /**
  27. * Interface ISearchRequestSimpleQuery
  28. *
  29. * Add a Query during a Search Request...
  30. * - on a specific field,
  31. * - using a specific value,
  32. * - with a specific comparison
  33. *
  34. * @since 17.0.0
  35. *
  36. */
  37. interface ISearchRequestSimpleQuery {
  38. /**
  39. * @since 17.0.0
  40. */
  41. public const COMPARE_TYPE_TEXT = 1;
  42. /**
  43. * @since 17.0.0
  44. */
  45. public const COMPARE_TYPE_KEYWORD = 2;
  46. /**
  47. * @since 17.0.0
  48. */
  49. public const COMPARE_TYPE_INT_EQ = 3;
  50. /**
  51. * @since 17.0.0
  52. */
  53. public const COMPARE_TYPE_INT_GTE = 4;
  54. /**
  55. * @since 17.0.0
  56. */
  57. public const COMPARE_TYPE_INT_GT = 5;
  58. /**
  59. * @since 17.0.0
  60. */
  61. public const COMPARE_TYPE_INT_LTE = 6;
  62. /**
  63. * @since 17.0.0
  64. */
  65. public const COMPARE_TYPE_INT_LT = 7;
  66. /**
  67. * @since 17.0.0
  68. */
  69. public const COMPARE_TYPE_BOOL = 8;
  70. /**
  71. * @since 17.0.0
  72. */
  73. public const COMPARE_TYPE_ARRAY = 9;
  74. /**
  75. * @since 17.0.0
  76. */
  77. public const COMPARE_TYPE_REGEX = 10;
  78. /**
  79. * @since 17.0.0
  80. */
  81. public const COMPARE_TYPE_WILDCARD = 11;
  82. /**
  83. * Get the compare type of the query
  84. *
  85. * @return int
  86. * @since 17.0.0
  87. */
  88. public function getType(): int;
  89. /**
  90. * Get the field to apply query
  91. *
  92. * @return string
  93. * @since 17.0.0
  94. */
  95. public function getField(): string;
  96. /**
  97. * Set the field to apply query
  98. *
  99. * @param string $field
  100. *
  101. * @return ISearchRequestSimpleQuery
  102. * @since 17.0.0
  103. */
  104. public function setField(string $field): ISearchRequestSimpleQuery;
  105. /**
  106. * Get the all values to compare
  107. *
  108. * @return array
  109. * @since 17.0.0
  110. */
  111. public function getValues(): array;
  112. /**
  113. * Add value to compare (string)
  114. *
  115. * @param string $value
  116. *
  117. * @return ISearchRequestSimpleQuery
  118. * @since 17.0.0
  119. */
  120. public function addValue(string $value): ISearchRequestSimpleQuery;
  121. /**
  122. * Add value to compare (int)
  123. *
  124. * @param int $value
  125. *
  126. * @return ISearchRequestSimpleQuery
  127. * @since 17.0.0
  128. */
  129. public function addValueInt(int $value): ISearchRequestSimpleQuery;
  130. /**
  131. * Add value to compare (array)
  132. *
  133. * @param array $value
  134. *
  135. * @return ISearchRequestSimpleQuery
  136. * @since 17.0.0
  137. */
  138. public function addValueArray(array $value): ISearchRequestSimpleQuery;
  139. /**
  140. * Add value to compare (bool)
  141. *
  142. * @param bool $value
  143. *
  144. * @return ISearchRequestSimpleQuery
  145. * @since 17.0.0
  146. */
  147. public function addValueBool(bool $value): ISearchRequestSimpleQuery;
  148. }