admin管理员组

文章数量:1315809

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/hc/en-us/articles/4413200747789-Clear-the-index-and-reindex

Share Improve this question edited Jan 30 at 6:07 DarkBee 15.6k8 gold badges72 silver badges117 bronze badges asked Jan 30 at 2:10 user3928241user3928241 1631 gold badge3 silver badges10 bronze badges 1
  • 1 What did they say when you asked them? – mjwills Commented Jan 30 at 2:55
Add a comment  | 

1 Answer 1

Reset to default 1

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();

本文标签: cClear index and reindex programmaticallyStack Overflow