ISearchRequestSimpleQuery.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\FullTextSearch\Model;
  8. /**
  9. * Interface ISearchRequestSimpleQuery
  10. *
  11. * Add a Query during a Search Request...
  12. * - on a specific field,
  13. * - using a specific value,
  14. * - with a specific comparison
  15. *
  16. * @since 17.0.0
  17. *
  18. */
  19. interface ISearchRequestSimpleQuery {
  20. /**
  21. * @since 17.0.0
  22. */
  23. public const COMPARE_TYPE_TEXT = 1;
  24. /**
  25. * @since 17.0.0
  26. */
  27. public const COMPARE_TYPE_KEYWORD = 2;
  28. /**
  29. * @since 17.0.0
  30. */
  31. public const COMPARE_TYPE_INT_EQ = 3;
  32. /**
  33. * @since 17.0.0
  34. */
  35. public const COMPARE_TYPE_INT_GTE = 4;
  36. /**
  37. * @since 17.0.0
  38. */
  39. public const COMPARE_TYPE_INT_GT = 5;
  40. /**
  41. * @since 17.0.0
  42. */
  43. public const COMPARE_TYPE_INT_LTE = 6;
  44. /**
  45. * @since 17.0.0
  46. */
  47. public const COMPARE_TYPE_INT_LT = 7;
  48. /**
  49. * @since 17.0.0
  50. */
  51. public const COMPARE_TYPE_BOOL = 8;
  52. /**
  53. * @since 17.0.0
  54. */
  55. public const COMPARE_TYPE_ARRAY = 9;
  56. /**
  57. * @since 17.0.0
  58. */
  59. public const COMPARE_TYPE_REGEX = 10;
  60. /**
  61. * @since 17.0.0
  62. */
  63. public const COMPARE_TYPE_WILDCARD = 11;
  64. /**
  65. * Get the compare type of the query
  66. *
  67. * @return int
  68. * @since 17.0.0
  69. */
  70. public function getType(): int;
  71. /**
  72. * Get the field to apply query
  73. *
  74. * @return string
  75. * @since 17.0.0
  76. */
  77. public function getField(): string;
  78. /**
  79. * Set the field to apply query
  80. *
  81. * @param string $field
  82. *
  83. * @return ISearchRequestSimpleQuery
  84. * @since 17.0.0
  85. */
  86. public function setField(string $field): ISearchRequestSimpleQuery;
  87. /**
  88. * Get the all values to compare
  89. *
  90. * @return array
  91. * @since 17.0.0
  92. */
  93. public function getValues(): array;
  94. /**
  95. * Add value to compare (string)
  96. *
  97. * @param string $value
  98. *
  99. * @return ISearchRequestSimpleQuery
  100. * @since 17.0.0
  101. */
  102. public function addValue(string $value): ISearchRequestSimpleQuery;
  103. /**
  104. * Add value to compare (int)
  105. *
  106. * @param int $value
  107. *
  108. * @return ISearchRequestSimpleQuery
  109. * @since 17.0.0
  110. */
  111. public function addValueInt(int $value): ISearchRequestSimpleQuery;
  112. /**
  113. * Add value to compare (array)
  114. *
  115. * @param array $value
  116. *
  117. * @return ISearchRequestSimpleQuery
  118. * @since 17.0.0
  119. */
  120. public function addValueArray(array $value): ISearchRequestSimpleQuery;
  121. /**
  122. * Add value to compare (bool)
  123. *
  124. * @param bool $value
  125. *
  126. * @return ISearchRequestSimpleQuery
  127. * @since 17.0.0
  128. */
  129. public function addValueBool(bool $value): ISearchRequestSimpleQuery;
  130. }