How can I find an IndexSet's path in Examine?

坚强是说给别人听的谎言 提交于 2019-12-13 19:51:18

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!