CSearch::ReIndexAll( bool bFull = false, int max_execution_time = 0, array NS = Array(), bool clear_suggest = false );

The incremental re-indexing method. For a module to be re-indexed, it must provide corresponding method, which must be registered in the event system as the OnReIndex event handler for the "search" module. Static method.

When the method finishes working, either time or a "step" is triggered, depending on which "finishes" working sooner.

Note: this method uses internal transaction. If you use MySQL and InnoDB, and a transaction was opened previously, then it must be closed prior to connecting the method.

Method parameters

Parameter Description Available from version
bFull If equals true, then the search index will be completely cleaned on the first step. Equals false by default, which leads to rebuilding index only for those elements, which content was modified.
max_execution_time If specified and greater than zero, then as soon as the method execution time exceeds the value of this parameter, the execution of method will terminate. The data to start the next step will be returned as the result of the method's operation.
NS Stores the indexing process state (progress) at the start of the step.
clear_suggest Deletes history/statistics for the search string suggestions. Optional parameter, equals false by default.

Returned value

The method returns an array, if the method must be called one more time. Or returns the number of the indexed elements, if the re-indexing is completed.

See Also

Examples of use

//It is not the incremental indexing example.
//For this, call the ReIndexAll method only once per a script launch.
//And the intermediate state (NS) can be saved in the file, for example.

$NS = false;
$NS = CSearch::ReIndexAll(false, 60, $NS);
$NS = CSearch::ReIndexAll(false, 60, $NS);
echo $NS;


© «Bitrix24», 2001-2024