Returns the indexed value.

@param  AbstractClassContent $content      The content flushed.
@param  string               $indexedField The parameter to index.

@return array                              An array of the value and the content owner.
336673
private static function getIndexValue(AbstractClassContent $content, $indexedField)
    {
        if ('@' === substr($indexedField, 0, 1)) {
            // parameter indexation
            return self::getParamValue($content, substr($indexedField, 1));
        } else {
            // element indexation
            return self::getContentValue($content, $indexedField);
        }
    }
74263
public function getContent(string $field)
    {
        return Arr::get($this->toArray(), $field) ?? Arr::get($this->getRelations(), $field);
    }
619785
private function getTokenisedContent(string $content)
    {

        $tokens = token_get_all($content);


        $tokenised_content = array();
        $tokenised_content = $this->addToken($tokenised_content, $tokens, $content);

        return $tokenised_content;

    }
197713
public function duplicate(ContentInterface $content)
    {
        //get valueset to clone
        $valueset = $content->getValueSet();

        //clone valueset
        $duplicatedValueset = clone $valueset;

        $this->detachAndPersist($duplicatedValueset);

        //duplicate content
        $duplicatedContent = clone $content;
        $duplicatedContent->setSlug(null);
        $duplicatedContent->setValueSet($duplicatedValueset);

        $this->detachAndPersist($duplicatedContent);

        //iterate values, clone each and assign duplicate valueset to it
        foreach ($valueset->getValues() as $value) {

            //skip empty attributes
            if (is_null($value->getId())) continue;

            $duplicatedValue = clone ($value);
            $duplicatedValue->setValueSet($duplicatedValueset);

            $this->detachAndPersist($duplicatedValue);
        }
        $this->em->flush();

        return $duplicatedContent->getId();
    }
323942
protected function cleanUpContentHardDelete(AbstractClassContent $content)
    {
        $this->_em->getConnection()->executeUpdate(
            'DELETE FROM indexation WHERE owner_uid = :uid',
            [
                'uid' => $content->getUid(),
            ]
        );

        $revisions = $this->_em->getRepository('BackBee\ClassContent\Revision')->findBy(['_content' => $content]);
        foreach ($revisions as $revision) {
            $this->_em->remove($revision);
        }

        return $this;
    }
218443
public <T> T getDocument(String indexName, String indexType,String documentId,Map<String,Object> options,Class<T> beanType) throws ElasticSearchException{
		try{
			SearchHit searchResult = this.client.executeRequest(BuildTool.buildGetDocumentRequest(  indexName,   indexType,  documentId,  options),null,   new GetDocumentResponseHandler( beanType),ClientUtil.HTTP_GET);

			return ResultUtil.buildObject(searchResult, beanType);
		}
		catch(ElasticSearchException e){
			return ResultUtil.hand404HttpRuntimeException(e,beanType,ResultUtil.OPERTYPE_getDocument);
		}

	}
8708
private function resolveContentSet(ContentSet $content, array $matches)
    {
        if ('ContentSet' === $matches[1]) {
            return $content->item($matches[3]);
        }

        $index = intval($matches[3]);
        $classname = AbstractClassContent::getFullClassname(str_replace('/', NAMESPACE_SEPARATOR, $matches[1]));

        foreach ($content as $subcontent) {
            if (get_class($subcontent) !== $classname) {
                continue;
            }

            if (0 === $index) {
                return $subcontent;
            }

            $index--;
        }

        return $content;
    }
590007
public function getParentContents(AbstractClassContent $content)
    {
        $result = $this->_em->getConnection()
            ->createQueryBuilder()
            ->select('p.parent_uid', 'c.classname')
            ->from('content_has_subcontent', 'p')
            ->leftJoin('p', 'content', 'c', 'p.parent_uid = c.uid')
            ->where('p.content_uid = :uid')
            ->setParameter('uid', $content->getUid())
            ->execute()
            ->fetchAll()
        ;

        $parents = [];
        foreach ($result as $parentData) {
            $parentData['classname'] = AbstractClassContent::getFullClassname($parentData['classname']);
            $parents[] = $this->_em->find($parentData['classname'], $parentData['parent_uid']);
        }

        return $parents;
    }
992660
private function getFieldTypeIdentifier(Content $content, Field $field)
    {
        $contentType = $content->getContentType();
        $key = $contentType->id . '  ' . $field->fieldDefIdentifier;

        if (!isset($this->fieldTypeIdentifiers[$key])) {
            $this->fieldTypeIdentifiers[$key] = $contentType
                ->getFieldDefinition($field->fieldDefIdentifier)
                ->fieldTypeIdentifier;
        }

        return $this->fieldTypeIdentifiers[$key];
    }
