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/15 23:49:47 UTC
[05/50] [abbrv] lucenenet git commit: BUG:
Lucene.Net.Analysis.Common.Analysis.CharFilter.NormalizeCharMap.Builder:
Added StringComparer.Ordinal as the comparer for the backing SortedDictionary,
which corrects the sort order to be what is expected by FST
BUG: Lucene.Net.Analysis.Common.Analysis.CharFilter.NormalizeCharMap.Builder: Added StringComparer.Ordinal as the comparer for the backing SortedDictionary, which corrects the sort order to be what is expected by FST.Builder
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/0a2b62f2
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/0a2b62f2
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/0a2b62f2
Branch: refs/heads/api-work
Commit: 0a2b62f253ba4e04995e1414fec2d5d6ea4536a5
Parents: b7dc5a7
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Tue Mar 14 22:03:56 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Tue Mar 14 22:03:56 2017 +0700
----------------------------------------------------------------------
.../Analysis/CharFilter/NormalizeCharMap.cs | 4 +++-
src/Lucene.Net.Core/Util/Fst/Builder.cs | 13 +++++--------
2 files changed, 8 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0a2b62f2/src/Lucene.Net.Analysis.Common/Analysis/CharFilter/NormalizeCharMap.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/CharFilter/NormalizeCharMap.cs b/src/Lucene.Net.Analysis.Common/Analysis/CharFilter/NormalizeCharMap.cs
index c4113a4..8183fb8 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/CharFilter/NormalizeCharMap.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/CharFilter/NormalizeCharMap.cs
@@ -81,7 +81,9 @@ namespace Lucene.Net.Analysis.CharFilters
/// </summary>
public class Builder
{
- private readonly IDictionary<string, string> pendingPairs = new SortedDictionary<string, string>();
+ // LUCENENET specific - we need to use StringComparer.Ordinal for the
+ // sort order to correctly match Lucene, otherwise FST.Builder will throw Debug.Assert failures
+ private readonly IDictionary<string, string> pendingPairs = new SortedDictionary<string, string>(StringComparer.Ordinal);
/// <summary>
/// Records a replacement to be applied to the input
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0a2b62f2/src/Lucene.Net.Core/Util/Fst/Builder.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/Builder.cs b/src/Lucene.Net.Core/Util/Fst/Builder.cs
index 7195193..7cb2c16 100644
--- a/src/Lucene.Net.Core/Util/Fst/Builder.cs
+++ b/src/Lucene.Net.Core/Util/Fst/Builder.cs
@@ -398,9 +398,7 @@ namespace Lucene.Net.Util.Fst
output = NO_OUTPUT;
}
- // LUCENENET TODO: Commented this because it makes testing difficult in Visual Studio.
- // However, should investigate why this line is failing.
- //Debug.Assert(LastInput.Length == 0 || input.CompareTo(LastInput) >= 0, "inputs are added out of order lastInput=" + LastInput + " vs input=" + input);
+ Debug.Assert(lastInput.Length == 0 || input.CompareTo(lastInput) >= 0, "inputs are added out of order lastInput=" + lastInput + " vs input=" + input);
Debug.Assert(ValidOutput(output));
//System.out.println("\nadd: " + input);
@@ -707,11 +705,10 @@ namespace Lucene.Net.Util.Fst
public void AddArc(int label, INode target)
{
Debug.Assert(label >= 0);
- // LUCENENET TODO: Add this back in - it could be masking bugs (Commented this because it makes testing difficult in Visual Studio.)
- //if (NumArcs != 0)
- //{
- // Debug.Assert(label > Arcs[NumArcs - 1].Label, "arc[-1].Label=" + Arcs[NumArcs - 1].Label + " new label=" + label + " numArcs=" + NumArcs);
- //}
+ if (NumArcs != 0)
+ {
+ Debug.Assert(label > Arcs[NumArcs - 1].Label, "arc[-1].Label=" + Arcs[NumArcs - 1].Label + " new label=" + label + " numArcs=" + NumArcs);
+ }
if (NumArcs == Arcs.Length)
{
Arc<S>[] newArcs = new Arc<S>[ArrayUtil.Oversize(NumArcs + 1, RamUsageEstimator.NUM_BYTES_OBJECT_REF)];