protected function processFilterQuery(FilterQuery $query, DataObject $params, $conditionType) { switch ($query->getReferenceType()) { case FilterQuery::REFERENCE_QUERY: $this->processQuery($query->getReference(), $params, $conditionType); break; case FilterQuery::REFERENCE_FILTER: $this->processFilter($query->getReference(), $params, $conditionType); break; } }
/** * Process filter query * * @param ScoreBuilder $scoreBuilder * @param FilterQuery $query * @param Select $select * @param string $conditionType * @param QueryContainer $queryContainer * @return Select */ private function processFilterQuery( ScoreBuilder $scoreBuilder, FilterQuery $query, Select $select, $conditionType, QueryContainer $queryContainer ) { $scoreBuilder->startQuery(); switch ($query->getReferenceType()) { case FilterQuery::REFERENCE_QUERY: $select = $this->processQuery( $scoreBuilder, $query->getReference(), $select, $conditionType, $queryContainer ); $scoreBuilder->endQuery($query->getBoost()); break; case FilterQuery::REFERENCE_FILTER: $filterCondition = $this->filterBuilder->build($query->getReference(), $conditionType, $queryContainer); if ($filterCondition) { $select->where($filterCondition); } break; } $scoreBuilder->endQuery($query->getBoost()); return $select; }
/** * Process filter query * * @param ScoreBuilder $scoreBuilder * @param FilterQuery $query * @param Select $select * @param bool $isNot * @return Select */ private function processFilterQuery(ScoreBuilder $scoreBuilder, FilterQuery $query, Select $select, $isNot) { switch ($query->getReferenceType()) { case FilterQuery::REFERENCE_QUERY: $scoreBuilder->startQuery(); $select = $this->processQuery($scoreBuilder, $query->getReference(), $select, $isNot); $scoreBuilder->endQuery($query->getBoost()); break; case FilterQuery::REFERENCE_FILTER: $filterCondition = $this->filterBuilder->build($query->getReference()); if ($isNot === true) { $filterCondition = '!' . $filterCondition; } $select->where($filterCondition); $scoreBuilder->addCondition(1, $query->getBoost()); break; } return $select; }