eZ\Publish\Core\Search\Elasticsearch\Content\CriterionVisitor\Field\FieldRange::getCondition PHP Method

getCondition() protected method

Returns nested condition common for filter and query contexts.
protected getCondition ( eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion ) : array
$criterion eZ\Publish\API\Repository\Values\Content\Query\Criterion
return array
    protected function getCondition(Criterion $criterion)
    {
        $fieldNames = $this->getFieldNames($criterion, $criterion->target);
        $value = (array) $criterion->value;
        if (empty($fieldNames)) {
            throw new InvalidArgumentException('$criterion->target', "No searchable fields found for the given criterion target '{$criterion->target}'.");
        }
        $start = $value[0];
        $end = isset($value[1]) ? $value[1] : null;
        if ($criterion->operator === Operator::LT || $criterion->operator === Operator::LTE) {
            $end = $start;
            $start = null;
        }
        $fields = array();
        foreach ($fieldNames as $name) {
            $fields[] = 'fields_doc.' . $name;
        }
        return array('query_string' => array('fields' => $fields, 'query' => $this->getQueryRange($criterion->operator, $start, $end)));
    }