diff --git a/src/DynamoCore/Utilities/LuceneSearchUtility.cs b/src/DynamoCore/Utilities/LuceneSearchUtility.cs index d126afed94e..dbf3274ce19 100644 --- a/src/DynamoCore/Utilities/LuceneSearchUtility.cs +++ b/src/DynamoCore/Utilities/LuceneSearchUtility.cs @@ -145,15 +145,10 @@ internal void CreateLuceneIndexWriter() } catch (LockObtainFailedException ex) { - try - { - writer = new IndexWriter(new RAMDirectory(), indexConfig); - (ExecutionEvents.ActiveSession.GetParameterValue(ParameterKeys.Logger) as DynamoLogger).LogError($"LuceneNET LockObtainFailedException {ex}, switching to RAM mode."); - } - catch(Exception) - { - DisposeWriter(); - } + + DisposeWriter(); + (ExecutionEvents.ActiveSession.GetParameterValue(ParameterKeys.Logger) as DynamoLogger).LogError($"LuceneNET LockObtainFailedException {ex}"); + } catch (Exception ex) { @@ -433,10 +428,6 @@ internal void AddNodeTypeToSearchIndex(NodeSearchElement node, Document doc) } SetDocumentFieldValue(doc, nameof(LuceneConfig.NodeFieldsEnum.Parameters), node.Parameters ?? string.Empty); - if(writer == null) - { - CreateLuceneIndexWriter(); - } writer?.AddDocument(doc); } }