Skip to content

Commit

Permalink
remove unnecessary index writer creation code
Browse files Browse the repository at this point in the history
  • Loading branch information
QilongTang committed Oct 16, 2023
1 parent 5f30633 commit fd170d1
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions src/DynamoCore/Utilities/LuceneSearchUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);
}
}
Expand Down

0 comments on commit fd170d1

Please sign in to comment.