From 8c2c04862fd3ed179a26784cd6901aff11f1afb9 Mon Sep 17 00:00:00 2001 From: Paul Irwin Date: Mon, 28 Oct 2024 19:42:28 -0600 Subject: [PATCH] Add LUCENENET-specific backport comment, fix test name --- src/Lucene.Net.Tests/Index/TestIndexWriter.cs | 13 +++++++------ src/Lucene.Net/Index/SegmentInfos.cs | 9 +++++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriter.cs b/src/Lucene.Net.Tests/Index/TestIndexWriter.cs index ed36930e87..9716bee0ad 100644 --- a/src/Lucene.Net.Tests/Index/TestIndexWriter.cs +++ b/src/Lucene.Net.Tests/Index/TestIndexWriter.cs @@ -818,23 +818,24 @@ public virtual void TestMaxThreadPriority() private Dictionary GetCommitData(IndexWriter writer) { - Dictionary data = new Dictionary(); + Dictionary data = new Dictionary(); foreach (var ent in writer.CommitData) { data.Put(ent.Key, ent.Value); - } + } return data; } + // LUCENENET-specific: backport fix and test from Lucene 9.9.0 (lucene#12626, lucene#12637) [Test] - public void testGetCommitDataFromOldSnapshot() + public void TestGetCommitDataFromOldSnapshot() { Directory dir = NewDirectory(); IndexWriterConfig conf = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random)).SetMaxBufferedDocs(2).SetMergePolicy(NewLogMergePolicy()); conf.SetIndexDeletionPolicy(new SnapshotDeletionPolicy(NoDeletionPolicy.INSTANCE)); IndexWriter writer = new IndexWriter(dir, conf); writer.SetCommitData( - new Dictionary() + new Dictionary() { { "key", "value" }, }); @@ -850,11 +851,11 @@ public void testGetCommitDataFromOldSnapshot() conf.SetIndexDeletionPolicy(new SnapshotDeletionPolicy(NoDeletionPolicy.INSTANCE)); writer = new IndexWriter(dir, conf); writer.SetCommitData( - new Dictionary() + new Dictionary() { {"key", "value2" }, }); - + assertEquals("value2", GetCommitData(writer).GetValueOrDefault("key")); writer.Dispose(); diff --git a/src/Lucene.Net/Index/SegmentInfos.cs b/src/Lucene.Net/Index/SegmentInfos.cs index 792159648c..eb208f4243 100644 --- a/src/Lucene.Net/Index/SegmentInfos.cs +++ b/src/Lucene.Net/Index/SegmentInfos.cs @@ -305,8 +305,8 @@ internal static string SegmentNumberToString(long segment, bool allowLegacyNames private JCG.List segments = new JCG.List(); /// - /// If non-null, information about loading segments_N files - /// will be printed here. + /// If non-null, information about loading segments_N files + /// will be printed here. /// private static TextWriter infoStream = null; @@ -891,7 +891,7 @@ public object Clone() /// If non-null, information about retries when loading /// the segments file will be printed to this. /// - public static TextWriter InfoStream + public static TextWriter InfoStream { set => // LUCENENET specific - use a SafeTextWriterWrapper to ensure that if the TextWriter @@ -1452,6 +1452,7 @@ internal void Replace(SegmentInfos other) { RollbackSegmentInfos(other.AsList()); lastGeneration = other.lastGeneration; + // LUCENENET-specific: backport fix from Lucene 9.9.0 (lucene#12626, lucene#12637) userData = other.userData; } @@ -1612,7 +1613,7 @@ internal void Remove(int index) } /// - /// Return true if the provided + /// Return true if the provided /// is contained. /// /// WARNING: O(N) cost