Check for NRT directory when populating LuceneIndexFolder
This commit is contained in:
committed by
Sebastiaan Janssen
parent
0f539088fa
commit
a48a70595a
@@ -60,10 +60,17 @@ public class LuceneIndexDiagnostics : IIndexDiagnostics
|
||||
["LuceneDirectory"] = luceneDir.GetType().Name
|
||||
};
|
||||
|
||||
if (luceneDir is FSDirectory fsDir)
|
||||
var directoryPath = luceneDir switch
|
||||
{
|
||||
NRTCachingDirectory nrtDir => nrtDir.Delegate.ToString(),
|
||||
FSDirectory fsDir => fsDir.Directory.ToString(),
|
||||
_ => null
|
||||
};
|
||||
|
||||
if (directoryPath != null)
|
||||
{
|
||||
var rootDir = _hostingEnvironment.ApplicationPhysicalPath;
|
||||
d["LuceneIndexFolder"] = fsDir.Directory.ToString().ToLowerInvariant()
|
||||
d["LuceneIndexFolder"] = directoryPath.ToLowerInvariant()
|
||||
.TrimStart(rootDir.ToLowerInvariant()).Replace("\\", " /").EnsureStartsWith('/');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user