1151335
private function getRelation(Content $content, $field, $language)
    {
        $fieldDefinitions = $this->getFieldDefinitionList();
        $fieldNames = array_flip($fieldDefinitions);
        $isRelation = (in_array('ezobjectrelation', $fieldDefinitions) && $field == $fieldNames['ezobjectrelation']);

        if ($isRelation && $field == $fieldNames['ezobjectrelation']) {
            $fieldValue = $content->getFieldValue($fieldNames['ezobjectrelation'], $language);

            if (isset($fieldValue->destinationContentId)) {
                return $fieldValue->destinationContentId;
            }
        }

        return null;
    }
961785
public function arrayToJson($content = null)
    {
        if ($this->getJsonEncodeArray() && is_array($content)) {
            $this->header('Content-Type: application/json');
            return json_encode($content);
        }

        return $content;
    }
328800
private function getParsedFieldValue(Field $field, Content $content, $language, $imageFieldIdentifier, $options = [])
    {
        try {
            $this->logger->debug(sprintf(
                'Fetching field content for contentId %s, fieldId %s, fieldName %s',
                $content->id,
                $field->id,
                $field->fieldDefIdentifier
            ));

            $fieldType = $this->fieldDefIdentifiers[$field->fieldDefIdentifier];

            return $this->typeValue->$fieldType($field, $content, $language, $imageFieldIdentifier, $options);
        } catch (Exception $e) {
            $this->logger->warning(sprintf(
                'Unable to fetch field content for contentId %s, fieldId %s, fieldName %s (original exception: %s)',
                $content->id,
                $field->id,
                $field->fieldDefIdentifier,
                $e->getMessage()
            ));
        }
    }
1277021
private static function updateSuperContentIndexes(AbstractClassContent $content)
    {
        $alreadyIndexed = self::$em->getRepository('BackBee\ClassContent\Indexation')->findBy(['_owner' => $content]);
        foreach ($alreadyIndexed as $index) {
            if (null === $field = $index->getField()) {
                continue;
            }

            list($value, $owner) = self::getIndexValue($index->getContent(), $field);

            $callback = unserialize($index->getCallback());
            if (null !== $callback) {
                $value = self::applyCallbacks($value, (array) $callback);
            }

            if (null !== $value) {
                $index->setValue($value);
                self::$em->getRepository('BackBee\ClassContent\Indexation')->save($index);
            }
        }
    }
1131428
protected static function isSerializedResultFromCustomContentElement(array $indexingConfiguration, $solrFieldName): bool
    {
        $isSerialized = false;

        // SOLR_CLASSIFICATION - always returns serialized array
        if ($indexingConfiguration[$solrFieldName] == Classification::CONTENT_OBJECT_NAME) {
            $isSerialized = true;
        }

        // SOLR_MULTIVALUE - always returns serialized array
        if ($indexingConfiguration[$solrFieldName] == Multivalue::CONTENT_OBJECT_NAME) {
            $isSerialized = true;
        }

        // SOLR_RELATION - returns serialized array if multiValue option is set
        if ($indexingConfiguration[$solrFieldName] == Relation::CONTENT_OBJECT_NAME && !empty($indexingConfiguration[$solrFieldName . '.']['multiValue'])) {
            $isSerialized = true;
        }

        return $isSerialized;
    }
209733
private function resolveContent($content, array $matches)
    {
        if (3 < count($matches) && $content instanceof ContentSet) {
            return $this->resolveContentSet($content, $matches);
        }

        if (1 < count($matches) && is_object($content)) {
            $property = $matches[1];
            try {
                return $content->$property;
            } catch (\Exception $e) {
                return new Text();
            }
        }

        return $content;
    }
980620
public function push(AbstractClassContent $var)
    {
        if (null !== $this->getDraft()) {
            return $this->getDraft()->push($var);
        }

        if ($this->isAccepted($var)) {
            if (
                    (!$this->_maxentry && !$this->_minentry) ||
                    (is_array($this->_maxentry) && is_array($this->_minentry) && 0 == count($this->_maxentry)) ||
                    ($this->_maxentry > $this->count() && $this->_minentry < $this->count())
            ) {
                $this->_data[] = array($this->_getType($var) => $var->getUid());
                if ($this->_subcontent->add($var)) {
                    $this->subcontentmap[$var->getUid()] = $this->_subcontent->indexOf($var);
                }
            }
        }

        return $this;
    }
1079202
public function contents($content, $index = null, $order = true)
    {
        $this->content($content);

        $this->setOption('list', true);
        $this->setOption('index', $index);
        $this->setOption('order', $order);

        return $this;
    }