lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [16/27] lucenenet git commit: Lucene.Net (Index.DocsAndPositionsEnum + Codecs.Lucene3xFields) refactor: Payload > GetPayload() (makes a conversion)
Date Sun, 05 Feb 2017 16:51:51 GMT
Lucene.Net (Index.DocsAndPositionsEnum + Codecs.Lucene3xFields) refactor: Payload > GetPayload() (makes a conversion)


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

Branch: refs/heads/api-work
Commit: 1ace780993cfa2cff19dde5319bea86636ca7a62
Parents: bcc0d17
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Sun Feb 5 14:35:48 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Sun Feb 5 14:47:56 2017 +0700

----------------------------------------------------------------------
 .../Memory/DirectPostingsFormat.cs              | 52 +++++++++----------
 .../Memory/MemoryPostingsFormat.cs              |  7 +--
 .../Pulsing/PulsingPostingsReader.cs            | 37 +++++++-------
 src/Lucene.Net.Codecs/Sep/SepPostingsReader.cs  | 53 +++++++++-----------
 .../SimpleText/SimpleTextFieldsReader.cs        |  4 +-
 .../SimpleText/SimpleTextTermVectorsReader.cs   |  4 +-
 .../Compressing/CompressingTermVectorsReader.cs | 19 +++----
 .../Codecs/Lucene3x/Lucene3xFields.cs           |  7 +--
 .../Lucene3x/Lucene3xTermVectorsReader.cs       |  7 +--
 .../Codecs/Lucene3x/SegmentTermPositions.cs     | 37 +++++++-------
 .../Codecs/Lucene40/Lucene40PostingsReader.cs   | 50 ++++++++----------
 .../Lucene40/Lucene40TermVectorsReader.cs       | 29 +++++------
 .../Codecs/Lucene41/Lucene41PostingsReader.cs   | 30 +++++------
 .../Codecs/MappingMultiDocsAndPositionsEnum.cs  |  7 +--
 src/Lucene.Net.Core/Codecs/PostingsConsumer.cs  |  4 +-
 src/Lucene.Net.Core/Codecs/TermVectorsWriter.cs |  2 +-
 src/Lucene.Net.Core/Index/CheckIndex.cs         | 12 ++---
 .../Index/DocsAndPositionsEnum.cs               |  2 +-
 src/Lucene.Net.Core/Index/FilterAtomicReader.cs |  7 +--
 .../Index/MultiDocsAndPositionsEnum.cs          |  7 +--
 src/Lucene.Net.Core/Search/MultiPhraseQuery.cs  |  7 +--
 .../Search/Payloads/PayloadTermQuery.cs         |  2 +-
 src/Lucene.Net.Core/Search/Spans/TermSpans.cs   |  4 +-
 .../Highlight/TokenSources.cs                   |  2 +-
 .../TokenStreamFromTermPositionVector.cs        |  2 +-
 .../PostingsHighlight/MultiTermHighlighting.cs  | 11 ++--
 .../PostingsHighlight/PostingsHighlighter.cs    |  6 +--
 .../MemoryIndex.MemoryIndexReader.cs            |  7 +--
 .../Index/Sorter/SortingAtomicReader.cs         |  9 ++--
 .../Codecs/ramonly/RAMOnlyPostingsFormat.cs     | 17 +++----
 .../Index/AssertingAtomicReader.cs              | 19 +++----
 .../Index/BasePostingsFormatTestCase.cs         | 17 +++----
 .../Index/BaseTermVectorsFormatTestCase.cs      |  2 +-
 .../Util/LuceneTestCase.cs                      |  4 +-
 .../Index/Memory/MemoryIndexTest.cs             |  2 +-
 .../Index/Sorter/SorterTestBase.cs              |  4 +-
 src/Lucene.Net.Tests/core/Index/TestCodecs.cs   |  6 +--
 .../core/Index/TestDocumentWriter.cs            |  6 +--
 .../core/Index/TestLongPostings.cs              |  8 +--
 .../core/Index/TestMultiLevelSkipList.cs        |  2 +-
 src/Lucene.Net.Tests/core/Index/TestPayloads.cs | 22 ++++----
 .../core/Index/TestPayloadsOnVectors.cs         |  4 +-
 .../core/Index/TestPostingsOffsets.cs           |  8 +--
 43 files changed, 238 insertions(+), 310 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Codecs/Memory/DirectPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Memory/DirectPostingsFormat.cs b/src/Lucene.Net.Codecs/Memory/DirectPostingsFormat.cs
