diff --git a/src/DynamoCore/Utilities/LuceneSearchUtility.cs b/src/DynamoCore/Utilities/LuceneSearchUtility.cs index b7528d37fff..a4bb9b87220 100644 --- a/src/DynamoCore/Utilities/LuceneSearchUtility.cs +++ b/src/DynamoCore/Utilities/LuceneSearchUtility.cs @@ -61,11 +61,6 @@ internal class LuceneSearchUtility /// internal LuceneStartConfig startConfig; - /// - /// Index open mode for Lucene index writer - /// - internal OpenMode openMode { get; set; } - /// /// Default start config for Lucene, it will use RAM storage type and empty directory /// @@ -137,7 +132,7 @@ internal void InitializeLuceneConfig() /// /// Create index writer for followup doc indexing /// - /// + /// Index open mode for Lucene index writer internal void CreateLuceneIndexWriter(OpenMode mode = OpenMode.CREATE) { // Create an index writer @@ -437,9 +432,9 @@ internal void AddNodeTypeToSearchIndex(NodeSearchElement node, Document doc) { if (addedFields == null) return; // During DynamoModel initialization, the index writer should still be valid here - // If the index writer is null and index not locked, it means the index writer has been disposed, most likely due to DynamoView already launched - // If the index writer is null and index locked, it means user is in a secondary Dynamo session - // Then create a new index writer to amend the index should be safe + // If the index writer is null and index not locked, it means the index writer has been disposed, e.g. DynamoModel finished initialization + // If the index writer is null and index locked, it means another Dynamo session is currently updating the search index + // Try to create a new index writer to amend the index if (writer == null && !IndexWriter.IsLocked(this.indexDir)) { CreateLuceneIndexWriter(OpenMode.CREATE_OR_APPEND);