Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
QilongTang committed Oct 25, 2023
1 parent bfe91af commit 1b8456c
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/DynamoCore/Utilities/LuceneSearchUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ internal class LuceneSearchUtility
/// </summary>
internal LuceneStartConfig startConfig;

/// <summary>
/// Index open mode for Lucene index writer
/// </summary>
internal OpenMode openMode { get; set; }

/// <summary>
/// Default start config for Lucene, it will use RAM storage type and empty directory
/// </summary>
Expand Down Expand Up @@ -137,7 +132,7 @@ internal void InitializeLuceneConfig()
/// <summary>
/// Create index writer for followup doc indexing
/// </summary>
/// <param name="mode"></param>
/// <param name="mode">Index open mode for Lucene index writer</param>
internal void CreateLuceneIndexWriter(OpenMode mode = OpenMode.CREATE)
{
// Create an index writer
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 1b8456c

Please sign in to comment.