index 43c1ba3..063d2f2 100644
--- a/src/Lucene.Net.Codecs/Memory/DirectPostingsFormat.cs
+++ b/src/Lucene.Net.Codecs/Memory/DirectPostingsFormat.cs
@@ -478,7 +478,7 @@ namespace Lucene.Net.Codecs.Memory
                                         }
                                         if (hasPayloads_Renamed)
                                         {
-                                            BytesRef payload = docsAndPositionsEnum.Payload;
+                                            BytesRef payload = docsAndPositionsEnum.GetPayload();
                                             if (payload != null)
                                             {
                                                 scratch.Add(payload.Length);
@@ -578,7 +578,7 @@ namespace Lucene.Net.Codecs.Memory
                                         positions[upto][posUpto] = docsAndPositionsEnum.NextPosition();
                                         if (hasPayloads_Renamed)
                                         {
-                                            BytesRef payload = docsAndPositionsEnum.Payload;
+                                            BytesRef payload = docsAndPositionsEnum.GetPayload();
                                             if (payload != null)
                                             {
                                                 var payloadBytes = new byte[payload.Length];
@@ -2288,21 +2288,18 @@ namespace Lucene.Net.Codecs.Memory
                 return SlowAdvance(target);
             }
 
-            public override BytesRef Payload
+            public override BytesRef GetPayload()
             {
-                get
+                if (payloadLength > 0)
                 {
-                    if (payloadLength > 0)
-                    {
-                        payload.Bytes = payloadBytes;
-                        payload.Offset = lastPayloadOffset;
-                        payload.Length = payloadLength;
-                        return payload;
-                    }
-                    else
-                    {
-                        return null;
-                    }
+                    payload.Bytes = payloadBytes;
+                    payload.Offset = lastPayloadOffset;
+                    payload.Length = payloadLength;
+                    return payload;
+                }
+                else
+                {
+                    return null;
                 }
             }
 
@@ -2729,23 +2726,20 @@ namespace Lucene.Net.Codecs.Memory
 
             private readonly BytesRef _payload = new BytesRef();
 
-            public override BytesRef Payload
+            public override BytesRef GetPayload()
             {
-                get
-                {
-                    if (payloads == null)
-                        return null;
+                if (payloads == null)
+                    return null;
                 
-                    var payloadBytes = payloads[upto][posUpto/(hasOffsets ? 3 : 1)];
-                    if (payloadBytes == null)
-                    {
-                        return null;
-                    }
-                    _payload.Bytes = payloadBytes;
-                    _payload.Length = payloadBytes.Length;
-                    _payload.Offset = 0;
-                    return _payload;
+                var payloadBytes = payloads[upto][posUpto/(hasOffsets ? 3 : 1)];
+                if (payloadBytes == null)
+                {
+                    return null;
                 }
+                _payload.Bytes = payloadBytes;
+                _payload.Length = payloadBytes.Length;
+                _payload.Offset = 0;
+                return _payload;
             }
 
             public override long GetCost()

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs b/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs
index 1052816..3fda936 100644
--- a/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs
+++ b/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs
@@ -713,12 +713,9 @@ namespace Lucene.Net.Codecs.Memory
                 get { return startOffset_Renamed + offsetLength; }
             }
 
-            public override BytesRef Payload
+            public override BytesRef GetPayload()
             {
-                get
-                {
-                    return payload.Length > 0 ? payload : null;
-                }
+                return payload.Length > 0 ? payload : null;
             }
 
             public override int DocID

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsReader.cs b/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsReader.cs
index 38f477b..3592de9 100644
--- a/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsReader.cs
+++ b/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsReader.cs
@@ -608,31 +608,28 @@ namespace Lucene.Net.Codecs.Pulsing
                 }
             }
 
-            public override BytesRef Payload
+            public override BytesRef GetPayload()
             {
-                get
-                {
-                    if (_payloadRetrieved)
-                        return _payload;
+                if (_payloadRetrieved)
+                    return _payload;
 
-                    if (_storePayloads && _payloadLength > 0)
+                if (_storePayloads && _payloadLength > 0)
+                {
+                    _payloadRetrieved = true;
+                    if (_payload == null)
                     {
-                        _payloadRetrieved = true;
-                        if (_payload == null)
-                        {
-                            _payload = new BytesRef(_payloadLength);
-                        }
-                        else
-                        {
-                            _payload.Grow(_payloadLength);
-                        }
-                        _postings.ReadBytes(_payload.Bytes, 0, _payloadLength);
-                        _payload.Length = _payloadLength;
-                        return _payload;
+                        _payload = new BytesRef(_payloadLength);
                     }
-
-                    return null;
+                    else
+                    {
+                        _payload.Grow(_payloadLength);
+                    }
+                    _postings.ReadBytes(_payload.Bytes, 0, _payloadLength);
+                    _payload.Length = _payloadLength;
+                    return _payload;
                 }
+
+                return null;
             }
 
             public override long GetCost()

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Codecs/Sep/SepPostingsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Sep/SepPostingsReader.cs b/src/Lucene.Net.Codecs/Sep/SepPostingsReader.cs
index 02abf66..9226c2e 100644
--- a/src/Lucene.Net.Codecs/Sep/SepPostingsReader.cs
+++ b/src/Lucene.Net.Codecs/Sep/SepPostingsReader.cs
@@ -714,41 +714,38 @@ namespace Lucene.Net.Codecs.Sep
 
             private BytesRef _payload;
 
-            public override BytesRef Payload
+            public override BytesRef GetPayload()
             {
-                get
+                if (!_payloadPending)
                 {
-                    if (!_payloadPending)
-                    {
-                        return null;
-                    }
-
-                    if (_pendingPayloadBytes == 0)
-                    {
-                        return _payload;
-                    }
+                    return null;
+                }
 
-                    Debug.Assert(_pendingPayloadBytes >= _payloadLength);
+                if (_pendingPayloadBytes == 0)
+                {
+                    return _payload;
+                }
 
-                    if (_pendingPayloadBytes > _payloadLength)
-                    {
-                        _payloadIn.Seek(_payloadIn.FilePointer + (_pendingPayloadBytes - _payloadLength));
-                    }
+                Debug.Assert(_pendingPayloadBytes >= _payloadLength);
 
-                    if (_payload == null)
-                    {
-                        _payload = new BytesRef {Bytes = new byte[_payloadLength]};
-                    }
-                    else if (_payload.Bytes.Length < _payloadLength)
-                    {
-                        _payload.Grow(_payloadLength);
-                    }
+                if (_pendingPayloadBytes > _payloadLength)
+                {
+                    _payloadIn.Seek(_payloadIn.FilePointer + (_pendingPayloadBytes - _payloadLength));
+                }
 
-                    _payloadIn.ReadBytes(_payload.Bytes, 0, _payloadLength);
-                    _payload.Length = _payloadLength;
-                    _pendingPayloadBytes = 0;
-                    return _payload;
+                if (_payload == null)
+                {
+                    _payload = new BytesRef {Bytes = new byte[_payloadLength]};
+                }
+                else if (_payload.Bytes.Length < _payloadLength)
+                {
+                    _payload.Grow(_payloadLength);
                 }
+
+                _payloadIn.ReadBytes(_payload.Bytes, 0, _payloadLength);
+                _payload.Length = _payloadLength;
+                _pendingPayloadBytes = 0;
+                return _payload;
             }
 
             public override long GetCost()

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs b/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs
index 83047a4..5c2398c 100644
--- a/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs
+++ b/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs
@@ -547,9 +547,9 @@ namespace Lucene.Net.Codecs.SimpleText
                 get { return _endOffset; }
             }
 
-            public override BytesRef Payload
+            public override BytesRef GetPayload()
             {
-                get { return _payload; }
+                return _payload;
             }
 
             public override long GetCost()

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/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 a6d5f5b..1fd43bd 100644
--- a/src/Lucene.Net.Codecs/SimpleText/SimpleTextTermVectorsReader.cs
+++ b/src/Lucene.Net.Codecs/SimpleText/SimpleTextTermVectorsReader.cs
@@ -575,9 +575,9 @@ namespace Lucene.Net.Codecs.SimpleText
                 _nextPos = 0;
             }
 
-            public override BytesRef Payload
+            public override BytesRef GetPayload()
             {
-                get { return _payloads == null ? null : _payloads[_nextPos - 1]; }
+                return _payloads == null ? null : _payloads[_nextPos - 1];
             }
 
             public override int NextPosition()

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Core/Codecs/Compressing/CompressingTermVectorsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Compressing/CompressingTermVectorsReader.cs b/src/Lucene.Net.Core/Codecs/Compressing/CompressingTermVectorsReader.cs
index 2257ecb..1abbb55 100644
--- a/src/Lucene.Net.Core/Codecs/Compressing/CompressingTermVectorsReader.cs
+++ b/src/Lucene.Net.Core/Codecs/Compressing/CompressingTermVectorsReader.cs
@@ -1149,19 +1149,16 @@ namespace Lucene.Net.Codecs.Compressing
                 }
             }
 
-            public override BytesRef Payload
+            public override BytesRef GetPayload()
             {
-                get
+                CheckPosition();
+                if (payloadIndex == null || payload.Length == 0)
                 {
-                    CheckPosition();
-                    if (payloadIndex == null || payload.Length == 0)
-                    {
-                        return null;
-                    }
-                    else
-                    {
-                        return payload;
-                    }
+                    return null;
+                }
+                else
+                {
+                    return payload;
                 }
             }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xFields.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xFields.cs b/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xFields.cs
index 520d2cf..57aab75 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xFields.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xFields.cs
@@ -1268,12 +1268,9 @@ namespace Lucene.Net.Codecs.Lucene3x
                 get { return -1; }
             }
 
-            public override BytesRef Payload
+            public override BytesRef GetPayload()
             {
-                get
-                {
-                    return pos.Payload;
-                }
+                return pos.GetPayload();
             }
 
             public override long GetCost()

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xTermVectorsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xTermVectorsReader.cs b/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xTermVectorsReader.cs
index 5161e5e..75331bb 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xTermVectorsReader.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xTermVectorsReader.cs
@@ -808,12 +808,9 @@ namespace Lucene.Net.Codecs.Lucene3x
                 nextPos = 0;
             }
 
