Change the location of the Lucene search index files
When using the default Sitefinity CMS search service (Lucene), the search index definition (configurations which content to be indexed) is stored in your website database, and the actual search index files – on the file system. By default, the search index files are in the ~/App_Data/Sitefinity/Search/ folder. Sitefinity CMS enables you to change this location. This is useful in cases where you don’t want the search index files stored in the App_Data folder, or you want to store them on a network location and reuse them on multiple instances of your project.
To change the search index files location, follow these steps:
- Navigate to your Sitefinity CMS administrative backend
- Click on Administration -> Settings
- From the left-hand side menu select Search
- On the screen that opens, locate the Index folder configuration property under Lucene Settings section
- Enter the desired location for storing the search indexes
- Click on Save changes
IMPORTANT: You must specify an application relative path, for example ~/MyDesiredSearchIndexFolder. Sitefinity CMS resolves the specified path using ASP.NET API (
HostingEnvironment.MapPath), and you must follow this required syntax.
IMPORTANT: You must make sure the AppPool identity, your website is running under, has read/write permissions over the specified folder.
Storing search indexes on a network location
In certain scenarios you might need to store the search indexes in a location external from your website file structure. This option can be used if you want to share the search indexes among your web server nodes in a load balancing configuration. To use this option, you must add a virtual directory to your website in IIS, and have that virtual directory point to the desired network folder location. Use the alias you’ve given for your virtual directory to configure the Index folder setting in Sitefinity CMS as explained earlier in this article. For example, if your network folder is accessed at //share/MySearchIndexesFolder and you mapped a virtual directory in IIS with alias SharedSearchIndexes, you must specify ~/SharedSearchIndexes for the Index folder setting value.
NOTE: When running in load balanced setup, we recommend using a shared network folder for your search indexes only if you are not doing intensive content editing. This approach works optimally when you are not editing content at all, and you only need to ensure all nodes use the same search index files, or your content editors work on separate sections of the backend, thus the possibility for two people to edit simultaneously the same item is minimal. When multiple people edit the same item in the backend, Sitefinity CMS does not have control over the Lucene implementation for locking the index files for writing, thus some changes might not be reflected in the search index if the files are locked for editing at the moment of publishing an item. For more intensive content editing scenarios in load balanced setup we recommend using a cloud search service. For more information about using cloud search services with Sitefintiy CMS see Generate and store search indexes in the cloud.