Skip to content

Commit

Permalink
try again
Browse files Browse the repository at this point in the history
  • Loading branch information
Shazwazza committed Jul 19, 2024
1 parent 328dcd8 commit 5fb1fd1
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private void CreateIndex(string rootPath, bool corruptIndex, bool removeSegments
var logger = LoggerFactory.CreateLogger<SyncedFileSystemDirectoryFactoryTests>();

var indexPath = Path.Combine(rootPath, TestIndex.TestIndexName);
logger.LogInformation("Creating index at " + indexPath);
logger.LogInformation($"Creating index at {indexPath} with options: corruptIndex: {corruptIndex}, removeSegments: {removeSegments}");

using var luceneDir = FSDirectory.Open(indexPath);

Expand Down Expand Up @@ -149,11 +149,11 @@ private void CreateIndex(string rootPath, bool corruptIndex, bool removeSegments

if (corruptIndex)
{
CorruptIndex(luceneDir.Directory, removeSegments);
CorruptIndex(luceneDir.Directory, removeSegments, logger);
}
}

private void CorruptIndex(DirectoryInfo dir, bool removeSegments)
private void CorruptIndex(DirectoryInfo dir, bool removeSegments, ILogger logger)
{
// Get an index (non segments file) and delete it (corrupt index)
var indexFile = dir.GetFiles()
Expand All @@ -162,7 +162,7 @@ private void CorruptIndex(DirectoryInfo dir, bool removeSegments)
: !x.Name.Contains("segments", StringComparison.OrdinalIgnoreCase))
.First();

Console.WriteLine($"Deleting {indexFile.FullName}");
logger.LogInformation($"Deleting {indexFile.FullName}");
File.Delete(indexFile.FullName);
}
}
Expand Down

0 comments on commit 5fb1fd1

Please sign in to comment.