• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/search/contactsearchcontentbuilder.php
  • Класс: Bitrix\Crm\Search\ContactSearchContentBuilder
  • Вызов: ContactSearchContentBuilder::saveShortIndex
protected function saveShortIndex(int $entityId, SearchMap $map, bool $checkExist = false): \Bitrix\Main\DB\Result
{
	$connection = \Bitrix\Main\Application::getConnection();
	$helper = $connection->getSqlHelper();

	$searchContent = $helper->forSql($map->getString());

	if ($checkExist)
	{
		$sql = "
			INSERT INTO b_crm_contact_index(CONTACT_ID, SEARCH_CONTENT)
			VALUES({$entityId}, '{$searchContent}')
		";
		try
		{
			return $connection->query($sql);
		}
		catch (\Bitrix\Main\DB\SqlQueryException $exception)
		{
		}
	}

	$sql = "
		UPDATE b_crm_contact_index SET SEARCH_CONTENT= '{$searchContent}' WHERE CONTACT_ID = {$entityId}
	";
	return $connection->query($sql);
}