Request.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\Search;
  7. use Magento\Framework\Search\Request\BucketInterface as RequestBucketInterface;
  8. use Magento\Framework\Search\Request\Dimension;
  9. use Magento\Framework\Search\Request\QueryInterface;
  10. /**
  11. * Search Request
  12. *
  13. * @codeCoverageIgnore
  14. * @api
  15. * @since 100.0.2
  16. */
  17. class Request implements RequestInterface
  18. {
  19. /**
  20. * @var string
  21. */
  22. protected $name;
  23. /**
  24. * @var string
  25. */
  26. protected $index;
  27. /**
  28. * @var RequestBucketInterface[]
  29. */
  30. protected $buckets;
  31. /**
  32. * Main query which represents the whole query hierarchy
  33. *
  34. * @var QueryInterface
  35. */
  36. protected $query;
  37. /**
  38. * @var int|null
  39. */
  40. protected $from;
  41. /**
  42. * @var int|null
  43. */
  44. protected $size;
  45. /**
  46. * @var Dimension[]
  47. */
  48. protected $dimensions;
  49. /**
  50. * @param string $name
  51. * @param string $indexName
  52. * @param QueryInterface $query
  53. * @param int|null $from
  54. * @param int|null $size
  55. * @param Dimension[] $dimensions
  56. * @param RequestBucketInterface[] $buckets
  57. */
  58. public function __construct(
  59. $name,
  60. $indexName,
  61. QueryInterface $query,
  62. $from = null,
  63. $size = null,
  64. array $dimensions = [],
  65. array $buckets = []
  66. ) {
  67. $this->name = $name;
  68. $this->index = $indexName;
  69. $this->query = $query;
  70. $this->from = $from;
  71. $this->size = $size;
  72. $this->buckets = $buckets;
  73. $this->dimensions = $dimensions;
  74. }
  75. /**
  76. * {@inheritdoc}
  77. */
  78. public function getName()
  79. {
  80. return $this->name;
  81. }
  82. /**
  83. * {@inheritdoc}
  84. */
  85. public function getIndex()
  86. {
  87. return $this->index;
  88. }
  89. /**
  90. * {@inheritdoc}
  91. */
  92. public function getDimensions()
  93. {
  94. return $this->dimensions;
  95. }
  96. /**
  97. * {@inheritdoc}
  98. */
  99. public function getAggregation()
  100. {
  101. return $this->buckets;
  102. }
  103. /**
  104. * {@inheritdoc}
  105. */
  106. public function getQuery()
  107. {
  108. return $this->query;
  109. }
  110. /**
  111. * {@inheritdoc}
  112. */
  113. public function getFrom()
  114. {
  115. return $this->from;
  116. }
  117. /**
  118. * {@inheritdoc}
  119. */
  120. public function getSize()
  121. {
  122. return $this->size;
  123. }
  124. }