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 d89d02af6cd9837bd58440dc32fba277e0b2df5b
Author: Shad Storhaug <[email protected]>
AuthorDate: Sun Oct 24 04:03:38 2021 +0700

    Lucene.Net.Expressions.ExpressionComparer: Use 
J2N.Collections.Generic.Comparer<double> to ensure we use the same comparison 
logic as in Java.
---
 src/Lucene.Net.Expressions/ExpressionComparator.cs | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/Lucene.Net.Expressions/ExpressionComparator.cs 
b/src/Lucene.Net.Expressions/ExpressionComparator.cs
index 184d4aa..410b8a7 100644
--- a/src/Lucene.Net.Expressions/ExpressionComparator.cs
+++ b/src/Lucene.Net.Expressions/ExpressionComparator.cs
@@ -6,6 +6,7 @@ using System;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.IO;
+using JCG = J2N.Collections.Generic;
 
 namespace Lucene.Net.Expressions
 {
@@ -65,7 +66,8 @@ namespace Lucene.Net.Expressions
 
         public override int Compare(int slot1, int slot2)
         {
-            return values[slot1].CompareTo(values[slot2]);
+            // LUCENENET specific - use JCG comparer to get the same logic as 
Java
+            return JCG.Comparer<double>.Default.Compare(values[slot1], 
values[slot2]);
         }
 
         public override void SetBottom(int slot)
@@ -80,7 +82,8 @@ namespace Lucene.Net.Expressions
 
         public override int CompareBottom(int doc)
         {
-            return bottom.CompareTo(scores.DoubleVal(doc));
+            // LUCENENET specific - use JCG comparer to get the same logic as 
Java
+            return JCG.Comparer<double>.Default.Compare(bottom, 
scores.DoubleVal(doc));
         }
 
         public override void Copy(int slot, int doc)
@@ -99,7 +102,8 @@ namespace Lucene.Net.Expressions
 
         public override int CompareTop(int doc)
         {
-            return topValue.CompareTo(scores.DoubleVal(doc));
+            // LUCENENET specific - use JCG comparer to get the same logic as 
Java
+            return JCG.Comparer<double>.Default.Compare(topValue, 
scores.DoubleVal(doc));
         }
     }
 }

Reply via email to