eZ\Publish\Core\Search\Legacy\Content\WordIndexer\Repository\SearchIndex::addObjectWordLink PHP Method

    public function addObjectWordLink($wordId, $contentId, $frequency, $placement, $nextWordId, $prevWordId, $contentTypeId, $fieldTypeId, $published, $sectionId, $identifier, $integerValue)
    {
        $assoc = ['word_id' => $wordId, 'contentobject_id' => $contentId, 'frequency' => $frequency, 'placement' => $placement, 'next_word_id' => $nextWordId, 'prev_word_id' => $prevWordId, 'contentclass_id' => $contentTypeId, 'contentclass_attribute_id' => $fieldTypeId, 'published' => $published, 'section_id' => $sectionId, 'identifier' => $identifier, 'integer_value' => $integerValue];
        $query = $this->dbHandler->createInsertQuery();
        $query->insertInto('ezsearch_object_word_link');
        foreach ($assoc as $column => $value) {
            $query->set($this->dbHandler->quoteColumn($column), $query->bindValue($value));
        }
        $stmt = $query->prepare();
        $stmt->execute();
    }

Usage Example

 /**
  * Index wordIndex.
  *
  * Ported from the legacy code
  *
  * @see https://github.com/ezsystems/ezpublish-legacy/blob/master/kernel/search/plugins/ezsearchengine/ezsearchengine.php#L255
  *
  * @param \eZ\Publish\Core\Search\Legacy\Content\FullTextData $fullTextData
  * @param array $indexArray
  * @param array $wordIDArray
  * @param int $placement
  *
  * @return int 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;
 }