public function visit(Criterion $criterion, CriterionVisitor $subVisitor = null)
    {
        $searchFields = $this->getSearchFields($criterion, $criterion->target);

        if (empty($searchFields)) {
            throw new InvalidArgumentException(
                '$criterion->target',
                "No searchable fields found for the given criterion target '{$criterion->target}'."
            );
        }

        $criterion->value = (array)$criterion->value;

        $queries = array();
        foreach ($searchFields as $name => $fieldType) {
            foreach ($criterion->value as $value) {
                $preparedValues = (array)$this->mapSearchFieldvalue($value, $fieldType);
                foreach ($preparedValues as $prepValue) {
                    $queries[] = $name . ':"' . $this->escapeQuote($this->toString($prepValue), true) . '"';
                }
            }
        }

        switch ($criterion->operator) {
            case Operator::CONTAINS:
                $op = ' AND ';
                break;
            case Operator::IN:
            default:
                $op = ' OR ';
        }

        return '(' . implode($op, $queries) . ')';
    }
public function visit(Criterion $criterion, CriterionVisitor $subVisitor = null)
    {
        $searchFields = $this->getSearchFields($criterion, $criterion->target);

        if (empty($searchFields)) {
            throw new InvalidArgumentException(
                '$criterion->target',
                "No searchable fields found for the given criterion target '{$criterion->target}'."
            );
        }

        $criterion->value = (array)$criterion->value;

        $queries = array();
        foreach ($searchFields as $name => $fieldType) {
            foreach ($criterion->value as $value) {
                $preparedValues = (array)$this->mapSearchFieldvalue($value, $fieldType);
                foreach ($preparedValues as $prepValue) {
                    $queries[] = $name . ':"' . $this->escapeQuote($this->toString($prepValue), true) . '"';
                }
            }
        }

        switch ($criterion->operator) {
            case Operator::CONTAINS:
                $op = ' AND ';
                break;
            case Operator::IN:
            default:
                $op = ' OR ';
        }

        return '(' . implode($op, $queries) . ')';
    }
public function visit ( Criterion $ criterion , CriterionVisitor $ subVisitor = null ) { $ searchFields = $ this -> getSearchFields ( $ criterion , $ criterion -> target ) ; if ( empty ( $ searchFields ) ) { throw new InvalidArgumentException ( '$criterion->target' , "No searchable fields found for the given criterion target '{$criterion->target}'." ) ; } $ criterion -> value = ( array ) $ criterion -> value ; $ queries = array ( ) ; foreach ( $ searchFields as $ name => $ fieldType ) { foreach ( $ criterion -> value as $ value ) { $ preparedValues = ( array ) $ this -> mapSearchFieldvalue ( $ value , $ fieldType ) ; foreach ( $ preparedValues as $ prepValue ) { $ queries [ ] = $ name . ':"' . $ this -> escapeQuote ( $ this -> toString ( $ prepValue ) , true ) . '"' ; } } } switch ( $ criterion -> operator ) { case Operator :: CONTAINS : $ op = ' AND ' ; break ; case Operator :: IN : default : $ op = ' OR ' ; } return '(' . implode ( $ op , $ queries ) . ')' ; }
Map field value to a proper Solr representation.

@throws \eZ\Publish\Core\Base\Exceptions\InvalidArgumentException If no searchable fields are found for the given criterion target.

@param Criterion $criterion
@param CriterionVisitor $subVisitor

@return string
Map field value to a proper Solr representation .