lib/Query/Common/CriterionVisitor/Field/FieldLike.php
public function visit(Criterion $criterion, CriterionVisitor $subVisitor = null)
    {
        $searchFields = $this->getSearchFields($criterion);

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

        $queries = [];
        foreach ($searchFields as $name => $fieldType) {
            $preparedValue = $this->toString($this->mapSearchFieldValue($criterion->value, $fieldType));

            // Check if there is user supplied wildcard or not
            if (strpos($preparedValue, '*') !== false) {
                $queries[] = $name . ':' . $this->escapeExpressions($preparedValue, true);
            } else {
                $queries[] = $name . ':"' . $this->escapeQuote($preparedValue, true) . '"';
            }
        }

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

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

        $queries = [];
        foreach ($searchFields as $name => $fieldType) {
            $preparedValue = $this->toString($this->mapSearchFieldValue($criterion->value, $fieldType));

            // Check if there is user supplied wildcard or not
            if (strpos($preparedValue, '*') !== false) {
                $queries[] = $name . ':' . $this->escapeExpressions($preparedValue, true);
            } else {
                $queries[] = $name . ':"' . $this->escapeQuote($preparedValue, true) . '"';
            }
        }

        return '(' . implode(' OR ', $queries) . ')';
    }
public function visit ( Criterion $ criterion , CriterionVisitor $ subVisitor = null ) { $ searchFields = $ this -> getSearchFields ( $ criterion ) ; if ( empty ( $ searchFields ) ) { throw new InvalidArgumentException ( '$criterion->target' , "No searchable fields found for the given criterion target '{$criterion->target}'." ) ; } $ queries = [ ] ; foreach ( $ searchFields as $ name => $ fieldType ) { $ preparedValue = $ this -> toString ( $ this -> mapSearchFieldValue ( $ criterion -> value , $ fieldType ) ) ; // Check if there is user supplied wildcard or not if ( strpos ( $ preparedValue , '*' ) !== false ) { $ queries [ ] = $ name . ':' . $ this -> escapeExpressions ( $ preparedValue , true ) ; } else { $ queries [ ] = $ name . ':"' . $ this -> escapeQuote ( $ preparedValue , true ) . '"' ; } } return '(' . implode ( ' OR ' , $ 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 \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion
@param \EzSystems\EzPlatformSolrSearchEngine\Query\CriterionVisitor $subVisitor

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