-            public override BytesRef Payload
+            public override BytesRef GetPayload()
             {
-                get
-                {
-                    return null;
-                }
+                return null;
             }
 
             public override int NextPosition()

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Core/Codecs/Lucene3x/SegmentTermPositions.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene3x/SegmentTermPositions.cs b/src/Lucene.Net.Core/Codecs/Lucene3x/SegmentTermPositions.cs
index bd68abc..95893dc 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene3x/SegmentTermPositions.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene3x/SegmentTermPositions.cs
@@ -228,33 +228,30 @@ namespace Lucene.Net.Codecs.Lucene3x
             }
         }
 
-        public BytesRef Payload
+        public BytesRef GetPayload()
         {
-            get
+            if (payloadLength <= 0)
+            {
+                return null; // no payload
+            }
+
+            if (needToLoadPayload)
             {
-                if (payloadLength <= 0)
+                // read payloads lazily
+                if (payload == null)
                 {
-                    return null; // no payload
+                    payload = new BytesRef(payloadLength);
                 }
-
-                if (needToLoadPayload)
+                else
                 {
-                    // read payloads lazily
-                    if (payload == null)
-                    {
-                        payload = new BytesRef(payloadLength);
-                    }
-                    else
-                    {
-                        payload.Grow(payloadLength);
-                    }
-
-                    proxStream.ReadBytes(payload.Bytes, payload.Offset, payloadLength);
-                    payload.Length = payloadLength;
-                    needToLoadPayload = false;
+                    payload.Grow(payloadLength);
                 }
-                return payload;
+
+                proxStream.ReadBytes(payload.Bytes, payload.Offset, payloadLength);
+                payload.Length = payloadLength;
+                needToLoadPayload = false;
             }
+            return payload;
         }
 
         public bool IsPayloadAvailable

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40PostingsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40PostingsReader.cs b/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40PostingsReader.cs
index 7244618..abb8876 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40PostingsReader.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40PostingsReader.cs
@@ -960,12 +960,9 @@ namespace Lucene.Net.Codecs.Lucene40
             /// Returns the payload at this position, or null if no
             ///  payload was indexed.
             /// </summary>
-            public override BytesRef Payload
+            public override BytesRef GetPayload()
             {
-                get
-                {
-                    return null;
-                }
+                return null;
             }
 
             public override long GetCost()
@@ -1268,37 +1265,34 @@ namespace Lucene.Net.Codecs.Lucene40
             /// Returns the payload at this position, or null if no
             ///  payload was indexed.
             /// </summary>
-            public override BytesRef Payload
+            public override BytesRef GetPayload()
             {
-                get
+                if (storePayloads)
                 {
-                    if (storePayloads)
+                    if (payloadLength <= 0)
                     {
-                        if (payloadLength <= 0)
-                        {
-                            return null;
-                        }
-                        Debug.Assert(lazyProxPointer == -1);
-                        Debug.Assert(posPendingCount < freq);
+                        return null;
+                    }
+                    Debug.Assert(lazyProxPointer == -1);
+                    Debug.Assert(posPendingCount < freq);
 
-                        if (payloadPending)
+                    if (payloadPending)
+                    {
+                        if (payloadLength > payload.Bytes.Length)
                         {
-                            if (payloadLength > payload.Bytes.Length)
-                            {
-                                payload.Grow(payloadLength);
-                            }
-
-                            proxIn.ReadBytes(payload.Bytes, 0, payloadLength);
-                            payload.Length = payloadLength;
-                            payloadPending = false;
+                            payload.Grow(payloadLength);
                         }
 
-                        return payload;
-                    }
-                    else
-                    {
-                        return null;
+                        proxIn.ReadBytes(payload.Bytes, 0, payloadLength);
+                        payload.Length = payloadLength;
+                        payloadPending = false;
                     }
+
+                    return payload;
+                }
+                else
+                {
+                    return null;
                 }
             }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40TermVectorsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40TermVectorsReader.cs b/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40TermVectorsReader.cs
index 2e08e14..d75ffef 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40TermVectorsReader.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40TermVectorsReader.cs
@@ -783,27 +783,24 @@ namespace Lucene.Net.Codecs.Lucene40
                 nextPos = 0;
             }
 
-            public override BytesRef Payload
+            public override BytesRef GetPayload()
             {
-                get
+                if (payloadOffsets == null)
+                {
+                    return null;
+                }
+                else
                 {
-                    if (payloadOffsets == null)
+                    int off = payloadOffsets[nextPos - 1];
+                    int end = nextPos == payloadOffsets.Length ? payloadBytes.Length : payloadOffsets[nextPos];
+                    if (end - off == 0)
                     {
                         return null;
                     }
-                    else
-                    {
-                        int off = payloadOffsets[nextPos - 1];
-                        int end = nextPos == payloadOffsets.Length ? payloadBytes.Length : payloadOffsets[nextPos];
-                        if (end - off == 0)
-                        {
-                            return null;
-                        }
-                        payload.Bytes = payloadBytes;
-                        payload.Offset = off;
-                        payload.Length = end - off;
-                        return payload;
-                    }
+                    payload.Bytes = payloadBytes;
+                    payload.Offset = off;
+                    payload.Length = end - off;
+                    return payload;
                 }
             }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Core/Codecs/Lucene41/Lucene41PostingsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene41/Lucene41PostingsReader.cs b/src/Lucene.Net.Core/Codecs/Lucene41/Lucene41PostingsReader.cs
index f848ff5..9bb4f4a 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene41/Lucene41PostingsReader.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene41/Lucene41PostingsReader.cs
@@ -1046,12 +1046,9 @@ namespace Lucene.Net.Codecs.Lucene41
                 get { return -1; }
             }
 
-            public override BytesRef Payload
+            public override BytesRef GetPayload()
             {
-                get
-                {
-                    return null;
-                }
+                return null;
             }
 
             public override long GetCost()
@@ -1697,21 +1694,18 @@ namespace Lucene.Net.Codecs.Lucene41
                 get { return endOffset; }
             }
 
-            public override BytesRef Payload
+            public override BytesRef GetPayload()
             {
-                get
+                // if (DEBUG) {
+                //   System.out.println("    FPR.getPayload payloadLength=" + payloadLength + " payloadByteUpto=" + payloadByteUpto);
+                // }
+                if (payloadLength == 0)
                 {
-                    // if (DEBUG) {
-                    //   System.out.println("    FPR.getPayload payloadLength=" + payloadLength + " payloadByteUpto=" + payloadByteUpto);
-                    // }
-                    if (payloadLength == 0)
-                    {
-                        return null;
-                    }
-                    else
-                    {
-                        return payload;
-                    }
+                    return null;
+                }
+                else
+                {
+                    return payload;
                 }
             }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Core/Codecs/MappingMultiDocsAndPositionsEnum.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/MappingMultiDocsAndPositionsEnum.cs b/src/Lucene.Net.Core/Codecs/MappingMultiDocsAndPositionsEnum.cs
index 26f8edd..15daee5 100644
--- a/src/Lucene.Net.Core/Codecs/MappingMultiDocsAndPositionsEnum.cs
+++ b/src/Lucene.Net.Core/Codecs/MappingMultiDocsAndPositionsEnum.cs
@@ -161,12 +161,9 @@ namespace Lucene.Net.Codecs
             get { return current.EndOffset; }
         }
 
