lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [12/50] [abbrv] lucenenet git commit: Fixed bugs in the Suggest.Analyzing.TestFreeTextSuggester.TestRandom() test
Date Sun, 02 Oct 2016 14:35:30 GMT
Fixed bugs in the Suggest.Analyzing.TestFreeTextSuggester.TestRandom() test


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/83bfcbe2
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/83bfcbe2
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/83bfcbe2

Branch: refs/heads/master
Commit: 83bfcbe25add32372810d28abfa4c410b2bc468b
Parents: 42166eb
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Thu Sep 15 23:10:18 2016 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Sun Oct 2 17:44:17 2016 +0700

----------------------------------------------------------------------
 .../Suggest/Analyzing/TestFreeTextSuggester.cs                | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/83bfcbe2/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs
index 2d4f61f..e1cf56e 100644
--- a/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs
+++ b/src/Lucene.Net.Tests.Suggest/Suggest/Analyzing/TestFreeTextSuggester.cs
@@ -675,7 +675,10 @@ namespace Lucene.Net.Search.Suggest.Analyzing
                             int? count = model.ContainsKey(ngram) ? model[ngram] : null;
                             if (count != null)
                             {
-                                Lookup.LookupResult lr = new Lookup.LookupResult(ngram, (long)(long.MaxValue
* (backoff * (double)count / contextCount)));
+                                // 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)));
                                 tmp.Add(lr);
                                 if (VERBOSE)
                                 {
@@ -736,7 +739,7 @@ namespace Lucene.Net.Search.Suggest.Analyzing
                     Console.WriteLine("    actual: " + actual);
                 }
 
-                assertEquals(expected.toString(), actual.toString());
+                assertEquals(expected.ToString(), actual.ToString());
             }
         }
 


Mime
View raw message