The search index rebuild process has undergone some substantial changes in Elastic Path 6.1, making it more robust and more usable.
In the past, to trigger a search index rebuild, you needed to manually modify the contents of some properties files on the search server. This is no longer supported. Now, Commerce Manager users with the proper permissions can initiate search index rebuilds.
In the Activity menu, choose Configuration. In the Configuration page on the left, under System Administration, click Search Indexes.
Select an index in the list, and click Rebuild Index. The rebuild should now be scheduled and the status column will show Rebuild is Scheduled.
When the index rebuild begins, the status column for the index being rebuilt will contain Rebuild in Progress. Note that you can rebuild multiple indexes at the same time. When the rebuild is done, the status is changed to Complete.
When the user runs an index rebuild from the Commerce Manager client, this is what happens behind the scenes:
- The TINDEXNOTIFY table in the database contains a row for each search index. When the user clicks Rebuild Index, the UPDATE_TYPE column for that search index's row is set to REBUILD.
- The quartz.xml in com.elasticpath.search/WEB-INF/conf/spring/scheduling defines several Quartz jobs that check to see if the search indexes need to be rebuilt. Each time one of these scheduled jobs is triggered, it calls the method buildIndexJobRunner method in the AbstractIndexService and passes it a search index identifier. This method checks the TINDEXNOTIFY database table to see if the corresponding index needs to be rebuilt (if the value is REBUILD), has never been built, or if a previous rebuild was interrupted and did not complete successfully. If any of those conditions are true, a rebuild of that index is initiated.
- When an index rebuild is initiated, the INDEX_STATUS column in the TINDEXBUILDSTATUS table is set to REBUILD_IN_PROGRESS.
- After the index has finished rebuilding, the INDEX_STATUS column is set to COMPLETE.
You can monitor the status of rebuild process by checking the Status column in the search index list.
Finally, search index rebuilds are now more resilient to failures. If an index build is interrupted or fails to complete normally, the system will try to build it again on server startup or at the start of the next quartz job. If there is a rebuild in progress for an index and another rebuild for that index is requested by the user, the system will wait until the first rebuild is complete before processing the second request.