Domanda

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.

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top