Task::setSearchIndex

  1. Bitrix24 API (v. 23.675.0)
  2. tasks
  3. Task
  4. setSearchIndex
  • Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/control/task.php
  • Класс: BitrixTasksControlTask
  • Вызов: Task::setSearchIndex
private function setSearchIndex()
{
	$task = $this->getTask();
	$task->fillMemberList();
	$task->fillTagList();

	$tagList = $task->getTagList();
	$tags = [];
	foreach ($tagList as $tag)
	{
		$tags[] = $tag->getName();
	}

	$memberList = $task->getMemberList();
	$accomplices = [];
	$auditors = [];
	foreach ($memberList as $member)
	{
		if ($member->getType() === MemberTable::MEMBER_TYPE_ACCOMPLICE)
		{
			$accomplices[] = $member->getUserId();
		}
		elseif ($member->getType() === MemberTable::MEMBER_TYPE_AUDITOR)
		{
			$auditors[] = $member->getUserId();
		}
	}

	$taskData = [
		'ID' => $task->getId(),
		'TITLE' => $task->getTitle(),
		'DESCRIPTION' => $task->getDescription(),
		'SE_TAG' => $tags,
		'GROUP_ID' => $task->getGroupId(),
		'SITE_ID' => $task->getSiteId(),
		'CREATED_BY' => $task->getCreatedBy(),
		'RESPONSIBLE_ID' => $task->getResponsibleId(),
		'ACCOMPLICES' => $accomplices,
		'AUDITORS' => $auditors,
	];
	if ($task->getChangedDate())
	{
		$taskData['CHANGED_DATE'] = $task->getChangedDate()->toString();
	}
	if ($task->getCreatedDate())
	{
		$taskData['CREATED_DATE'] = $task->getCreatedDate()->toString();
	}

	BitrixTasksIntegrationSearchTask::index($taskData);
	SearchIndex::setTaskSearchIndex($this->taskId);
}

Добавить комментарий