-        public override BytesRef Payload
+        public override BytesRef GetPayload()
         {
-            get
-            {
-                return current.Payload;
-            }
+            return current.GetPayload();
         }
 
         public override long GetCost()

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Core/Codecs/PostingsConsumer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/PostingsConsumer.cs b/src/Lucene.Net.Core/Codecs/PostingsConsumer.cs
index 4f52d83..3fc91e1 100644
--- a/src/Lucene.Net.Core/Codecs/PostingsConsumer.cs
+++ b/src/Lucene.Net.Core/Codecs/PostingsConsumer.cs
@@ -139,7 +139,7 @@ namespace Lucene.Net.Codecs
                     for (int i = 0; i < freq; i++)
                     {
                         int position = postingsEnum.NextPosition();
-                        BytesRef payload = postingsEnum.Payload;
+                        BytesRef payload = postingsEnum.GetPayload();
                         this.AddPosition(position, payload, -1, -1);
                     }
                     this.FinishDoc();
@@ -164,7 +164,7 @@ namespace Lucene.Net.Codecs
                     for (int i = 0; i < freq; i++)
                     {
                         int position = postingsEnum.NextPosition();
-                        BytesRef payload = postingsEnum.Payload;
+                        BytesRef payload = postingsEnum.GetPayload();
                         this.AddPosition(position, payload, postingsEnum.StartOffset, postingsEnum.EndOffset);
                     }
                     this.FinishDoc();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Core/Codecs/TermVectorsWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/TermVectorsWriter.cs b/src/Lucene.Net.Core/Codecs/TermVectorsWriter.cs
index ea1c1df..e8cade2 100644
--- a/src/Lucene.Net.Core/Codecs/TermVectorsWriter.cs
+++ b/src/Lucene.Net.Core/Codecs/TermVectorsWriter.cs
@@ -333,7 +333,7 @@ namespace Lucene.Net.Codecs
                             int startOffset = docsAndPositionsEnum.StartOffset;
                             int endOffset = docsAndPositionsEnum.EndOffset;
 
-                            BytesRef payload = docsAndPositionsEnum.Payload;
+                            BytesRef payload = docsAndPositionsEnum.GetPayload();
 
                             Debug.Assert(!hasPositions || pos >= 0);
                             AddPosition(pos, startOffset, endOffset, payload);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Core/Index/CheckIndex.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/CheckIndex.cs b/src/Lucene.Net.Core/Index/CheckIndex.cs
index 2f3cd0c..fd84f7d 100644
--- a/src/Lucene.Net.Core/Index/CheckIndex.cs
+++ b/src/Lucene.Net.Core/Index/CheckIndex.cs
@@ -1236,7 +1236,7 @@ namespace Lucene.Net.Index
                                     throw new Exception("term " + term + ": doc " + doc + ": pos " + pos + " < lastPos " + lastPos);
                                 }
                                 lastPos = pos;
-                                BytesRef payload = postings.Payload;
+                                BytesRef payload = postings.GetPayload();
                                 if (payload != null)
                                 {
                                     Debug.Assert(payload.IsValid());
@@ -2264,7 +2264,7 @@ namespace Lucene.Net.Index
                                                     }
                                                 }
 
-                                                BytesRef payload = postings.Payload;
+                                                BytesRef payload = postings.GetPayload();
 
                                                 if (payload != null)
                                                 {
@@ -2279,20 +2279,20 @@ namespace Lucene.Net.Index
                                                     {
                                                         // we have payloads, but not at this position.
                                                         // postings has payloads too, it should not have one at this position
-                                                        if (postingsPostings.Payload != null)
+                                                        if (postingsPostings.GetPayload() != null)
                                                         {
-                                                            throw new Exception("vector term=" + term + " field=" + field + " doc=" + j + " has no payload but postings does: " + postingsPostings.Payload);
+                                                            throw new Exception("vector term=" + term + " field=" + field + " doc=" + j + " has no payload but postings does: " + postingsPostings.GetPayload());
                                                         }
                                                     }
                                                     else
                                                     {
                                                         // we have payloads, and one at this position
                                                         // postings should also have one at this position, with the same bytes.
-                                                        if (postingsPostings.Payload == null)
+                                                        if (postingsPostings.GetPayload() == null)
                                                         {
                                                             throw new Exception("vector term=" + term + " field=" + field + " doc=" + j + " has payload=" + payload + " but postings does not.");
                                                         }
-                                                        BytesRef postingsPayload = postingsPostings.Payload;
+                                                        BytesRef postingsPayload = postingsPostings.GetPayload();
                                                         if (!payload.Equals(postingsPayload))
                                                         {
                                                             throw new Exception("vector term=" + term + " field=" + field + " doc=" + j + " has payload=" + payload + " but differs from postings payload=" + postingsPayload);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Core/Index/DocsAndPositionsEnum.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/DocsAndPositionsEnum.cs b/src/Lucene.Net.Core/Index/DocsAndPositionsEnum.cs
index 5f89448..6decd0b 100644
--- a/src/Lucene.Net.Core/Index/DocsAndPositionsEnum.cs
+++ b/src/Lucene.Net.Core/Index/DocsAndPositionsEnum.cs
@@ -72,6 +72,6 @@ namespace Lucene.Net.Index
         ///  (neither members of the returned BytesRef nor bytes
         ///  in the byte[]).
         /// </summary>
-        public abstract BytesRef Payload { get; } // LUCENENET TODO: Change to GetPayload() ?
+        public abstract BytesRef GetPayload();
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Core/Index/FilterAtomicReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/FilterAtomicReader.cs b/src/Lucene.Net.Core/Index/FilterAtomicReader.cs
index 1fdef36..b700d1b 100644
--- a/src/Lucene.Net.Core/Index/FilterAtomicReader.cs
+++ b/src/Lucene.Net.Core/Index/FilterAtomicReader.cs
@@ -354,12 +354,9 @@ namespace Lucene.Net.Index
                 get { return m_input.EndOffset; }
             }
 
-            public override BytesRef Payload
+            public override BytesRef GetPayload()
             {
-                get
-                {
-                    return m_input.Payload;
-                }
+                return m_input.GetPayload();
             }
 
             public override long GetCost()

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Core/Index/MultiDocsAndPositionsEnum.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/MultiDocsAndPositionsEnum.cs b/src/Lucene.Net.Core/Index/MultiDocsAndPositionsEnum.cs
index c2dbc0d..a65ae42 100644
--- a/src/Lucene.Net.Core/Index/MultiDocsAndPositionsEnum.cs
+++ b/src/Lucene.Net.Core/Index/MultiDocsAndPositionsEnum.cs
@@ -193,12 +193,9 @@ namespace Lucene.Net.Index
             get { return current.EndOffset; }
         }
 
-        public override BytesRef Payload
+        public override BytesRef GetPayload()
         {
-            get
-            {
-                return current.Payload;
-            }
+            return current.GetPayload();
         }
 
         // TODO: implement bulk read more efficiently than super

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Core/Search/MultiPhraseQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/MultiPhraseQuery.cs b/src/Lucene.Net.Core/Search/MultiPhraseQuery.cs
index c90feba..f893fe6 100644
--- a/src/Lucene.Net.Core/Search/MultiPhraseQuery.cs
+++ b/src/Lucene.Net.Core/Search/MultiPhraseQuery.cs
@@ -665,12 +665,9 @@ namespace Lucene.Net.Search
             get { return -1; }
         }
 
