From 1b8456cbef867a2c6556d8af004aecbb3ec24b19 Mon Sep 17 00:00:00 2001 From: "Aaron (Qilong)" Date: Wed, 25 Oct 2023 01:42:49 -0400 Subject: [PATCH] Update --- src/DynamoCore/Utilities/LuceneSearchUtility.cs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) 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);