Loading...
 

Cron Job to Rebuild Search Index


You can rebuild index by visiting example.com/tiki-admin.php?page=search&rebuild=now

Since Tiki9, if you have a large site and do not use MySQL Full Text search, you should set up a Cron job to regularly rebuild the index.

How to do it varies from server to server, but here is an example. For a fuller description of the commands themselves, please see Unified Index - from the command line

Add this line for a daily rebuild in Tiki11 and up
Copy to clipboard
0 0 * * * cd /var/www/html/tiki; php console.php index:rebuild >/dev/null 2>&1

To set RAM to 4 GB, increase max execution time, force an initial index cleanup and log
Copy to clipboard
0 0 * * * cd /var/www/html/tiki; php -dmemory_limit=4G -dmax_execution_time=300 console.php index:rebuild --force --log >/dev/null 2>&1

 Tips
  • The last part ">/dev/null 2>&1" indicates to discard the output from the command (standard output and any errors messages produced).
  • The first 5 characters (separated by spaces) of the command set the time and frequency that the cron job will run. The characters refer to (in order): minute, hour, day, month, and weekday. So the above (0 0 * * * ) will run at midnight (0 minutes and 0 hour) every night.

List Slides
Cron Job to Rebuild Search Index You can rebuild index by visiting example.com/tiki-admin.php?page=search&rebuild=now Since Tiki9 , if you have a large site and do not use MySQL Full Text search, you should set up a Cron job to regularly rebuild the index. How to do it varies from server to server, but here is an example. For a fuller description of the commands themselves, please see Unified Index - from the command line Add this line for a daily rebuild in Tiki11 and up Copy to clipboard 0 0 * * * cd /var/www/html/tiki; php console.php index:rebuild >/dev/null 2>&1 To set RAM to 4 GB, increase max execution time, force an initial index cleanup and log Copy to clipboard 0 0 * * * cd /var/www/html/tiki; php -dmemory_limit=4G -dmax_execution_time=300 console.php index:rebuild --force --log >/dev/null 2>&1 Tips The last part " >/dev/null 2>&1 " indicates to discard the output from the command (standard output and any errors messages produced). The first 5 characters (separated by spaces) of the command set the time and frequency that the cron job will run. The characters refer to (in order): minute, hour, day, month, and weekday. So the above (0 0 * * * ) will run at midnight (0 minutes and 0 hour) every night.