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 fbe3a1d82c4a6869dacca41d3cf1580e9518105c
Author: Shad Storhaug <[email protected]>
AuthorDate: Sun Sep 13 11:20:19 2020 +0700

    BUG: Lucene.Net.Search.TopScoreDocCollector: Disabled optimizations on .NET 
Framework because of float comparison failures on x86 in Release mode. Fixes 
TestSearchAfter::TestQueries(), TestTopDocsMerge::TestSort_1(), 
TestTopDocsMerge::TestSort_2().
---
 src/Lucene.Net/Search/TopScoreDocCollector.cs | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/Lucene.Net/Search/TopScoreDocCollector.cs 
b/src/Lucene.Net/Search/TopScoreDocCollector.cs
index 73dfbb2..4839499 100644
--- a/src/Lucene.Net/Search/TopScoreDocCollector.cs
+++ b/src/Lucene.Net/Search/TopScoreDocCollector.cs
@@ -1,6 +1,7 @@
 using Lucene.Net.Diagnostics;
 using Lucene.Net.Support;
 using System;
+using System.Runtime.CompilerServices;
 
 namespace Lucene.Net.Search
 {
@@ -46,6 +47,9 @@ namespace Lucene.Net.Search
             {
             }
 
+#if NETFRAMEWORK
+            [MethodImpl(MethodImplOptions.NoOptimization)] // LUCENENET 
specific: comparing float equality fails in x86 on .NET Framework with 
optimizations enabled
+#endif
             public override void Collect(int doc)
             {
                 float score = scorer.GetScore();
@@ -89,6 +93,9 @@ namespace Lucene.Net.Search
                 this.after = after;
             }
 
+#if NETFRAMEWORK
+            [MethodImpl(MethodImplOptions.NoOptimization)] // LUCENENET 
specific: comparing float equality fails in x86 on .NET Framework with 
optimizations enabled
+#endif
             public override void Collect(int doc)
             {
                 float score = scorer.GetScore();
@@ -146,6 +153,9 @@ namespace Lucene.Net.Search
             {
             }
 
+#if NETFRAMEWORK
+            [MethodImpl(MethodImplOptions.NoOptimization)] // LUCENENET 
specific: comparing float equality fails in x86 on .NET Framework with 
optimizations enabled
+#endif
             public override void Collect(int doc)
             {
                 float score = scorer.GetScore();
@@ -189,6 +199,9 @@ namespace Lucene.Net.Search
                 this.after = after;
             }
 
+#if NETFRAMEWORK
+            [MethodImpl(MethodImplOptions.NoOptimization)] // LUCENENET 
specific: comparing float equality fails in x86 on .NET Framework with 
optimizations enabled
+#endif
             public override void Collect(int doc)
             {
                 float score = scorer.GetScore();
@@ -302,7 +315,7 @@ namespace Lucene.Net.Search
             // it means the largest element is already in results, use its 
score as
             // maxScore. Otherwise pop everything else, until the largest 
element is
             // extracted and use its score as maxScore.
-            float maxScore = float.NaN;
+            float maxScore/* = float.NaN*/; // LUCENENET: Removed unnecessary 
assignment
             if (start == 0)
             {
                 maxScore = results[0].Score;

Reply via email to