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/05 11:49:11 UTC
[32/50] [abbrv] lucenenet git commit: BUG:
Lucene.Net.Codecs.SimpleText.SimpleTextTermVectorsReader: Fixed logic of
SeekCeil() to ensure it doesn't read past the end of the enumerator.
BUG: Lucene.Net.Codecs.SimpleText.SimpleTextTermVectorsReader: Fixed logic of SeekCeil() to ensure it doesn't read past the end of the enumerator.
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/48fd9c49
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/48fd9c49
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/48fd9c49
Branch: refs/heads/api-work
Commit: 48fd9c4998df5d305efad5de191b1aaf4ea7afa7
Parents: 9fe7346
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sat Mar 4 18:16:59 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sun Mar 5 17:08:44 2017 +0700
----------------------------------------------------------------------
.../SimpleText/SimpleTextTermVectorsReader.cs | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/48fd9c49/src/Lucene.Net.Codecs/SimpleText/SimpleTextTermVectorsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/SimpleText/SimpleTextTermVectorsReader.cs b/src/Lucene.Net.Codecs/SimpleText/SimpleTextTermVectorsReader.cs
index d6f29cd..588d19c 100644
--- a/src/Lucene.Net.Codecs/SimpleText/SimpleTextTermVectorsReader.cs
+++ b/src/Lucene.Net.Codecs/SimpleText/SimpleTextTermVectorsReader.cs
@@ -386,24 +386,28 @@ namespace Lucene.Net.Codecs.SimpleText
internal SimpleTVTermsEnum(SortedDictionary<BytesRef, SimpleTVPostings> terms)
{
_terms = terms;
- _iterator = terms.EntrySet().GetEnumerator();
+ _iterator = terms.GetEnumerator();
}
public override SeekStatus SeekCeil(BytesRef text)
{
- var newTerms = new SortedDictionary<BytesRef, SimpleTVPostings>();
+ var newTerms = new SortedDictionary<BytesRef, SimpleTVPostings>(_terms.Comparer);
foreach (var p in _terms.Where(p => p.Key.CompareTo(text) >= 0))
newTerms.Add(p.Key, p.Value);
- _iterator = newTerms.EntrySet().GetEnumerator();
+ _iterator = newTerms.GetEnumerator();
- if (!_iterator.MoveNext())
+ // LUCENENET specific: Since in .NET we don't have a HasNext() method, we need
+ // to call Next() and check the result if it is null instead. Since we need
+ // to check the result of Next() anyway for the Equals() comparison, this makes sense here.
+ var next = Next();
+ if (next == null)
{
return SeekStatus.END;
}
else
{
- return _iterator.Current.Key.Equals(text) ? SeekStatus.FOUND : SeekStatus.NOT_FOUND;
+ return next.Equals(text) ? SeekStatus.FOUND : SeekStatus.NOT_FOUND;
}
}