21 'IBLOCK.FULLTEXT_INDEX' =>
'Y',
25 $option[
"iblockIds"] ??= $this->prepareIblockIds();
27 if (empty(
$option[
"iblockIds"]))
29 return self::FINISH_EXECUTION;
33 'limit' => self::ELEMENT_LIMIT,
34 'select' => [
'ID',
'IBLOCK_ID',
'SEARCHABLE_CONTENT'],
36 '>ID' => (
int)
$option[
"lastElementId"],
37 '@IBLOCK_ID' =>
$option[
"iblockIds"],
39 'order' => [
'ID' =>
'ASC'],
43 while ($element = $elementData->fetch())
45 $elementId = $element[
"ID"];
47 $searchableContent = $element[
'SEARCHABLE_CONTENT'];
48 $option[
"lastElementId"] = $elementId;
50 $searchIndexParams = [
51 'ELEMENT_ID' => $elementId,
52 'SEARCH_CONTENT' => $searchableContent,
55 FullText::update(
$iblockId, $elementId, $searchIndexParams);
60 $option[
"steps"] += $elementCount;
62 return $elementCount === 0 ? self::FINISH_EXECUTION : self::CONTINUE_EXECUTION;
67 return Loc::getMessage(
'IBLOCK_ELEMENT_SEARCHABLE_CONTENT_TRANSFER');
70 private static function prepareIblockIds():
array
79 $catalogProductId = Catalog::getDefaultId();
80 $obIBlock = new \CAllIBlock();
82 if (isset($catalogProductId))
84 $obIBlock->Update($catalogProductId, [
'FULLTEXT_INDEX' =>
'Y']);
85 $iblockIds[] = $catalogProductId;
88 $catalogOffersId = Catalog::getDefaultOfferId();
90 if (isset($catalogOffersId))
92 $obIBlock->Update($catalogOffersId, [
'FULLTEXT_INDEX' =>
'Y']);
93 $iblockIds[] = $catalogOffersId;
static includeModule($moduleName)
static getList(array $parameters=array())
static getCount($filter=array(), array $cache=array())