-        public override BytesRef Payload
+        public override BytesRef GetPayload()
         {
-            get
-            {
-                return null;
-            }
+            return null;
         }
 
         public override sealed int Advance(int target)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Core/Search/Payloads/PayloadTermQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/Payloads/PayloadTermQuery.cs b/src/Lucene.Net.Core/Search/Payloads/PayloadTermQuery.cs
index b50df07..3f8f4c3 100644
--- a/src/Lucene.Net.Core/Search/Payloads/PayloadTermQuery.cs
+++ b/src/Lucene.Net.Core/Search/Payloads/PayloadTermQuery.cs
@@ -125,7 +125,7 @@ namespace Lucene.Net.Search.Payloads
                     if (termSpans.IsPayloadAvailable)
                     {
                         DocsAndPositionsEnum postings = termSpans.Postings;
-                        m_payload = postings.Payload;
+                        m_payload = postings.GetPayload();
                         if (m_payload != null)
                         {
                             m_payloadScore = outerInstance.outerInstance.m_function.CurrentScore(m_doc, outerInstance.outerInstance.Term.Field, m_spans.Start, m_spans.End, m_payloadsSeen, m_payloadScore, m_docScorer.ComputePayloadFactor(m_doc, m_spans.Start, m_spans.End, m_payload));

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Core/Search/Spans/TermSpans.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/Spans/TermSpans.cs b/src/Lucene.Net.Core/Search/Spans/TermSpans.cs
index 022e521..f72f7bb 100644
--- a/src/Lucene.Net.Core/Search/Spans/TermSpans.cs
+++ b/src/Lucene.Net.Core/Search/Spans/TermSpans.cs
@@ -114,7 +114,7 @@ namespace Lucene.Net.Search.Spans
         // TODO: Remove warning after API has been finalized
         public override ICollection<byte[]> GetPayload()
         {
-            var payload = m_postings.Payload;
+            var payload = m_postings.GetPayload();
             m_readPayload = true;
             byte[] bytes;
             if (payload != null)
@@ -136,7 +136,7 @@ namespace Lucene.Net.Search.Spans
         {
             get
             {
-                return m_readPayload == false && m_postings.Payload != null;
+                return m_readPayload == false && m_postings.GetPayload() != null;
             }
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Highlighter/Highlight/TokenSources.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Highlighter/Highlight/TokenSources.cs b/src/Lucene.Net.Highlighter/Highlight/TokenSources.cs
index edfbb35..5800ce5 100644
--- a/src/Lucene.Net.Highlighter/Highlight/TokenSources.cs
+++ b/src/Lucene.Net.Highlighter/Highlight/TokenSources.cs
@@ -241,7 +241,7 @@ namespace Lucene.Net.Search.Highlight
                         // Must make a deep copy of the returned payload,
                         // since D&PEnum API is allowed to re-use on every
                         // call:
-                        token.Payload = BytesRef.DeepCopyOf(dpEnum.Payload);
+                        token.Payload = BytesRef.DeepCopyOf(dpEnum.GetPayload());
                     }
 
                     if (tokenPositionsGuaranteedContiguous && pos != -1)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Highlighter/Highlight/TokenStreamFromTermPositionVector.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Highlighter/Highlight/TokenStreamFromTermPositionVector.cs b/src/Lucene.Net.Highlighter/Highlight/TokenStreamFromTermPositionVector.cs
index fec5a35..cbc84e8 100644
--- a/src/Lucene.Net.Highlighter/Highlight/TokenStreamFromTermPositionVector.cs
+++ b/src/Lucene.Net.Highlighter/Highlight/TokenStreamFromTermPositionVector.cs
@@ -83,7 +83,7 @@ namespace Lucene.Net.Search.Highlight
                         // Must make a deep copy of the returned payload,
                         // since D&PEnum API is allowed to re-use on every
                         // call:
-                        token.Payload = BytesRef.DeepCopyOf(dpEnum.Payload);
+                        token.Payload = BytesRef.DeepCopyOf(dpEnum.GetPayload());
                     }
 
                     // Yes - this is the position, not the increment! This is for

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Highlighter/PostingsHighlight/MultiTermHighlighting.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Highlighter/PostingsHighlight/MultiTermHighlighting.cs b/src/Lucene.Net.Highlighter/PostingsHighlight/MultiTermHighlighting.cs
index d995c88..e5a5bcd 100644
--- a/src/Lucene.Net.Highlighter/PostingsHighlight/MultiTermHighlighting.cs
+++ b/src/Lucene.Net.Highlighter/PostingsHighlight/MultiTermHighlighting.cs
@@ -313,16 +313,13 @@ namespace Lucene.Net.Search.PostingsHighlight
             }
 
 
-            public override BytesRef Payload
+            public override BytesRef GetPayload()
             {
-                get
+                if (matchDescriptions[currentMatch] == null)
                 {
-                    if (matchDescriptions[currentMatch] == null)
-                    {
-                        matchDescriptions[currentMatch] = new BytesRef(matchers[currentMatch].ToString());
-                    }
-                    return matchDescriptions[currentMatch];
+                    matchDescriptions[currentMatch] = new BytesRef(matchers[currentMatch].ToString());
                 }
+                return matchDescriptions[currentMatch];
             }
 
             public override int DocID

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs b/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs
index 758a33a..a7db1eb 100644
--- a/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs
+++ b/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs
@@ -726,7 +726,7 @@ namespace Lucene.Net.Search.PostingsHighlight
                     if (term == null)
                     {
                         // multitermquery match, pull from payload
-                        term = off.dp.Payload;
+                        term = off.dp.GetPayload();
                         Debug.Assert(term != null);
                     }
                     current.AddMatch(start, end, term);
@@ -843,9 +843,9 @@ namespace Lucene.Net.Search.PostingsHighlight
                 get { return int.MaxValue; }
             }
 
-            public override BytesRef Payload
+            public override BytesRef GetPayload()
             {
-                get { return null; }
+                return null;
             }
 
             public override int Freq

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Memory/MemoryIndex.MemoryIndexReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Memory/MemoryIndex.MemoryIndexReader.cs b/src/Lucene.Net.Memory/MemoryIndex.MemoryIndexReader.cs
index b6ba603..3553d01 100644
--- a/src/Lucene.Net.Memory/MemoryIndex.MemoryIndexReader.cs
+++ b/src/Lucene.Net.Memory/MemoryIndex.MemoryIndexReader.cs
@@ -554,12 +554,9 @@ namespace Lucene.Net.Index.Memory
                     get { return endOffset_Renamed; }
                 }
 
-                public override BytesRef Payload
+                public override BytesRef GetPayload()
                 {
-                    get
-                    {
-                        return null;
-                    }
+                    return null;
                 }
 
                 public override long GetCost()

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Misc/Index/Sorter/SortingAtomicReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Misc/Index/Sorter/SortingAtomicReader.cs b/src/Lucene.Net.Misc/Index/Sorter/SortingAtomicReader.cs
index 7bce547..32e7783 100644
--- a/src/Lucene.Net.Misc/Index/Sorter/SortingAtomicReader.cs
+++ b/src/Lucene.Net.Misc/Index/Sorter/SortingAtomicReader.cs
@@ -688,7 +688,7 @@ namespace Lucene.Net.Index.Sorter
                 for (int i = 0; i < freq; i++)
                 {
                     int pos = @in.NextPosition();
-                    BytesRef payload = @in.Payload;
+                    BytesRef payload = @in.GetPayload();
                     // The low-order bit of token is set only if there is a payload, the
                     // previous bits are the delta-encoded position. 
                     int token = (pos - previousPosition) << 1 | (payload == null ? 0 : 1);
@@ -732,12 +732,9 @@ namespace Lucene.Net.Index.Sorter
                 get { return currFreq; }
             }
 
