Skip to content

Commit

Permalink
Fixes stupid medium trust issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Shazwazza committed Jul 14, 2020
1 parent b1fcf3b commit aecea6b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 30 deletions.
6 changes: 3 additions & 3 deletions src/Examine.Test/SerializableDictionaryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void SerializableDictionaryTest_Save_Buffer_To_Disk_Read_From_Disk()
};

//act
var file = new FileInfo(Path.Combine(Environment.CurrentDirectory, "BufferedSerializedDictionary.txt"));
var file = new FileInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "BufferedSerializedDictionary.txt"));
target.SaveToDisk(file);

//assert
Expand Down Expand Up @@ -77,7 +77,7 @@ public void SerializableDictionaryTest_Save_To_Disk_Read_From_Disk()
};

//act
var file = new FileInfo(Path.Combine(Environment.CurrentDirectory, "SerializedDictionary.txt"));
var file = new FileInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "SerializedDictionary.txt"));
target.SaveToDisk(file);

//assert
Expand All @@ -103,7 +103,7 @@ public void SerializableDictionaryTest_Invalid_Encoding()
DictionaryExtensions.DefaultFileEncoding = Encoding.ASCII;

//act
var file = new FileInfo(Path.Combine(Environment.CurrentDirectory, "SerializedDictionary.txt"));
var file = new FileInfo(Path.Combine(TestContext.CurrentContext.WorkDirectory, "SerializedDictionary.txt"));
target.SaveToDisk(file);

//assert
Expand Down
1 change: 1 addition & 0 deletions src/Examine/Examine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
<Compile Include="IndexOperationType.cs" />
<Compile Include="LuceneEngine\Directories\IDirectoryFactory.cs" />
<Compile Include="LuceneEngine\Providers\ErrorCheckingScoringBooleanQueryRewrite.cs" />
<Compile Include="LuceneEngine\Providers\ErrorLoggingConcurrentMergeScheduler.cs" />
<Compile Include="LuceneEngine\Providers\LuceneIndexer.cs" />
<Compile Include="LuceneEngine\Providers\LuceneMemorySearcher.cs" />
<Compile Include="LuceneEngine\Providers\LuceneSearcher.cs" />
Expand Down
27 changes: 0 additions & 27 deletions src/Examine/LuceneEngine/Providers/LuceneIndexer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,33 +26,6 @@

namespace Examine.LuceneEngine.Providers
{
/// <summary>
/// Used to prevent the appdomain from crashing when lucene runs into a concurrent merge scheduler failure
/// </summary>
internal class ErrorLoggingConcurrentMergeScheduler : ConcurrentMergeScheduler
{
private readonly Action<string, Exception> _logger;

public ErrorLoggingConcurrentMergeScheduler(string indexName, Action<string, Exception> logger)
{
IndexName = indexName;
_logger = logger;
}

public string IndexName { get; }

protected override void HandleMergeException(System.Exception exc)
{
try
{
base.HandleMergeException(exc);
}
catch (Exception e)
{
_logger($"Concurrent merge failed for index: {IndexName} if this error is persistent then index rebuilding is necessary", e);
}
}
}

///<summary>
/// Abstract object containing all of the logic used to use Lucene as an indexer
Expand Down

0 comments on commit aecea6b

Please sign in to comment.