Skip to content

Commit

Permalink
Add LUCENENET-specific backport comment, fix test name
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirwin committed Oct 29, 2024
1 parent 0316874 commit 8c2c048
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
13 changes: 7 additions & 6 deletions src/Lucene.Net.Tests/Index/TestIndexWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -818,23 +818,24 @@ public virtual void TestMaxThreadPriority()

private Dictionary<String, String> GetCommitData(IndexWriter writer)
{
Dictionary<String, String> data = new Dictionary<String, String>();
Dictionary<String, String> data = new Dictionary<String, String>();
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<String, String>()
new Dictionary<String, String>()
{
{ "key", "value" },
});
Expand All @@ -850,11 +851,11 @@ public void testGetCommitDataFromOldSnapshot()
conf.SetIndexDeletionPolicy(new SnapshotDeletionPolicy(NoDeletionPolicy.INSTANCE));
writer = new IndexWriter(dir, conf);
writer.SetCommitData(
new Dictionary<String, String>()
new Dictionary<String, String>()
{
{"key", "value2" },
});

assertEquals("value2", GetCommitData(writer).GetValueOrDefault("key"));

Check failure on line 859 in src/Lucene.Net.Tests/Index/TestIndexWriter.cs

View workflow job for this annotation

GitHub Actions / Test (windows-latest, net48, x64, Release)

'Dictionary<string, string>' does not contain a definition for 'GetValueOrDefault' and no accessible extension method 'GetValueOrDefault' accepting a first argument of type 'Dictionary<string, string>' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 859 in src/Lucene.Net.Tests/Index/TestIndexWriter.cs

View workflow job for this annotation

GitHub Actions / Test (windows-latest, net48, x64, Release)

'Dictionary<string, string>' does not contain a definition for 'GetValueOrDefault' and no accessible extension method 'GetValueOrDefault' accepting a first argument of type 'Dictionary<string, string>' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 859 in src/Lucene.Net.Tests/Index/TestIndexWriter.cs

View workflow job for this annotation

GitHub Actions / Test (windows-latest, net472, x64, Release)

'Dictionary<string, string>' does not contain a definition for 'GetValueOrDefault' and no accessible extension method 'GetValueOrDefault' accepting a first argument of type 'Dictionary<string, string>' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 859 in src/Lucene.Net.Tests/Index/TestIndexWriter.cs

View workflow job for this annotation

GitHub Actions / Test (windows-latest, net472, x64, Release)

'Dictionary<string, string>' does not contain a definition for 'GetValueOrDefault' and no accessible extension method 'GetValueOrDefault' accepting a first argument of type 'Dictionary<string, string>' could be found (are you missing a using directive or an assembly reference?)
writer.Dispose();

Expand Down
9 changes: 5 additions & 4 deletions src/Lucene.Net/Index/SegmentInfos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,8 @@ internal static string SegmentNumberToString(long segment, bool allowLegacyNames
private JCG.List<SegmentCommitInfo> segments = new JCG.List<SegmentCommitInfo>();

/// <summary>
/// If non-null, information about loading segments_N files
/// will be printed here.</summary>
/// If non-null, information about loading segments_N files
/// will be printed here.</summary>
/// <seealso cref="InfoStream"/>
private static TextWriter infoStream = null;

Expand Down Expand Up @@ -891,7 +891,7 @@ public object Clone()
/// If non-null, information about retries when loading
/// the segments file will be printed to this.
/// </summary>
public static TextWriter InfoStream
public static TextWriter InfoStream
{
set =>
// LUCENENET specific - use a SafeTextWriterWrapper to ensure that if the TextWriter
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -1612,7 +1613,7 @@ internal void Remove(int index)
}

/// <summary>
/// Return true if the provided
/// Return true if the provided
/// <see cref="SegmentCommitInfo"/> is contained.
///
/// <para/><b>WARNING</b>: O(N) cost
Expand Down

0 comments on commit 8c2c048

Please sign in to comment.