indexingravendbravendb4

RavenDB 4 - Retrieve index name given its AbstractIndexCreationTask<TDocument, TReduceResult> class implementation


As for the title, I'm trying to retrieve the name of a specific index at runtime.

The indexes are already registered at application startup with the

IndexCreation.CreateIndexes(/*[assembly]*/, documentStore);

But at query time I need to know (for some specificity of the project...) the actual name of the index that's queried.

I know there's a GetIndexNamesOperation but it is just returning an array of string and I'll not be able to associate it with the actual index class...

The ideal would be something operating with the typeof(IndexClass<T, R>) where IndexClass<T, R> : AbstractIndexCreationTask<T, R>.

I'm searching through the documentations but I'm not finding any clue.

Is there a way?


Solution

  • When you query an index you have the name under IndexName variable. enter image description here