public function handle(CriteriaConverter $converter, SelectQuery $query, Criterion $criterion, array $languageSettings)
{
$fieldsInformation = $this->getFieldsInformation($criterion->target);
$subSelect = $query->subSelect();
$subSelect->select($this->dbHandler->quoteColumn('contentobject_id'))->from($this->dbHandler->quoteTable('ezcontentobject_attribute'));
$whereExpressions = array();
foreach ($fieldsInformation as $fieldTypeIdentifier => $fieldsInfo) {
if ($fieldsInfo['column'] === false) {
throw new NotImplementedException("A field of type '{$fieldTypeIdentifier}' is not searchable in the legacy search engine.");
}
$filter = $this->fieldValueConverter->convertCriteria($fieldTypeIdentifier, $subSelect, $criterion, $fieldsInfo['column']);
$whereExpressions[] = $subSelect->expr->lAnd($subSelect->expr->in($this->dbHandler->quoteColumn('contentclassattribute_id'), $fieldsInfo['ids']), $filter);
}
$subSelect->where($subSelect->expr->lAnd($subSelect->expr->eq($this->dbHandler->quoteColumn('version', 'ezcontentobject_attribute'), $this->dbHandler->quoteColumn('current_version', 'ezcontentobject')), count($whereExpressions) > 1 ? $subSelect->expr->lOr($whereExpressions) : $whereExpressions[0], $this->getFieldCondition($subSelect, $languageSettings)));
return $query->expr->in($this->dbHandler->quoteColumn('id', 'ezcontentobject'), $subSelect);
}