-            public override BytesRef Payload
+            public override BytesRef GetPayload()
             {
-                get
-                {
-                    return payload.Length == 0 ? null : payload;
-                }
+                return payload.Length == 0 ? null : payload;
             }
 
             public override int NextDoc()

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.TestFramework/Codecs/ramonly/RAMOnlyPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/ramonly/RAMOnlyPostingsFormat.cs b/src/Lucene.Net.TestFramework/Codecs/ramonly/RAMOnlyPostingsFormat.cs
index e0e0d20..01180d3 100644
--- a/src/Lucene.Net.TestFramework/Codecs/ramonly/RAMOnlyPostingsFormat.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/ramonly/RAMOnlyPostingsFormat.cs
@@ -630,18 +630,15 @@ namespace Lucene.Net.Codecs.ramonly
                 get { return -1; }
             }
 
-            public override BytesRef Payload
+            public override BytesRef GetPayload()
             {
-                get
+                if (Current.Payloads != null && Current.Payloads[PosUpto - 1] != null)
                 {
-                    if (Current.Payloads != null && Current.Payloads[PosUpto - 1] != null)
-                    {
-                        return new BytesRef(Current.Payloads[PosUpto - 1]);
-                    }
-                    else
-                    {
-                        return null;
-                    }
+                    return new BytesRef(Current.Payloads[PosUpto - 1]);
+                }
+                else
+                {
+                    return null;
                 }
             }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.TestFramework/Index/AssertingAtomicReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/AssertingAtomicReader.cs b/src/Lucene.Net.TestFramework/Index/AssertingAtomicReader.cs
index 01cf168..6fcdc14 100644
--- a/src/Lucene.Net.TestFramework/Index/AssertingAtomicReader.cs
+++ b/src/Lucene.Net.TestFramework/Index/AssertingAtomicReader.cs
@@ -466,17 +466,14 @@ namespace Lucene.Net.Index
                 }
             }
 
-            public override BytesRef Payload
-            {
-                get
-                {
-                    Debug.Assert(State != DocsEnumState.START, "getPayload() called before nextDoc()/advance()");
-                    Debug.Assert(State != DocsEnumState.FINISHED, "getPayload() called after NO_MORE_DOCS");
-                    Debug.Assert(PositionCount > 0, "getPayload() called before nextPosition()!");
-                    BytesRef payload = base.Payload;
-                    Debug.Assert(payload == null || payload.IsValid() && payload.Length > 0, "getPayload() returned payload with invalid length!");
-                    return payload;
-                }
+            public override BytesRef GetPayload()
+            {
+                Debug.Assert(State != DocsEnumState.START, "getPayload() called before nextDoc()/advance()");
+                Debug.Assert(State != DocsEnumState.FINISHED, "getPayload() called after NO_MORE_DOCS");
+                Debug.Assert(PositionCount > 0, "getPayload() called before nextPosition()!");
+                BytesRef payload = base.GetPayload();
+                Debug.Assert(payload == null || payload.IsValid() && payload.Length > 0, "getPayload() returned payload with invalid length!");
+                return payload;
             }
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs b/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs
index c562b7f..4774c67 100644
--- a/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs
@@ -299,12 +299,9 @@ namespace Lucene.Net.Index
                 get { return EndOffset_Renamed; }
             }
 
-            public override BytesRef Payload
+            public override BytesRef GetPayload()
             {
-                get
-                {
-                    return Payload_Renamed.Length == 0 ? null : Payload_Renamed;
-                }
+                return Payload_Renamed.Length == 0 ? null : Payload_Renamed;
             }
 
             public override int Advance(int target)
@@ -601,7 +598,7 @@ namespace Lucene.Net.Index
                             for (int posUpto = 0; posUpto < freq; posUpto++)
                             {
                                 int pos = postings.NextPosition();
-                                BytesRef payload = postings.Payload;
+                                BytesRef payload = postings.GetPayload();
 
                                 if (VERBOSE)
                                 {
@@ -978,7 +975,7 @@ namespace Lucene.Net.Index
 
                         if (doCheckPayloads)
                         {
-                            BytesRef expectedPayload = expected.Payload;
+                            BytesRef expectedPayload = expected.GetPayload();
                             if (Random().NextDouble() <= payloadCheckChance)
                             {
                                 if (VERBOSE)
@@ -987,11 +984,11 @@ namespace Lucene.Net.Index
                                 }
                                 if (expectedPayload == null || expectedPayload.Length == 0)
                                 {
-                                    Assert.IsNull(docsAndPositionsEnum.Payload, "should not have payload");
+                                    Assert.IsNull(docsAndPositionsEnum.GetPayload(), "should not have payload");
                                 }
                                 else
                                 {
-                                    BytesRef payload = docsAndPositionsEnum.Payload;
+                                    BytesRef payload = docsAndPositionsEnum.GetPayload();
                                     Assert.IsNotNull(payload, "should have payload but doesn't");
 
                                     Assert.AreEqual(expectedPayload.Length, payload.Length, "payload length is wrong");
@@ -1002,7 +999,7 @@ namespace Lucene.Net.Index
 
                                     // make a deep copy
                                     payload = BytesRef.DeepCopyOf(payload);
-                                    Assert.AreEqual(payload, docsAndPositionsEnum.Payload, "2nd call to getPayload returns something different!");
+                                    Assert.AreEqual(payload, docsAndPositionsEnum.GetPayload(), "2nd call to getPayload returns something different!");
                                 }
                             }
                             else

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.TestFramework/Index/BaseTermVectorsFormatTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/BaseTermVectorsFormatTestCase.cs b/src/Lucene.Net.TestFramework/Index/BaseTermVectorsFormatTestCase.cs
index e4200ce..b3822d2 100644
--- a/src/Lucene.Net.TestFramework/Index/BaseTermVectorsFormatTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/BaseTermVectorsFormatTestCase.cs
@@ -621,7 +621,7 @@ namespace Lucene.Net.Index
                                 bool foundPayload = false;
                                 foreach (int index in indexes)
                                 {
-                                    if (tk.TermBytes[index].Equals(termsEnum.Term) && Equals(tk.Payloads[index], docsAndPositionsEnum.Payload))
+                                    if (tk.TermBytes[index].Equals(termsEnum.Term) && Equals(tk.Payloads[index], docsAndPositionsEnum.GetPayload()))
                                     {
                                         foundPayload = true;
                                         break;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
index 1d1cf51..8bc158b 100644
--- a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
@@ -2064,7 +2064,7 @@ namespace Lucene.Net.Util
                 for (int i = 0; i < freq; i++)
                 {
                     Assert.AreEqual(leftDocs.NextPosition(), rightDocs.NextPosition(), info);
-                    Assert.AreEqual(leftDocs.Payload, rightDocs.Payload, info);
+                    Assert.AreEqual(leftDocs.GetPayload(), rightDocs.GetPayload(), info);
                     Assert.AreEqual(leftDocs.StartOffset, rightDocs.StartOffset, info);
                     Assert.AreEqual(leftDocs.EndOffset, rightDocs.EndOffset, info);
                 }
@@ -2178,7 +2178,7 @@ namespace Lucene.Net.Util
                 for (int i = 0; i < freq; i++)
                 {
                     Assert.AreEqual(leftDocs.NextPosition(), rightDocs.NextPosition(), info);
-                    Assert.AreEqual(leftDocs.Payload, rightDocs.Payload, info);
+                    Assert.AreEqual(leftDocs.GetPayload(), rightDocs.GetPayload(), info);
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Tests.Memory/Index/Memory/MemoryIndexTest.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Memory/Index/Memory/MemoryIndexTest.cs b/src/Lucene.Net.Tests.Memory/Index/Memory/MemoryIndexTest.cs
index 82720b0..ae11e87 100644
--- a/src/Lucene.Net.Tests.Memory/Index/Memory/MemoryIndexTest.cs
+++ b/src/Lucene.Net.Tests.Memory/Index/Memory/MemoryIndexTest.cs
@@ -575,7 +575,7 @@ namespace Lucene.Net.Index.Memory
                     assertEquals("Position test failed" + failDesc, memPos, pos);
                     assertEquals("Start offset test failed" + failDesc, memDocsPosEnum.StartOffset, docsPosEnum.StartOffset);
                     assertEquals("End offset test failed" + failDesc, memDocsPosEnum.EndOffset, docsPosEnum.EndOffset);
-                    assertEquals("Missing payload test failed" + failDesc, docsPosEnum.Payload, null);
+                    assertEquals("Missing payload test failed" + failDesc, docsPosEnum.GetPayload(), null);
                 }
             }
             assertNull("Still some tokens not processed", memTermEnum.Next());

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs b/src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs
index bd8be54..e1cbe65 100644
--- a/src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs
+++ b/src/Lucene.Net.Tests.Misc/Index/Sorter/SorterTestBase.cs
@@ -262,7 +262,7 @@ namespace Lucene.Net.Index.Sorter
                         assertEquals("incorrect startOffset for doc=" + doc, i, sortedPositions.StartOffset);
                         assertEquals("incorrect endOffset for doc=" + doc, i, sortedPositions.EndOffset);
                     }
-                    assertEquals("incorrect payload for doc=" + doc, freq - i, int.Parse(sortedPositions.Payload.Utf8ToString(), CultureInfo.InvariantCulture));
+                    assertEquals("incorrect payload for doc=" + doc, freq - i, int.Parse(sortedPositions.GetPayload().Utf8ToString(), CultureInfo.InvariantCulture));
                 }
             }
 
