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

2019-08-13 22:32发布

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条回答
欢心
2楼-- · 2019-08-13 23:00

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.

查看更多
登录 后发表回答