Is it possible to call the clear and reindex programmatically in Optimizely 11? I want to create a job that will clear and reindex so it will part of the release process.
Is it possible to call the clear and reindex programmatically in Optimizely 11? I want to create a job that will clear and reindex so it will part of the release process.
https://support.optimizely.com/hc/en-us/articles/4413200747789-Clear-the-index-and-reindex
You would typically use the ContentIndexer.Instance
implementation.
To remove, use the ContentIndexer.Instance.RemoveFromIndex()
implementation
To clear the index I've done something like this
// 1 is root, adjust to your preference
var entryPoint = new ContentReference(1);
// Get all indexable languages from Find
var languages = SearchClient.Instance.Settings.Languages;
languages.ForEach(x => ContentIndexer.Instance.RemoveFromIndex(contentLink: entryPoint, cascade: true, language: x.FieldSuffix));
To reindex
ContentIndexer.Instance.IndexAll();