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 96403bc70766e11e6e35c6c08b0cb398e4fb34bc Author: Shad Storhaug <[email protected]> AuthorDate: Sat Oct 23 21:00:42 2021 +0700 Lucene.Net.Sandbox.Queries.FuzzyLikeThisQuery: Compare using NumericUtils.SingleToSortableInt32() to prevent test failures on x86 .NET Framework. See #269. --- src/Lucene.Net.Sandbox/Queries/FuzzyLikeThisQuery.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Lucene.Net.Sandbox/Queries/FuzzyLikeThisQuery.cs b/src/Lucene.Net.Sandbox/Queries/FuzzyLikeThisQuery.cs index 4607c43..84e858f 100644 --- a/src/Lucene.Net.Sandbox/Queries/FuzzyLikeThisQuery.cs +++ b/src/Lucene.Net.Sandbox/Queries/FuzzyLikeThisQuery.cs @@ -3,6 +3,7 @@ using Lucene.Net.Analysis.TokenAttributes; using Lucene.Net.Index; using Lucene.Net.Search; using Lucene.Net.Search.Similarities; +using Lucene.Net.Support; using Lucene.Net.Util; using System; using System.Collections.Generic; @@ -362,15 +363,13 @@ namespace Lucene.Net.Sandbox.Queries /// (non-Javadoc) /// <see cref="Util.PriorityQueue{T}.LessThan(T, T)"/> /// </summary> -#if NETFRAMEWORK - [MethodImpl(MethodImplOptions.NoOptimization)] // LUCENENET specific: comparing score equality fails in x86 on .NET Framework with optimizations enabled -#endif protected internal override bool LessThan(ScoreTerm termA, ScoreTerm termB) { - if (termA.Score == termB.Score) + // LUCENENET specific - compare bits rather than using equality operators to prevent these comparisons from failing in x86 in .NET Framework with optimizations enabled + if (NumericUtils.SingleToSortableInt32(termA.Score) == NumericUtils.SingleToSortableInt32(termB.Score)) return termA.Term.CompareTo(termB.Term) > 0; else - return termA.Score < termB.Score; + return NumericUtils.SingleToSortableInt32(termA.Score) < NumericUtils.SingleToSortableInt32(termB.Score); } }
