Troubleshooting Smart search with external storage
If you are utilizing external storage when running a Kentico application either in the cloud environment or on-premise, at some point you might have run into issues when rebuilding your Smart search indexes or processing tasks.
When you are hosting your application on Azure Cloud Services, you have an option to take advantage of the Smart Search worker role which is a part of a Kentico Azure project. In any other Azure or Amazon hosting option and on-premise environment, you need to use a scheduler to process Smart search tasks which can potentially cause some problems.
Below you can find a checklist of things you should be aware of and ideally avoid as well as some suggestions which can help you resolve rebuilding issues:
- Do not deploy your project with Smart search indexes included. Always make sure ~/CMS/App_Data/CMSModules/SmartSearch folder is excluded or its content is completely empty.
- Check for "write.lock" and "searchtaskindexer.lock" files in Smart search and index folders (~/CMS/App_Data/CMSModules/SmartSearch/<your index>) and if you find any there, delete them. That includes a local file system and your external storage as well. These files are created whenever an index is being rebuilt and basically locks it to avoid simultaneous access to the folder by other processes. However, if the rebuild action fails for some reason, occassionally the .lock files might still be hanging in there.
- Delete all failed tasks in the Smart search application -> Tasks list.
- Make sure the <add key="CMSProcessSearchTasksByScheduler"value="true"/> settings key is added in your web.config file which enforces processing of Smart search tasks by a scheduler and enable the "Execute search tasks" scheduled task and set it to a reasonable interval for execution.
After checking all these points, the index rebuild action should be finished successfully and your index should start working correctly.
Some more details about a few of the mentioned issues can be found in documentation – Troubleshooting Smart search on Azure.