如何在“检查"中找到IndexSet的路径? [英] How can I find an IndexSet's path in Examine?

查看:73
本文介绍了如何在“检查"中找到IndexSet的路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Umbraco项目中,我在配置文件中定义了多个检查索引集.如何以编程方式检索单个IndexSet的路径?

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

我知道Examine.LuceneEngine.Config.IndexSetCollection,但似乎无法获得该对象的填充实例.

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

推荐答案

我自己找到了答案,所以我想与大家分享:

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");

显然,我也从DirectoryInfo对象获得了集合目录的所有属性.

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

希望这对某人有帮助.

这篇关于如何在“检查"中找到IndexSet的路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