Skip to content

Commit a48a705

Browse files
Jeavonnul800sebastiaan
authored andcommitted
Check for NRT directory when populating LuceneIndexFolder
1 parent 0f53908 commit a48a705

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/Umbraco.Examine.Lucene/LuceneIndexDiagnostics.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,17 @@ public LuceneIndexDiagnostics(
6060
["LuceneDirectory"] = luceneDir.GetType().Name
6161
};
6262

63-
if (luceneDir is FSDirectory fsDir)
63+
var directoryPath = luceneDir switch
64+
{
65+
NRTCachingDirectory nrtDir => nrtDir.Delegate.ToString(),
66+
FSDirectory fsDir => fsDir.Directory.ToString(),
67+
_ => null
68+
};
69+
70+
if (directoryPath != null)
6471
{
6572
var rootDir = _hostingEnvironment.ApplicationPhysicalPath;
66-
d["LuceneIndexFolder"] = fsDir.Directory.ToString().ToLowerInvariant()
73+
d["LuceneIndexFolder"] = directoryPath.ToLowerInvariant()
6774
.TrimStart(rootDir.ToLowerInvariant()).Replace("\\", " /").EnsureStartsWith('/');
6875
}
6976

0 commit comments

Comments
 (0)