问题
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.
回答1:
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.
来源:https://stackoverflow.com/questions/7093811/how-can-i-find-an-indexsets-path-in-examine