@@ -286,7 +286,7 @@ namespace Lucene.Net.Index.Sorter
                         assertEquals("incorrect startOffset for doc=" + doc, i, sortedPositions.StartOffset);
                         assertEquals("incorrect endOffset for doc=" + doc, i, sortedPositions.EndOffset);
                     }
-                    assertEquals("incorrect payload for doc=" + doc, freq - i, int.Parse(sortedPositions.Payload.Utf8ToString(), CultureInfo.InvariantCulture));
+                    assertEquals("incorrect payload for doc=" + doc, freq - i, int.Parse(sortedPositions.GetPayload().Utf8ToString(), CultureInfo.InvariantCulture));
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Tests/core/Index/TestCodecs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestCodecs.cs b/src/Lucene.Net.Tests/core/Index/TestCodecs.cs
index 70dc0bc..80e1d87 100644
--- a/src/Lucene.Net.Tests/core/Index/TestCodecs.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestCodecs.cs
@@ -609,17 +609,17 @@ namespace Lucene.Net.Index
                     Assert.AreEqual(positions[i].Pos, pos);
                     if (positions[i].Payload != null)
                     {
-                        Assert.IsNotNull(posEnum.Payload);
+                        Assert.IsNotNull(posEnum.GetPayload());
                         if (Random().Next(3) < 2)
                         {
                             // Verify the payload bytes
-                            BytesRef otherPayload = posEnum.Payload;
+                            BytesRef otherPayload = posEnum.GetPayload();
                             Assert.IsTrue(positions[i].Payload.Equals(otherPayload), "expected=" + positions[i].Payload.ToString() + " got=" + otherPayload.ToString());
                         }
                     }
                     else
                     {
-                        Assert.IsNull(posEnum.Payload);
+                        Assert.IsNull(posEnum.GetPayload());
                     }
                 }
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Tests/core/Index/TestDocumentWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestDocumentWriter.cs b/src/Lucene.Net.Tests/core/Index/TestDocumentWriter.cs
index 4ca08a7..ea81441 100644
--- a/src/Lucene.Net.Tests/core/Index/TestDocumentWriter.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestDocumentWriter.cs
@@ -178,11 +178,11 @@ namespace Lucene.Net.Index
             int freq = termPositions.Freq;
             Assert.AreEqual(3, freq);
             Assert.AreEqual(0, termPositions.NextPosition());
-            Assert.IsNotNull(termPositions.Payload);
+            Assert.IsNotNull(termPositions.GetPayload());
             Assert.AreEqual(6, termPositions.NextPosition());
-            Assert.IsNull(termPositions.Payload);
+            Assert.IsNull(termPositions.GetPayload());
             Assert.AreEqual(7, termPositions.NextPosition());
-            Assert.IsNull(termPositions.Payload);
+            Assert.IsNull(termPositions.GetPayload());
             reader.Dispose();
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Tests/core/Index/TestLongPostings.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestLongPostings.cs b/src/Lucene.Net.Tests/core/Index/TestLongPostings.cs
index b871d39..0f06912 100644
--- a/src/Lucene.Net.Tests/core/Index/TestLongPostings.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestLongPostings.cs
@@ -251,10 +251,10 @@ namespace Lucene.Net.Index
                                 Assert.AreEqual(pos, postings.NextPosition());
                                 if (Random().NextBoolean())
                                 {
-                                    var dummy = postings.Payload;
+                                    var dummy = postings.GetPayload();
                                     if (Random().NextBoolean())
                                     {
-                                        dummy = postings.Payload; // get it again
+                                        dummy = postings.GetPayload(); // get it again
                                     }
                                 }
                             }
@@ -314,10 +314,10 @@ namespace Lucene.Net.Index
                                 Assert.AreEqual(pos, postings.NextPosition());
                                 if (Random().NextBoolean())
                                 {
-                                    var dummy = postings.Payload;
+                                    var dummy = postings.GetPayload();
                                     if (Random().NextBoolean())
                                     {
-                                        dummy = postings.Payload; // get it again
+                                        dummy = postings.GetPayload(); // get it again
                                     }
                                 }
                             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Tests/core/Index/TestMultiLevelSkipList.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestMultiLevelSkipList.cs b/src/Lucene.Net.Tests/core/Index/TestMultiLevelSkipList.cs
index 83aab4c..70a459e 100644
--- a/src/Lucene.Net.Tests/core/Index/TestMultiLevelSkipList.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestMultiLevelSkipList.cs
@@ -118,7 +118,7 @@ namespace Lucene.Net.Index
             Assert.AreEqual(target, tp.DocID, "Wrong document " + tp.DocID + " after skipTo target " + target);
             Assert.AreEqual(1, tp.Freq, "Frequency is not 1: " + tp.Freq);
             tp.NextPosition();
