Map field value to a proper Solr representation.

@param \eZ\Publish\API\Repository\Values\Content\Query\Criterion $criterion
@param \EzSystems\EzPlatformSolrSearchEngine\Query\CriterionVisitor $subVisitor

@return string
8458
public function visit(Criterion $criterion, CriterionVisitor $subVisitor = null)
    {
        $handler = $this->sectionHandler;

        $conditions = array_map(
            function ($value) use ($handler) {
                return 'content_section_id_id:"' . $handler->loadByIdentifier($value)->id . '"';
            },
            $criterion->value
        );

        return '(' . implode(' OR ', $conditions) . ')';
    }
1249572
private function buildField(CriterionDefinition $definition)
    {
        return new Field(
            $definition->target,
            $definition->operator,
            $definition->value
        );
    }
854769
public function applyToCriteriaComparator(CriteriaComparator $criteriaComparator, CriteriaProperty $alias) {
		$criteriaComparator->match(CrIt::p($alias, $this->cp), $this->operator, $this->ci);
	}
9987
public function canVisit(Criterion $criterion)
    {
        return
            $criterion instanceof Criterion\Subtree &&
            (
                ($criterion->operator ?: Operator::IN) === Operator::IN ||
                $criterion->operator === Operator::EQ
            );
    }
383155
protected function getCriteria(array $criteria = []): array
    {
        $criteria['source'] = $this->alias;
        $criteria['sourceTable'] = $this->sourceTable;
        $criteria['sourceField'] = $this->sourceField;

        return $criteria;
    }
560440
private function visitTranslationParameters(Query $query, VisitorInterface $subVisitor): Generator
    {
        foreach ($query->getParameters() as $parameter) {
            yield $parameter->getName() => $subVisitor->visit($parameter);
        }
    }
539473
function (criteria) {
            var identity = this.identity;

            return this.findOne(criteria).then(function (record) {
                if (!record) {
                    throw new Errors.NotFoundError(
                        'Could not find %s with criteria %j.'.format(
                            pluralize.singular(identity),
                            criteria
                        ), {
                            criteria: criteria,
                            collection: identity
                        });
                }

                return record;
            });
        }
156754
public function addCriterion(CriterionInterface $criterion, $name = null, $link = Link::LINK_AND)
    {
        if (null === $name) {
            $this->collection[] = [$criterion, $link];
        } else {
            $this->collection[$this->resolveString($name, __METHOD__)] = [$criterion, $link];
        }

        $this->collectionCount++;

        return $this;
    }
310586
private function buildVisibility(CriterionDefinition $definition)
    {
        if (null === $definition->value) {
            return null;
        }

        $isVisible = $definition->value ? Visibility::VISIBLE : Visibility::HIDDEN;

        return new Visibility($isVisible);
    }
660264
public function mapLoadCriteriaToQuery(ILoadCriteria $criteria) : MappedLoadQuery
    {
        $select = $this->criteriaMapper->mapCriteriaToSelect($criteria, $memberMappings, $criteria->getAliasNestedMemberMap());
        $select->setColumns([]);

        $columnIndexMap  = [];
        $relationsToLoad = [];

        foreach ($criteria->getAliasNestedMemberMap() as $alias => $member) {
            /** @var MemberMappingWithTableAliases $memberMapping */
            $memberMapping = $memberMappings[$member->asString()];
            $mapping       = $memberMapping->getMapping();

            if ($mapping instanceof IFinalRelationMemberMapping) {
                $memberRelation   = $mapping->asMemberRelation();
                $parentTableAlias = $memberRelation instanceof ToManyMemberRelation || !($memberRelation->getFirstRelation() instanceof ISeparateTableRelation) || count($memberMapping->getTableAliases()) === 1
                    ? $memberMapping->getLastTableAlias()
                    : $memberMapping->getSecondLastTableAlias();
                $parentTable      = $select->getTableFromAlias($parentTableAlias);
                $parentColumnMap  = [];

                $parentColumnsToLoad = $memberRelation->getParentColumnsToLoad();

                if (!($mapping instanceof ToOneEmbeddedObjectMapping)) {
                    $parentColumnsToLoad[] = $parentTable->getPrimaryKeyColumnName();
                }

                foreach ($parentColumnsToLoad as $column) {
                    $parentColumnMap[$alias . '_' . $column] = $column;

                    $select->addColumn($alias . '_' . $column, Expr::column($parentTableAlias, $parentTable->getColumn($column)));
                }

                $relationsToLoad[$alias] = [$memberRelation, $parentTable, $parentColumnMap];
            } else {
                $mapping->addSelectColumn($select, $memberMapping->getLastTableAlias(), $alias);
                $columnIndexMap[$alias] = $alias;
            }
        }

        foreach ($memberMappings as $key => $memberMapping) {
            /** @var MemberMappingWithTableAliases $memberMapping */
            $memberMappings[$key] = $memberMapping->getMapping();
        }


        return new MappedLoadQuery($select, $columnIndexMap, $relationsToLoad);
    }
