From bf6118d0dec076a9c1cc28e47dad280626a26275 Mon Sep 17 00:00:00 2001 From: Shad Storhaug Date: Tue, 5 Nov 2024 18:13:00 +0700 Subject: [PATCH] SWEEP: Changed LUCENENET TODO to LUCENENET UPGRADE TODO for things that only apply to the next version of Lucene --- .../Analyzing/AnalyzingInfixSuggester.cs | 4 +-- .../Analyzing/BlendedInfixSuggester.cs | 4 +-- .../Analyzing/AnalyzingInfixSuggesterTest.cs | 32 +++++++++---------- .../Analyzing/BlendedInfixSuggesterTest.cs | 12 +++---- .../TestCompressingStoredFieldsFormat.cs | 2 +- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingInfixSuggester.cs b/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingInfixSuggester.cs index 7a62cee329..48e42b4778 100644 --- a/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingInfixSuggester.cs +++ b/src/Lucene.Net.Suggest/Suggest/Analyzing/AnalyzingInfixSuggester.cs @@ -138,7 +138,7 @@ public AnalyzingInfixSuggester(LuceneVersion matchVersion, Directory dir, Analyz /// ngrams (increasing index size but making lookups /// faster). // LUCENENET specific - LUCENE-5889, a 4.11.0 feature. calls new constructor with extra param. - // LUCENENET TODO: Remove method at version 4.11.0. Was retained for perfect 4.8 compatibility + // LUCENENET UPGRADE TODO: Remove method at version 4.11.0. Was retained for perfect 4.8 compatibility public AnalyzingInfixSuggester(LuceneVersion matchVersion, Directory dir, Analyzer indexAnalyzer, Analyzer queryAnalyzer, int minPrefixChars) : this(matchVersion, dir, indexAnalyzer, queryAnalyzer, minPrefixChars, commitOnBuild: false) @@ -896,4 +896,4 @@ public override long Count } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Suggest/Suggest/Analyzing/BlendedInfixSuggester.cs b/src/Lucene.Net.Suggest/Suggest/Analyzing/BlendedInfixSuggester.cs index d7d8f9756d..ffc6d4a245 100644 --- a/src/Lucene.Net.Suggest/Suggest/Analyzing/BlendedInfixSuggester.cs +++ b/src/Lucene.Net.Suggest/Suggest/Analyzing/BlendedInfixSuggester.cs @@ -105,7 +105,7 @@ public BlendedInfixSuggester(LuceneVersion matchVersion, Directory dir, Analyzer /// Factor to multiply the number of searched elements before ponderate /// If there are problems opening the underlying Lucene index. // LUCENENET specific - LUCENE-5889, a 4.11.0 feature. calls new constructor with extra param. - // LUCENENET TODO: Remove method at version 4.11.0. Was retained for perfect 4.8 compatibility + // LUCENENET UPGRADE TODO: Remove method at version 4.11.0. Was retained for perfect 4.8 compatibility public BlendedInfixSuggester(LuceneVersion matchVersion, Directory dir, Analyzer indexAnalyzer, Analyzer queryAnalyzer, int minPrefixChars, BlenderType blenderType, int numFactor) : this(matchVersion, dir, indexAnalyzer, queryAnalyzer, minPrefixChars, blenderType, numFactor, commitOnBuild: false) @@ -325,4 +325,4 @@ public virtual int Compare(Lookup.LookupResult o1, Lookup.LookupResult o2) } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingInfixSuggesterTest.cs b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingInfixSuggesterTest.cs index 56ccd4dda6..88d333ab5c 100644 --- a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingInfixSuggesterTest.cs +++ b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/AnalyzingInfixSuggesterTest.cs @@ -52,7 +52,7 @@ public void TestBasic() }; Analyzer a = new MockAnalyzer(Random, MockTokenizer.WHITESPACE, false); - using AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3); //LUCENENET TODO: add extra false param at version 4.11.0 + using AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3); //LUCENENET UPGRADE TODO: add extra false param at version 4.11.0 suggester.Build(new InputArrayEnumerator(keys)); IList results = suggester.DoLookup(TestUtil.StringToCharSequence("ear", Random).ToString(), 10, true, true); @@ -95,14 +95,14 @@ public void TestAfterLoad() DirectoryInfo tempDir = CreateTempDir("AnalyzingInfixSuggesterTest"); Analyzer a = new MockAnalyzer(Random, MockTokenizer.WHITESPACE, false); - AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, 3); //LUCENENET TODO: add extra false param at version 4.11.0 + AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, 3); //LUCENENET UPGRADE TODO: add extra false param at version 4.11.0 try { suggester.Build(new InputArrayEnumerator(keys)); assertEquals(2, suggester.Count); suggester.Dispose(); - suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, 3); //LUCENENET TODO: add extra false param at version 4.11.0 + suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, 3); //LUCENENET UPGRADE TODO: add extra false param at version 4.11.0 IList results = suggester.DoLookup(TestUtil.StringToCharSequence("ear", Random).ToString(), 10, true, true); assertEquals(2, results.size()); assertEquals("a penny saved is a penny earned", results[0].Key); @@ -145,7 +145,7 @@ public override string ToString() internal class TestHighlightAnalyzingInfixSuggester : AnalyzingInfixSuggester { public TestHighlightAnalyzingInfixSuggester(AnalyzingInfixSuggesterTest outerInstance, Analyzer a) - : base(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3) //LUCENENET TODO: add extra false param at version 4.11.0 + : base(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3) //LUCENENET UPGRADE TODO: add extra false param at version 4.11.0 { } @@ -254,7 +254,7 @@ public void TestRandomMinPrefixLength() Analyzer a = new MockAnalyzer(Random, MockTokenizer.WHITESPACE, false); int minPrefixLength = Random.nextInt(10); - AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, minPrefixLength); //LUCENENET TODO: add extra false param at version 4.11.0 + AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, minPrefixLength); //LUCENENET UPGRADE TODO: add extra false param at version 4.11.0 try { suggester.Build(new InputArrayEnumerator(keys)); @@ -330,7 +330,7 @@ public void TestRandomMinPrefixLength() // Make sure things still work after close and reopen: suggester.Dispose(); - suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, minPrefixLength); //LUCENENET TODO: add extra false param at version 4.11.0 + suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, minPrefixLength); //LUCENENET UPGRADE TODO: add extra false param at version 4.11.0 } } finally @@ -348,7 +348,7 @@ public void TestHighlight() }; Analyzer a = new MockAnalyzer(Random, MockTokenizer.WHITESPACE, false); - using AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3); //LUCENENET TODO: add extra false param at version 4.11.0 + using AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3); //LUCENENET UPGRADE TODO: add extra false param at version 4.11.0 suggester.Build(new InputArrayEnumerator(keys)); IList results = suggester.DoLookup(TestUtil.StringToCharSequence("penn", Random).ToString(), 10, true, true); assertEquals(1, results.size()); @@ -359,7 +359,7 @@ internal class TestHighlightChangeCaseAnalyzingInfixSuggester : AnalyzingInfixSu { private readonly AnalyzingInfixSuggesterTest outerInstance; public TestHighlightChangeCaseAnalyzingInfixSuggester(AnalyzingInfixSuggesterTest outerInstance, Analyzer a) - : base(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3) //LUCENENET TODO: add extra false param at version 4.11.0 + : base(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3) //LUCENENET UPGRADE TODO: add extra false param at version 4.11.0 { this.outerInstance = outerInstance; } @@ -381,7 +381,7 @@ public void TestHighlightCaseChange() Analyzer a = new MockAnalyzer(Random, MockTokenizer.WHITESPACE, true); IList results; - using (AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3)) //LUCENENET TODO: add extra false param at version 4.11.0 + using (AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3)) //LUCENENET UPGRADE TODO: add extra false param at version 4.11.0 { suggester.Build(new InputArrayEnumerator(keys)); results = suggester.DoLookup(TestUtil.StringToCharSequence("penn", Random).ToString(), 10, true, true); @@ -445,7 +445,7 @@ public void TestSuggestStopFilter() public void TestEmptyAtStart() { Analyzer a = new MockAnalyzer(Random, MockTokenizer.WHITESPACE, false); - using AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3); //LUCENENET TODO: add extra false param at version 4.11.0 + using AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3); //LUCENENET UPGRADE TODO: add extra false param at version 4.11.0 suggester.Build(new InputArrayEnumerator(new Input[0])); suggester.Add(new BytesRef("a penny saved is a penny earned"), null, 10, new BytesRef("foobaz")); suggester.Add(new BytesRef("lend me your ear"), null, 8, new BytesRef("foobar")); @@ -483,7 +483,7 @@ public void TestEmptyAtStart() public void TestBothExactAndPrefix() { Analyzer a = new MockAnalyzer(Random, MockTokenizer.WHITESPACE, false); - using AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3); //LUCENENET TODO: add extra false param at version 4.11.0 + using AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3); //LUCENENET UPGRADE TODO: add extra false param at version 4.11.0 suggester.Build(new InputArrayEnumerator(new Input[0])); suggester.Add(new BytesRef("the pen is pretty"), null, 10, new BytesRef("foobaz")); suggester.Refresh(); @@ -595,7 +595,7 @@ public void TestRandomNRT() Console.WriteLine(" minPrefixChars=" + minPrefixChars); } - AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, minPrefixChars); //LUCENENET TODO: add extra false param at version 4.11.0 + AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, minPrefixChars); //LUCENENET UPGRADE TODO: add extra false param at version 4.11.0 try { @@ -692,7 +692,7 @@ public void TestRandomNRT() } lookupThread.Finish(); suggester.Dispose(); - suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, minPrefixChars); //LUCENENET TODO: add extra false param at version 4.11.0 + suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, minPrefixChars); //LUCENENET UPGRADE TODO: add extra false param at version 4.11.0 lookupThread = new LookupThread(this, suggester); lookupThread.Start(); @@ -896,7 +896,7 @@ public void TestBasicNRT() }; Analyzer a = new MockAnalyzer(Random, MockTokenizer.WHITESPACE, false); - using AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3); //LUCENENET TODO: add extra false param at version 4.11.0 + using AnalyzingInfixSuggester suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewDirectory(), a, a, 3); //LUCENENET UPGRADE TODO: add extra false param at version 4.11.0 suggester.Build(new InputArrayEnumerator(keys)); IList results = suggester.DoLookup(TestUtil.StringToCharSequence("ear", Random).ToString(), 10, true, true); @@ -1053,13 +1053,13 @@ public void TestBasicContext() Analyzer a = new MockAnalyzer(Random, MockTokenizer.WHITESPACE, false); if (iter == 0) { - suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, 3); //LUCENENET TODO: add extra false param at version 4.11.0 + suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, 3); //LUCENENET UPGRADE TODO: add extra false param at version 4.11.0 suggester.Build(new InputArrayEnumerator(keys)); } else { // Test again, after close/reopen: - suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, 3); //LUCENENET TODO: add extra false param at version 4.11.0 + suggester = new AnalyzingInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, 3); //LUCENENET UPGRADE TODO: add extra false param at version 4.11.0 } // No context provided, all results returned diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/BlendedInfixSuggesterTest.cs b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/BlendedInfixSuggesterTest.cs index 968aa0e368..e5e6541beb 100644 --- a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/BlendedInfixSuggesterTest.cs +++ b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/BlendedInfixSuggesterTest.cs @@ -49,7 +49,7 @@ public void TestBlendedSort() BlendedInfixSuggester suggester = new BlendedInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, AnalyzingInfixSuggester.DEFAULT_MIN_PREFIX_CHARS, BlendedInfixSuggester.BlenderType.POSITION_LINEAR, - BlendedInfixSuggester.DEFAULT_NUM_FACTOR); //LUCENENET TODO: add extra false param at version 4.11.0 + BlendedInfixSuggester.DEFAULT_NUM_FACTOR); //LUCENENET UPGRADE TODO: add extra false param at version 4.11.0 suggester.Build(new InputArrayEnumerator(keys)); // we query for star wars and check that the weight @@ -100,7 +100,7 @@ public void TestBlendingType() // BlenderType.RECIPROCAL is using 1/(1+p) * w where w is weight and p the position of the word suggester = new BlendedInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, AnalyzingInfixSuggester.DEFAULT_MIN_PREFIX_CHARS, - BlendedInfixSuggester.BlenderType.POSITION_RECIPROCAL, 1); //LUCENENET TODO: add extra false param at version 4.11.0 + BlendedInfixSuggester.BlenderType.POSITION_RECIPROCAL, 1); //LUCENENET UPGRADE TODO: add extra false param at version 4.11.0 suggester.Build(new InputArrayEnumerator(keys)); assertEquals(w, GetInResults(suggester, "top", pl, 1)); @@ -134,7 +134,7 @@ public void TestRequiresMore() // if factor is small, we don't get the expected element BlendedInfixSuggester suggester = new BlendedInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, AnalyzingInfixSuggester.DEFAULT_MIN_PREFIX_CHARS, - BlendedInfixSuggester.BlenderType.POSITION_RECIPROCAL, 1); //LUCENENET TODO: add extra false param at version 4.11.0 + BlendedInfixSuggester.BlenderType.POSITION_RECIPROCAL, 1); //LUCENENET UPGRADE TODO: add extra false param at version 4.11.0 suggester.Build(new InputArrayEnumerator(keys)); @@ -154,7 +154,7 @@ public void TestRequiresMore() // if we increase the factor we have it suggester = new BlendedInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, AnalyzingInfixSuggester.DEFAULT_MIN_PREFIX_CHARS, - BlendedInfixSuggester.BlenderType.POSITION_RECIPROCAL, 2); //LUCENENET TODO: add extra false param at version 4.11.0 + BlendedInfixSuggester.BlenderType.POSITION_RECIPROCAL, 2); //LUCENENET UPGRADE TODO: add extra false param at version 4.11.0 suggester.Build(new InputArrayEnumerator(keys)); // we have it @@ -186,7 +186,7 @@ public void TestNullPrefixToken() BlendedInfixSuggester suggester = new BlendedInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, AnalyzingInfixSuggester.DEFAULT_MIN_PREFIX_CHARS, BlendedInfixSuggester.BlenderType.POSITION_LINEAR, - BlendedInfixSuggester.DEFAULT_NUM_FACTOR); //LUCENENET TODO: add extra false param at version 4.11.0 + BlendedInfixSuggester.DEFAULT_NUM_FACTOR); //LUCENENET UPGRADE TODO: add extra false param at version 4.11.0 suggester.Build(new InputArrayEnumerator(keys)); GetInResults(suggester, "of ", payload, 1); @@ -217,7 +217,7 @@ public void TestTrying() BlendedInfixSuggester suggester = new BlendedInfixSuggester(TEST_VERSION_CURRENT, NewFSDirectory(tempDir), a, a, AnalyzingInfixSuggester.DEFAULT_MIN_PREFIX_CHARS, BlendedInfixSuggester.BlenderType.POSITION_RECIPROCAL, - BlendedInfixSuggester.DEFAULT_NUM_FACTOR); //LUCENENET TODO: add extra false param at version 4.11.0 + BlendedInfixSuggester.DEFAULT_NUM_FACTOR); //LUCENENET UPGRADE TODO: add extra false param at version 4.11.0 suggester.Build(new InputArrayEnumerator(keys)); diff --git a/src/Lucene.Net.Tests.TestFramework/Codecs/Compressing/TestCompressingStoredFieldsFormat.cs b/src/Lucene.Net.Tests.TestFramework/Codecs/Compressing/TestCompressingStoredFieldsFormat.cs index d0a758539f..01afac4db4 100644 --- a/src/Lucene.Net.Tests.TestFramework/Codecs/Compressing/TestCompressingStoredFieldsFormat.cs +++ b/src/Lucene.Net.Tests.TestFramework/Codecs/Compressing/TestCompressingStoredFieldsFormat.cs @@ -1,4 +1,4 @@ -//LUCENENET TODO: Incompatibility issues because this was ported from Lucene 8.2.0, and we are 4.8.0 +//LUCENENET UPGRADE TODO: Incompatibility issues because this was ported from Lucene 8.2.0, and we are 4.8.0 //Lucene version compatibility level 8.2.0 //using Lucene.Net.Analysis;