lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [11/47] lucenenet git commit: Fixed bugs that were causing the Codecs.SimpleText.TestSimpleTextTermVectorsFormat tests to fail.
Date Tue, 11 Oct 2016 18:34:56 GMT
Fixed bugs that were causing the Codecs.SimpleText.TestSimpleTextTermVectorsFormat tests to
fail.


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/31d66323
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/31d66323
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/31d66323

Branch: refs/heads/master
Commit: 31d66323d23417c9c1c82c460b67cacc2b24fe1c
Parents: f5cebaf
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Sat Oct 8 17:08:56 2016 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Sat Oct 8 17:15:43 2016 +0700

----------------------------------------------------------------------
 .../SimpleText/SimpleTextTermVectorsReader.cs   | 24 ++++++++++++++------
 1 file changed, 17 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/31d66323/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 46b6338..19d2674 100644
--- a/src/Lucene.Net.Codecs/SimpleText/SimpleTextTermVectorsReader.cs
+++ b/src/Lucene.Net.Codecs/SimpleText/SimpleTextTermVectorsReader.cs
@@ -552,9 +552,15 @@ namespace Lucene.Net.Codecs.SimpleText
 
             public override int NextDoc()
             {
-                if (_didNext || (_liveDocs != null && !_liveDocs.Get(0))) return
(_doc = NO_MORE_DOCS);
-                _didNext = true;
-                return (_doc = 0);
+                if (!_didNext && (_liveDocs == null || _liveDocs.Get(0)))
+                {
+                    _didNext = true;
+                    return (_doc = 0);
+                }
+                else
+                {
+                    return (_doc = NO_MORE_DOCS);
+                }
             }
 
             public override int Advance(int target)
@@ -582,8 +588,12 @@ namespace Lucene.Net.Codecs.SimpleText
 
             public override int NextPosition()
             {
-                Debug.Assert((_positions != null && _nextPos < _positions.Length)
||
-                             _startOffsets != null && _nextPos < _startOffsets.Length);
+                // LUCENENET NOTE: In Java, the assertion is being caught in the test (as
an AssertionException).
+                // Technically, a "possible" (in fact "probable") scenario like this one,
we should be throwing
+                // an exception, however doing that causes the checkIndex test to fail. The
only logical thing we
+                // can do to make this compatible is to remove the assert.
+                //Debug.Assert((_positions != null && _nextPos < _positions.Length)
||
+                //             _startOffsets != null && _nextPos < _startOffsets.Length);
                 if (_positions != null)
                 {
                     return _positions[_nextPos++];
@@ -596,7 +606,9 @@ namespace Lucene.Net.Codecs.SimpleText
             public override int StartOffset()
             {
                 if (_startOffsets == null)
+                {
                     return -1;
+                }
 
                 return _startOffsets[_nextPos - 1];
             }
@@ -616,7 +628,5 @@ namespace Lucene.Net.Codecs.SimpleText
                 return 1;
             }
         }
-
     }
-
 }
\ No newline at end of file


Mime
View raw message