You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2017/03/17 22:28:47 UTC
[17/33] lucenenet git commit: Lucene.Net.Core.Search.FieldComparer:
Changed implementation to use ArrayUtil.GetNaturalComparer() so in the
case the closing type is string,
comparison is done in a culture-insensitive manner
Lucene.Net.Core.Search.FieldComparer: Changed implementation to use ArrayUtil.GetNaturalComparer<T>() so in the case the closing type is string, comparison is done in a culture-insensitive manner
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/bfa2bf6f
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/bfa2bf6f
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/bfa2bf6f
Branch: refs/heads/api-work
Commit: bfa2bf6fb2dfe7ab9296d4c3c40fab91f1fed3a0
Parents: 8fabf08
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Fri Mar 17 17:10:24 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Fri Mar 17 17:10:24 2017 +0700
----------------------------------------------------------------------
src/Lucene.Net.Core/Search/FieldComparator.cs | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/bfa2bf6f/src/Lucene.Net.Core/Search/FieldComparator.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/FieldComparator.cs b/src/Lucene.Net.Core/Search/FieldComparator.cs
index a8f04da..de1bcc8 100644
--- a/src/Lucene.Net.Core/Search/FieldComparator.cs
+++ b/src/Lucene.Net.Core/Search/FieldComparator.cs
@@ -1,4 +1,5 @@
using Lucene.Net.Support;
+using Lucene.Net.Util;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -192,13 +193,11 @@ namespace Lucene.Net.Search
{
return 1;
}
- else if (object.ReferenceEquals(first, second))
- {
- return 0;
- }
else
{
- return Comparer<T>.Default.Compare(first, second);
+ // LUCENENET NOTE: We need to compare using NaturalComparer<T>
+ // to ensure that if comparing strings we do so in Ordinal sort order
+ return ArrayUtil.GetNaturalComparer<T>().Compare(first, second);
}
}