123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- <?php
- /**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\Framework\Search\Request\Query;
- use Magento\Framework\Search\Request\QueryInterface;
- /**
- * Bool Query
- * @api
- * @since 100.0.2
- */
- class BoolExpression implements QueryInterface
- {
- const QUERY_CONDITION_MUST = 'must';
- const QUERY_CONDITION_SHOULD = 'should';
- const QUERY_CONDITION_NOT = 'not';
- /**
- * Boost
- *
- * @var int|null
- */
- protected $boost;
- /**
- * Query Name
- *
- * @var string
- */
- protected $name;
- /**
- * Query names to which result set SHOULD satisfy
- *
- * @var array
- */
- protected $should = [];
- /**
- * Query names to which result set MUST satisfy
- *
- * @var array
- */
- protected $must = [];
- /**
- * Query names to which result set MUST NOT satisfy
- *
- * @var array
- */
- protected $mustNot = [];
- /**
- * @param string $name
- * @param int|null $boost
- * @param array $must
- * @param array $should
- * @param array $not
- * @codeCoverageIgnore
- */
- public function __construct($name, $boost, array $must = [], array $should = [], array $not = [])
- {
- $this->name = $name;
- $this->boost = $boost;
- $this->must = $must;
- $this->should = $should;
- $this->mustNot = $not;
- }
- /**
- * {@inheritdoc}
- */
- public function getType()
- {
- return QueryInterface::TYPE_BOOL;
- }
- /**
- * {@inheritdoc}
- * @codeCoverageIgnore
- */
- public function getName()
- {
- return $this->name;
- }
- /**
- * {@inheritdoc}
- */
- public function getBoost()
- {
- return $this->boost;
- }
- /**
- * Get Should queries
- *
- * @return QueryInterface[]
- * @codeCoverageIgnore
- */
- public function getShould()
- {
- return $this->should;
- }
- /**
- * Get Must queries
- *
- * @return QueryInterface[]
- * @codeCoverageIgnore
- */
- public function getMust()
- {
- return $this->must;
- }
- /**
- * Get Must Not queries
- *
- * @return QueryInterface[]
- * @codeCoverageIgnore
- */
- public function getMustNot()
- {
- return $this->mustNot;
- }
- }
|