ISearchRequestSimpleQuery.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. public const COMPARE_TYPE_TEXT = 1;
  39. public const COMPARE_TYPE_KEYWORD = 2;
  40. public const COMPARE_TYPE_INT_EQ = 3;
  41. public const COMPARE_TYPE_INT_GTE = 4;
  42. public const COMPARE_TYPE_INT_GT = 5;
  43. public const COMPARE_TYPE_INT_LTE = 6;
  44. public const COMPARE_TYPE_INT_LT = 7;
  45. public const COMPARE_TYPE_BOOL = 8;
  46. public const COMPARE_TYPE_ARRAY = 9;
  47. public const COMPARE_TYPE_REGEX = 10;
  48. public const COMPARE_TYPE_WILDCARD = 11;
  49. /**
  50. * Get the compare type of the query
  51. *
  52. * @return int
  53. * @since 17.0.0
  54. */
  55. public function getType(): int;
  56. /**
  57. * Get the field to apply query
  58. *
  59. * @return string
  60. * @since 17.0.0
  61. */
  62. public function getField(): string;
  63. /**
  64. * Set the field to apply query
  65. *
  66. * @param string $field
  67. *
  68. * @return ISearchRequestSimpleQuery
  69. * @since 17.0.0
  70. */
  71. public function setField(string $field): ISearchRequestSimpleQuery;
  72. /**
  73. * Get the all values to compare
  74. *
  75. * @return array
  76. * @since 17.0.0
  77. */
  78. public function getValues(): array;
  79. /**
  80. * Add value to compare (string)
  81. *
  82. * @param string $value
  83. *
  84. * @return ISearchRequestSimpleQuery
  85. * @since 17.0.0
  86. */
  87. public function addValue(string $value): ISearchRequestSimpleQuery;
  88. /**
  89. * Add value to compare (int)
  90. *
  91. * @param int $value
  92. *
  93. * @return ISearchRequestSimpleQuery
  94. * @since 17.0.0
  95. */
  96. public function addValueInt(int $value): ISearchRequestSimpleQuery;
  97. /**
  98. * Add value to compare (array)
  99. *
  100. * @param array $value
  101. *
  102. * @return ISearchRequestSimpleQuery
  103. * @since 17.0.0
  104. */
  105. public function addValueArray(array $value): ISearchRequestSimpleQuery;
  106. /**
  107. * Add value to compare (bool)
  108. *
  109. * @param bool $value
  110. *
  111. * @return ISearchRequestSimpleQuery
  112. * @since 17.0.0
  113. */
  114. public function addValueBool(bool $value): ISearchRequestSimpleQuery;
  115. }