Question

In my Umbraco project, I have multiple Examine IndexSets defined in the configuration files. How can I programmatically retrieve an individual IndexSet's path?

I am aware of the Examine.LuceneEngine.Config.IndexSetCollection but I cannot seem to get a populated instance of this object.

Was it helpful?

Solution

I have found the answer myself, so I thought I would share it:

IndexSetCollection sets = Examine.LuceneEngine.Config.IndexSets.Instance.Sets;
IndexSet set = sets["Set_Name"];
DirectoryInfo dir = set.IndexDirectory;
string path = Path.Combine(dir.FullName, "Index");

And obviously I have all the properties of the set's directory from DirectoryInfo object too.

Hope this helps someone.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top