eZ\Publish\Core\Search\Legacy\Content\WordIndexer\Gateway\DoctrineDatabase::indexWords PHP Method

indexWords() private method

Ported from the legacy code
See also: https://github.com/ezsystems/ezpublish-legacy/blob/master/kernel/search/plugins/ezsearchengine/ezsearchengine.php#L255
private indexWords ( FullTextData $fullTextData, array $indexArray, array $wordIDArray, integer $placement ) : integer
$fullTextData eZ\Publish\Core\Search\Legacy\Content\FullTextData
$indexArray array
$wordIDArray array
$placement integer
return integer last placement
    private function indexWords(FullTextData $fullTextData, array $indexArray, array $wordIDArray, $placement = 0)
    {
        $contentId = $fullTextData->id;
        $prevWordId = 0;
        for ($i = 0; $i < count($indexArray); ++$i) {
            $indexWord = $indexArray[$i]['Word'];
            $contentFieldId = $indexArray[$i]['ContentClassAttributeID'];
            $identifier = $indexArray[$i]['identifier'];
            $integerValue = $indexArray[$i]['integer_value'];
            $wordId = $wordIDArray[$indexWord];
            if (isset($indexArray[$i + 1])) {
                $nextIndexWord = $indexArray[$i + 1]['Word'];
                $nextWordId = $wordIDArray[$nextIndexWord];
            } else {
                $nextWordId = 0;
            }
            $frequency = 0;
            $this->searchIndex->addObjectWordLink($wordId, $contentId, $frequency, $placement, $nextWordId, $prevWordId, $fullTextData->contentTypeId, $contentFieldId, $fullTextData->published, $fullTextData->sectionId, $identifier, $integerValue);
            $prevWordId = $wordId;
            ++$placement;
        }
        return $placement;
    }