Is there a way to get the index root.
I am able to find the current index using the following code
indexService.GetContentIndexName()
How can I get the current Root defined inside the index ?
Is there a way to get the index root.
I am able to find the current index using the following code
indexService.GetContentIndexName()
How can I get the current Root defined inside the index ?
The simplest code would be like that:
var crawler = Sitecore.ContentSearch.ContentSearchManager.GetIndex(indexName).Crawlers.First() as SitecoreItemCrawler;
string rootString = crawler.Root;
Item rootItem = crawler.RootItem;
It assumes that there is one crawler defined only.
You should add some null checks, but I skipped them for clarity.