Documentation

Index

int
CSearch::Index( string MODULE_ID, string ITEM_ID, array arFields, bool bOverWrite = false, string SEARCH_SESS_ID = '' );

Method re-indexes a singular position (a post post, news item and etc.). The combination (MODULE_ID, ITEM_ID) is used to specify the re-indexed document. Static method.

At the start of indexing the BeforeIndex event is called. Then the user weight for the position is calculated. Then, the re-indexing itself is performed.

Method parameters

Parameter DescriptionAvailable from version
MODULE_ID Code of the module, to which the indexed element belongs to.
ITEM_ID Code of the indexed element.
arFields Array of indexed element properties.
bOverWrite Rewrite the search index for the element, if the element has already been indexed. Optional parameter, equals false by default.
SEARCH_SESS_ID Service parameter, used during incremental re-indexing.

Examples of use

<?
CSearch::Index(
"iblock",
$ID,
Array(
"DATE_CHANGE"=>$arIBlockElement["DATE_CHANGE"],
"TITLE"=>$arIBlockElement["NAME"],
"SITE_ID"=>$arSites,
"PARAM1"=>$arIBlockElement["IBLOCK_TYPE_ID"],
"PARAM2"=>$IBLOCK_ID,
"PERMISSIONS"=>$arGroups,
"URL"=>str_replace("#ID#", $arIBlockElement["ID"], $DETAIL_PAGE_URL),
"BODY"=>$arIBlockElement["DETAIL_TEXT"],
"TAGS"=>$arIBlockElement["TAGS"]
),
$bOverWrite
);
?>


© «Bitrix24», 2001-2024
Up