• Модуль: socialnetwork
  • Путь к файлу: ~/bitrix/modules/socialnetwork/classes/general/search.php
  • Класс: CSocNetSearch
  • Вызов: CSocNetSearch::IndexIBlockSection
function IndexIBlockSection($arFields, $entity_id, $entity_type, $feature, $operation, $path_template)
{
	global $CACHE_MANAGER;

	$path = array();
	$rsPath = CIBlockSection::GetNavChain($arFields["IBLOCK_ID"], $arFields['ID']);
	while ($arPath = $rsPath->Fetch())
	{
		$path[] = $arPath['NAME'];
	}
	$path = implode("/", array_slice($path, 1));

	$ID = (int)$arFields["ID"];
	$IBLOCK_ID = (int)$arFields["IBLOCK_ID"];

	if($entity_type === "G")
		$url = str_replace(
			array("#group_id#", "#user_alias#", "#section_id#", "#element_id#", "#action#", "#task_id#", "#name#", "#path#"),
			array($entity_id, "group_".$entity_id, $arFields["IBLOCK_SECTION"], $arFields["ID"], "view", $arFields["ID"], rawurlencode($arFields["NAME"]), $path),
			$path_template
		);
	else
		$url = str_replace(
			array("#user_id#", "#user_alias#", "#section_id#", "#element_id#", "#action#", "#task_id#", "#path#"),
			array($entity_id, "user_".$entity_id, $arFields["IBLOCK_SECTION"], $arFields["ID"], "view", $arFields["ID"], $path),
			$path_template
		);

	$body = "";

	$title = $arFields["NAME"];

	$arPermissions = self::GetSearchGroups(
		$entity_type,
		$entity_id,
		$feature,
		$operation
	);

	if (CIBlock::GetArrayByID($IBLOCK_ID, "RIGHTS_MODE") === "E")
	{
		$obSectionRights = new CIBlockSectionRights($IBLOCK_ID, $arFields["ID"]);
		$arPermissions = $obSectionRights->GetGroups(array("section_read"));
	}

	$arSearchIndexParams = self::GetSearchParams(
		$entity_type,
		$entity_id,
		$feature,
		$operation
	);

	CSearch::Index("socialnetwork", 'S'.$ID, array(
		"LAST_MODIFIED" => ConvertTimeStamp(time()+CTimeZone::GetOffset(), "FULL"),
		"TITLE" => $title,
		"BODY" => $body,
		"SITE_ID" => array(SITE_ID => $url),
		"PARAM1" => CIBlock::GetArrayByID($IBLOCK_ID, "IBLOCK_TYPE_ID"),
		"PARAM2" => $IBLOCK_ID,
		"PARAM3" => $feature,
		"TAGS" => "",
		"PERMISSIONS" => $arPermissions,
		"PARAMS" => $arSearchIndexParams,
	), true);

	if(defined("BX_COMP_MANAGED_CACHE"))
	{
		$CACHE_MANAGER->ClearByTag("sonet_search_".$entity_type."_".$entity_id);
	}
}