1055826
protected function getCondition(Criterion $criterion)
    {
        if (count($criterion->value) > 1) {
            return array(
                'terms' => array(
                    'locations_doc.remote_id_id' => $criterion->value,
                ),
            );
        } else {
            return array(
                'term' => array(
                    'locations_doc.remote_id_id' => $criterion->value[0],
                ),
            );
        }
    }
1229415
public function matching(Criteria $criteria)
    {
        $visitor = new QueryExpressionVisitor($this->createQueryBuilder());
        $queryBuilder = $this->createQueryBuilder();

        if ($criteria->getWhereExpression() !== null) {
            $expr = $visitor->dispatch($criteria->getWhereExpression());
            $queryBuilder->setQueryArray($expr->getQuery());
        }

        if ($criteria->getMaxResults() !== null) {
            $queryBuilder->limit($criteria->getMaxResults());
        }

        if ($criteria->getFirstResult() !== null) {
            $queryBuilder->skip($criteria->getFirstResult());
        }

        if ($criteria->getOrderings() !== null) {
            $queryBuilder->sort($criteria->getOrderings());
        }

        // @TODO: wrap around a specialized Collection for efficient count on large collections
        return new ArrayCollection($queryBuilder->getQuery()->execute()->toArray());
    }
460635
private function getQueryTypeFilterCriteria(ParameterCollectionInterface $parameterCollection, Location $parentLocation): ?Criterion
    {
        if ($parameterCollection->getParameter('query_type')->getValue() !== 'list') {
            return null;
        }

        return new Criterion\Location\Depth(
            Criterion\Operator::EQ,
            $parentLocation->depth + 1
        );
    }
1331990
public function getCriteriaByName($in_criteria_name)
    {
        if (!array_key_exists($in_criteria_name, $this->lookup_queries)) {
            return false;
        } else {
            return $this->lookup_queries[$in_criteria_name];
        }

    }
1051120
protected function applyCriteriaToCursor(Criteria $criteria, MongoCursor $mongoCursor) {
		$sort   = $criteria->getSortConditions();
		$offset = $criteria->getOffset();
		$limit  = $criteria->getLimit();
				
		if (! empty($sort)) {
			$mongoCursor->sort($sort);
		}
		
		if ($offset !== null) {
			$mongoCursor->skip($offset);
		}

		if ($limit !== null) {
			$mongoCursor->limit($limit);
		}
	}
199424
public function canVisit(Criterion $criterion)
    {
        return
            $criterion instanceof Criterion\DateMetadata &&
            $criterion->target === 'modified' &&
            (
                ($criterion->operator ?: Operator::IN) === Operator::IN ||
                $criterion->operator === Operator::EQ
            );
    }
792705
private function getSectionFilterCriteria(ParameterCollectionInterface $parameterCollection): ?Criterion
    {
        if ($parameterCollection->getParameter('filter_by_section')->getValue() !== true) {
            return null;
        }

        $sections = $parameterCollection->getParameter('sections')->getValue() ?? [];
        if (count($sections) === 0) {
            return null;
        }

        return new Criterion\SectionId($this->getSectionIds($sections));
    }