-            BytesRef b = tp.Payload;
+            BytesRef b = tp.GetPayload();
             Assert.AreEqual(1, b.Length);
             Assert.AreEqual((sbyte)target, (sbyte)b.Bytes[b.Offset], "Wrong payload for the target " + target + ": " + (sbyte)b.Bytes[b.Offset]);
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Tests/core/Index/TestPayloads.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestPayloads.cs b/src/Lucene.Net.Tests/core/Index/TestPayloads.cs
index e1798f6..ec64145 100644
--- a/src/Lucene.Net.Tests/core/Index/TestPayloads.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestPayloads.cs
@@ -212,7 +212,7 @@ namespace Lucene.Net.Index
                     for (int j = 0; j < numTerms; j++)
                     {
                         tps[j].NextPosition();
-                        BytesRef br = tps[j].Payload;
+                        BytesRef br = tps[j].GetPayload();
                         if (br != null)
                         {
                             Array.Copy(br.Bytes, br.Offset, verifyPayloadData, offset, br.Length);
@@ -235,7 +235,7 @@ namespace Lucene.Net.Index
             tp.NextDoc();
             // now we don't read this payload
             tp.NextPosition();
-            BytesRef payload = tp.Payload;
+            BytesRef payload = tp.GetPayload();
             Assert.AreEqual(1, payload.Length, "Wrong payload length.");
             Assert.AreEqual(payload.Bytes[payload.Offset], payloadData[numTerms]);
             tp.NextDoc();
@@ -244,7 +244,7 @@ namespace Lucene.Net.Index
             // we don't read this payload and skip to a different document
             tp.Advance(5);
             tp.NextPosition();
-            payload = tp.Payload;
+            payload = tp.GetPayload();
             Assert.AreEqual(1, payload.Length, "Wrong payload length.");
             Assert.AreEqual(payload.Bytes[payload.Offset], payloadData[5 * numTerms]);
 
@@ -254,16 +254,16 @@ namespace Lucene.Net.Index
             tp = MultiFields.GetTermPositionsEnum(reader, MultiFields.GetLiveDocs(reader), terms[1].Field, new BytesRef(terms[1].Text()));
             tp.NextDoc();
             tp.NextPosition();
-            Assert.AreEqual(1, tp.Payload.Length, "Wrong payload length.");
+            Assert.AreEqual(1, tp.GetPayload().Length, "Wrong payload length.");
             tp.Advance(skipInterval - 1);
             tp.NextPosition();
-            Assert.AreEqual(1, tp.Payload.Length, "Wrong payload length.");
+            Assert.AreEqual(1, tp.GetPayload().Length, "Wrong payload length.");
             tp.Advance(2 * skipInterval - 1);
             tp.NextPosition();
-            Assert.AreEqual(1, tp.Payload.Length, "Wrong payload length.");
+            Assert.AreEqual(1, tp.GetPayload().Length, "Wrong payload length.");
             tp.Advance(3 * skipInterval - 1);
             tp.NextPosition();
-            Assert.AreEqual(3 * skipInterval - 2 * numDocs - 1, tp.Payload.Length, "Wrong payload length.");
+            Assert.AreEqual(3 * skipInterval - 2 * numDocs - 1, tp.GetPayload().Length, "Wrong payload length.");
 
             reader.Dispose();
 
@@ -288,7 +288,7 @@ namespace Lucene.Net.Index
             tp.NextDoc();
             tp.NextPosition();
 
-            BytesRef bref = tp.Payload;
+            BytesRef bref = tp.GetPayload();
             verifyPayloadData = new byte[bref.Length];
             var portion = new byte[1500];
             Array.Copy(payloadData, 100, portion, 0, 1500);
@@ -506,7 +506,7 @@ namespace Lucene.Net.Index
                     for (int i = 0; i < freq; i++)
                     {
                         tp.NextPosition();
-                        BytesRef payload = tp.Payload;
+                        BytesRef payload = tp.GetPayload();
                         Assert.AreEqual(termText, payload.Utf8ToString());
                     }
                 }
@@ -692,7 +692,7 @@ namespace Lucene.Net.Index
             DocsAndPositionsEnum de = sr.TermPositionsEnum(new Term("field", "withPayload"));
             de.NextDoc();
             de.NextPosition();
-            Assert.AreEqual(new BytesRef("test"), de.Payload);
+            Assert.AreEqual(new BytesRef("test"), de.GetPayload());
             writer.Dispose();
             reader.Dispose();
             dir.Dispose();
@@ -729,7 +729,7 @@ namespace Lucene.Net.Index
             DocsAndPositionsEnum de = sr.TermPositionsEnum(new Term("field", "withPayload"));
             de.NextDoc();
             de.NextPosition();
-            Assert.AreEqual(new BytesRef("test"), de.Payload);
+            Assert.AreEqual(new BytesRef("test"), de.GetPayload());
             writer.Dispose();
             reader.Dispose();
             dir.Dispose();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Tests/core/Index/TestPayloadsOnVectors.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestPayloadsOnVectors.cs b/src/Lucene.Net.Tests/core/Index/TestPayloadsOnVectors.cs
index 81d8863..7e26232 100644
--- a/src/Lucene.Net.Tests/core/Index/TestPayloadsOnVectors.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestPayloadsOnVectors.cs
@@ -84,7 +84,7 @@ namespace Lucene.Net.Index
             DocsAndPositionsEnum de = termsEnum.DocsAndPositions(null, null);
             Assert.AreEqual(0, de.NextDoc());
             Assert.AreEqual(0, de.NextPosition());
-            Assert.AreEqual(new BytesRef("test"), de.Payload);
+            Assert.AreEqual(new BytesRef("test"), de.GetPayload());
             writer.Dispose();
             reader.Dispose();
             dir.Dispose();
@@ -129,7 +129,7 @@ namespace Lucene.Net.Index
             DocsAndPositionsEnum de = termsEnum.DocsAndPositions(null, null);
             Assert.AreEqual(0, de.NextDoc());
             Assert.AreEqual(3, de.NextPosition());
-            Assert.AreEqual(new BytesRef("test"), de.Payload);
+            Assert.AreEqual(new BytesRef("test"), de.GetPayload());
             writer.Dispose();
             reader.Dispose();
             dir.Dispose();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1ace7809/src/Lucene.Net.Tests/core/Index/TestPostingsOffsets.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestPostingsOffsets.cs b/src/Lucene.Net.Tests/core/Index/TestPostingsOffsets.cs
index f09a50c..bcb30f3 100644
--- a/src/Lucene.Net.Tests/core/Index/TestPostingsOffsets.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestPostingsOffsets.cs
@@ -184,8 +184,8 @@ namespace Lucene.Net.Index
                         if (withPayloads)
                         {
                             // check that we have a payload and it starts with "pos"
-                            Assert.IsNotNull(dp.Payload);
-                            BytesRef payload = dp.Payload;
+                            Assert.IsNotNull(dp.GetPayload());
+                            BytesRef payload = dp.GetPayload();
                             Assert.IsTrue(payload.Utf8ToString().StartsWith("pos:"));
                         } // note: withPayloads=false doesnt necessarily mean we dont have them from MockAnalyzer!
                     }
@@ -215,8 +215,8 @@ namespace Lucene.Net.Index
                     if (withPayloads)
                     {
                         // check that we have a payload and it starts with "pos"
-                        Assert.IsNotNull(dp.Payload);
-                        BytesRef payload = dp.Payload;
+                        Assert.IsNotNull(dp.GetPayload());
+                        BytesRef payload = dp.GetPayload();
                         Assert.IsTrue(payload.Utf8ToString().StartsWith("pos:"));
                     } // note: withPayloads=false doesnt necessarily mean we dont have them from MockAnalyzer!
                 }


Mime
View raw message