Skip to content

Commit

Permalink
SWEEP: Changed LUCENENET TODO to LUCENENET UPGRADE TODO for things th…
Browse files Browse the repository at this point in the history
…at only apply to the next version of Lucene
  • Loading branch information
NightOwl888 committed Nov 5, 2024
1 parent fca5ccf commit bf6118d
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public AnalyzingInfixSuggester(LuceneVersion matchVersion, Directory dir, Analyz
/// ngrams (increasing index size but making lookups
/// faster). </param>
// 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)
Expand Down Expand Up @@ -896,4 +896,4 @@ public override long Count
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public BlendedInfixSuggester(LuceneVersion matchVersion, Directory dir, Analyzer
/// <param name="numFactor"> Factor to multiply the number of searched elements before ponderate </param>
/// <exception cref="IOException"> If there are problems opening the underlying Lucene index. </exception>
// 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)
Expand Down Expand Up @@ -325,4 +325,4 @@ public virtual int Compare(Lookup.LookupResult o1, Lookup.LookupResult o2)
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<Lookup.LookupResult> results = suggester.DoLookup(TestUtil.StringToCharSequence("ear", Random).ToString(), 10, true, true);
Expand Down Expand Up @@ -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<Lookup.LookupResult> results = suggester.DoLookup(TestUtil.StringToCharSequence("ear", Random).ToString(), 10, true, true);
assertEquals(2, results.size());
assertEquals("a penny saved is a penny <b>ear</b>ned", results[0].Key);
Expand Down Expand Up @@ -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
{
}

Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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
Expand All @@ -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<Lookup.LookupResult> results = suggester.DoLookup(TestUtil.StringToCharSequence("penn", Random).ToString(), 10, true, true);
assertEquals(1, results.size());
Expand All @@ -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;
}
Expand All @@ -381,7 +381,7 @@ public void TestHighlightCaseChange()

Analyzer a = new MockAnalyzer(Random, MockTokenizer.WHITESPACE, true);
IList<Lookup.LookupResult> 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);
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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
{

Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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<Lookup.LookupResult> results = suggester.DoLookup(TestUtil.StringToCharSequence("ear", Random).ToString(), 10, true, true);
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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));

Expand All @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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));


Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit bf6118d

Please sign in to comment.