This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit dd7ed62e9bfc455c9b39ea5d33a783a93280b739
Author: Shad Storhaug <[email protected]>
AuthorDate: Mon Oct 18 23:01:21 2021 +0700

    BUG: 
Lucene.Net.Tests.Suggest.Suggest.Analyzing.TestFreeTextSuggester::TestRandom(): 
LookupResult calculation in the test was using different order of parentheses 
than the production code. This bug existed in Java, but apparently the order 
makes no difference on that platform. This test was getting a false positive 
because it was using List<T>.ToString() to make the result comparison, which 
J2N's List<T> corrects.
---
 .../Suggest/Analyzing/TestFreeTextSuggester.cs                      | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git 
a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs 
b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs
index 7bab0b0..8c5fb98 100644
--- a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs
+++ b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs
@@ -605,7 +605,11 @@ namespace Lucene.Net.Search.Suggest.Analyzing
                                 // LUCENENET NOTE: We need to calculate this 
as decimal because when using double it can sometimes 
                                 // return numbers that are greater than 
long.MaxValue, which results in a negative long number.
                                 // This is also the way it is being done in 
the FreeTextSuggester to work around the issue.
-                                Lookup.LookupResult lr = new 
Lookup.LookupResult(ngram, (long)(long.MaxValue * ((decimal)backoff * 
(decimal)count / contextCount)));
+
+                                // LUCENENET NOTE: The order of parentheses in 
the Java test didn't match the production code. This apparently doesn't affect 
the
+                                // result in Java, but does in .NET, so we 
changed the test to match the production code.
+                                //Lookup.LookupResult lr = new 
Lookup.LookupResult(ngram, (long)(long.MaxValue * ((decimal)backoff * 
(decimal)count / contextCount)));
+                                Lookup.LookupResult lr = new 
Lookup.LookupResult(ngram, (long)(long.MaxValue * (decimal)backoff * 
((decimal)count) / contextCount));
                                 tmp.Add(lr);
                                 if (Verbose)
                                 {

Reply via email to