lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [01/26] lucenenet git commit: Revert "Updating Lucene.Net.Codes/Pulsing"
Date Fri, 14 Nov 2014 11:59:16 GMT
Repository: lucenenet
Updated Branches:
  refs/heads/master 58ccdea29 -> 31a6e4fe5


Revert "Updating Lucene.Net.Codes/Pulsing"

This reverts commit 6e900565dc22706fd946c01c024ec96ca82f2ed1.


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

Branch: refs/heads/master
Commit: ce4970c8b6beb9b3fff8797a2bcaada4a930269d
Parents: 6e90056
Author: eladmarg <eladmarg@gmail.com>
Authored: Fri Nov 7 18:33:16 2014 -0800
Committer: eladmarg <eladmarg@gmail.com>
Committed: Fri Nov 7 18:33:16 2014 -0800

----------------------------------------------------------------------
 .../Pulsing/Pulsing41PostingsFormat.cs          |   2 +-
 .../Pulsing/PulsingPostingsFormat.cs            |  10 +-
 .../Pulsing/PulsingPostingsReader.cs            | 486 ++++++++++---------
 .../Pulsing/PulsingPostingsWriter.cs            | 319 ++++++------
 src/Lucene.Net.Core/Codecs/PostingsConsumer.cs  |   2 +-
 5 files changed, 435 insertions(+), 384 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ce4970c8/src/Lucene.Net.Codecs/Pulsing/Pulsing41PostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Pulsing/Pulsing41PostingsFormat.cs b/src/Lucene.Net.Codecs/Pulsing/Pulsing41PostingsFormat.cs
index 458771e..f2634f4 100644
--- a/src/Lucene.Net.Codecs/Pulsing/Pulsing41PostingsFormat.cs
+++ b/src/Lucene.Net.Codecs/Pulsing/Pulsing41PostingsFormat.cs
@@ -17,7 +17,7 @@
 
 namespace Lucene.Net.Codecs.Pulsing
 {
-    using Lucene41;
+    using Lucene.Net.Codecs.Lucene41;
 
     /// <summary>
     /// Concrete pulsing implementation over {@link Lucene41PostingsFormat}.

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ce4970c8/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsFormat.cs b/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsFormat.cs
index 9ab1706..552ecbc 100644
--- a/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsFormat.cs
+++ b/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsFormat.cs
@@ -15,12 +15,14 @@
  * limitations under the License.
  */
 
+
+
 namespace Lucene.Net.Codecs.Pulsing
 {
     using System;
     using System.Diagnostics;
-    using Index;
-    using Util;
+    using Lucene.Net.Index;
+    using Lucene.Net.Util;
 
     /// <summary>
     /// This postings format "inlines" the postings for terms that have
@@ -47,11 +49,11 @@ namespace Lucene.Net.Codecs.Pulsing
         {
         }
 
-        /// <summary>Terms with freq less than or equal freqCutoff are inlined into terms dict.</summary>
+        /// <summary>Terms with freq <= freqCutoff are inlined into terms dict.</summary>
         protected PulsingPostingsFormat(String name, PostingsBaseFormat wrappedPostingsBaseFormat, int freqCutoff,
             int minBlockSize, int maxBlockSize) : base(name)
         {
-            Debug.Assert(minBlockSize > 1);
+            Debug.Debug.Assert((minBlockSize > 1);
 
             _freqCutoff = freqCutoff;
             _minBlockSize = minBlockSize;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ce4970c8/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 75334e6..9f4599b 100644
--- a/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsReader.cs
+++ b/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsReader.cs
@@ -21,9 +21,9 @@ namespace Lucene.Net.Codecs.Pulsing
     using System;
     using System.Collections.Generic;
     using System.Diagnostics;
-    using Index;
-    using Store;
-    using Util;
+    using Lucene.Net.Index;
+    using Lucene.Net.Store;
+    using Lucene.Net.Util;
 
     /// <summary>
     /// Concrete class that reads the current doc/freq/skip postings format 
@@ -39,52 +39,52 @@ namespace Lucene.Net.Codecs.Pulsing
 
         // Fallback reader for non-pulsed terms:
         private readonly PostingsReaderBase _wrappedPostingsReader;
-        private readonly SegmentReadState _segmentState;
-        private int _maxPositions;
-        private int _version;
-        private SortedDictionary<int, int> _fields;
+        private readonly SegmentReadState segmentState;
+        private int maxPositions;
+        private int version;
+        private SortedDictionary<int, int> fields;
 
         public PulsingPostingsReader(SegmentReadState state, PostingsReaderBase wrappedPostingsReader)
         {
-            _wrappedPostingsReader = wrappedPostingsReader;
-            _segmentState = state;
+            this._wrappedPostingsReader = wrappedPostingsReader;
+            this.segmentState = state;
         }
 
         public override void Init(IndexInput termsIn)
         {
-            _version = CodecUtil.CheckHeader(termsIn, PulsingPostingsWriter.CODEC,
+            version = CodecUtil.CheckHeader(termsIn, PulsingPostingsWriter.CODEC,
                 PulsingPostingsWriter.VERSION_START,
                 PulsingPostingsWriter.VERSION_CURRENT);
 
-            _maxPositions = termsIn.ReadVInt();
+            maxPositions = termsIn.ReadVInt();
             _wrappedPostingsReader.Init(termsIn);
 
-            if (_wrappedPostingsReader is PulsingPostingsReader || _version < PulsingPostingsWriter.VERSION_META_ARRAY)
+            if (_wrappedPostingsReader is PulsingPostingsReader || version < PulsingPostingsWriter.VERSION_META_ARRAY)
             {
-                _fields = null;
+                fields = null;
             }
             else
             {
-                _fields = new SortedDictionary<int, int>();
-                var summaryFileName = IndexFileNames.SegmentFileName(_segmentState.SegmentInfo.Name,
-                    _segmentState.SegmentSuffix, PulsingPostingsWriter.SUMMARY_EXTENSION);
+                fields = new SortedDictionary<int, int>();
+                String summaryFileName = IndexFileNames.SegmentFileName(segmentState.SegmentInfo.Name,
+                    segmentState.SegmentSuffix, PulsingPostingsWriter.SUMMARY_EXTENSION);
                 IndexInput input = null;
 
                 try
                 {
                     input =
-                        _segmentState.Directory.OpenInput(summaryFileName, _segmentState.Context);
+                        segmentState.Directory.OpenInput(summaryFileName, segmentState.Context);
                     CodecUtil.CheckHeader(input,
                         PulsingPostingsWriter.CODEC,
-                        _version,
+                        version,
                         PulsingPostingsWriter.VERSION_CURRENT);
 
-                    var numField = input.ReadVInt();
-                    for (var i = 0; i < numField; i++)
+                    int numField = input.ReadVInt();
+                    for (int i = 0; i < numField; i++)
                     {
-                        var fieldNum = input.ReadVInt();
-                        var longsSize = input.ReadVInt();
-                        _fields.Add(fieldNum, longsSize);
+                        int fieldNum = input.ReadVInt();
+                        int longsSize = input.ReadVInt();
+                        fields.Add(fieldNum, longsSize);
                     }
                 }
                 finally
@@ -96,24 +96,25 @@ namespace Lucene.Net.Codecs.Pulsing
 
         public override BlockTermState NewTermState()
         {
-            return new PulsingTermState {WrappedTermState = _wrappedPostingsReader.NewTermState()};
+            var state = new PulsingTermState {WrappedTermState = _wrappedPostingsReader.NewTermState()};
+            return state;
         }
 
         public override void DecodeTerm(long[] empty, DataInput input, FieldInfo fieldInfo, BlockTermState _termState,
             bool absolute)
         {
-            var termState = (PulsingTermState) _termState;
-
-            Debug.Assert(empty.Length == 0);
+            PulsingTermState termState = (PulsingTermState) _termState;
 
+            Debug.Debug.Assert((empty.Length == 0);
             termState.Absolute = termState.Absolute || absolute;
             // if we have positions, its total TF, otherwise its computed based on docFreq.
             // TODO Double check this is right..
-            long count = FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS.CompareTo(fieldInfo.FieldIndexOptions) <= 0
+            long count = FieldInfo.IndexOptions_e.DOCS_AND_FREQS_AND_POSITIONS.CompareTo(fieldInfo.IndexOptions) <= 0
                 ? termState.TotalTermFreq
                 : termState.DocFreq;
-           
-            if (count <= _maxPositions)
+            //System.out.println("  count=" + count + " threshold=" + maxPositions);
+
+            if (count <= maxPositions)
             {
                 // Inlined into terms dict -- just read the byte[] blob in,
                 // but don't decode it now (we only decode when a DocsEnum
@@ -133,12 +134,12 @@ namespace Lucene.Net.Codecs.Pulsing
             }
             else
             {
-                var longsSize = _fields == null ? 0 : _fields[fieldInfo.Number];
+                int longsSize = fields == null ? 0 : fields[fieldInfo.Number];
                 if (termState.Longs == null)
                 {
                     termState.Longs = new long[longsSize];
                 }
-                for (var i = 0; i < longsSize; i++)
+                for (int i = 0; i < longsSize; i++)
                 {
                     termState.Longs[i] = input.ReadVLong();
                 }
@@ -155,7 +156,7 @@ namespace Lucene.Net.Codecs.Pulsing
         public override DocsEnum Docs(FieldInfo field, BlockTermState _termState, Bits liveDocs, DocsEnum reuse,
             int flags)
         {
-            var termState = (PulsingTermState) _termState;
+            PulsingTermState termState = (PulsingTermState) _termState;
             if (termState.PostingsSize != -1)
             {
                 PulsingDocsEnum postings;
@@ -170,7 +171,7 @@ namespace Lucene.Net.Codecs.Pulsing
                 else
                 {
                     // the 'reuse' is actually the wrapped enum
-                    var previous = (PulsingDocsEnum) GetOther(reuse);
+                    PulsingDocsEnum previous = (PulsingDocsEnum) GetOther(reuse);
                     if (previous != null && previous.CanReuse(field))
                     {
                         postings = previous;
@@ -180,21 +181,26 @@ namespace Lucene.Net.Codecs.Pulsing
                         postings = new PulsingDocsEnum(field);
                     }
                 }
-                
                 if (reuse != postings)
+                {
                     SetOther(postings, reuse); // postings.other = reuse
-                
+                }
                 return postings.Reset(liveDocs, termState);
             }
-
-            if (!(reuse is PulsingDocsEnum))
-                return _wrappedPostingsReader.Docs(field, termState.WrappedTermState, liveDocs, reuse, flags);
-
-            var wrapped = _wrappedPostingsReader.Docs(field, termState.WrappedTermState, liveDocs,
-                GetOther(reuse), flags);
-
-            SetOther(wrapped, reuse); // wrapped.other = reuse
-            return wrapped;
+            else
+            {
+                if (reuse is PulsingDocsEnum)
+                {
+                    DocsEnum wrapped = _wrappedPostingsReader.Docs(field, termState.WrappedTermState, liveDocs,
+                        GetOther(reuse), flags);
+                    SetOther(wrapped, reuse); // wrapped.other = reuse
+                    return wrapped;
+                }
+                else
+                {
+                    return _wrappedPostingsReader.Docs(field, termState.WrappedTermState, liveDocs, reuse, flags);
+                }
+            }
         }
 
         public override DocsAndPositionsEnum DocsAndPositions(FieldInfo field, BlockTermState _termState, Bits liveDocs,
@@ -202,7 +208,7 @@ namespace Lucene.Net.Codecs.Pulsing
             int flags)
         {
 
-            var termState = (PulsingTermState) _termState;
+            PulsingTermState termState = (PulsingTermState) _termState;
 
             if (termState.PostingsSize != -1)
             {
@@ -218,7 +224,7 @@ namespace Lucene.Net.Codecs.Pulsing
                 else
                 {
                     // the 'reuse' is actually the wrapped enum
-                    var previous = (PulsingDocsAndPositionsEnum) GetOther(reuse);
+                    PulsingDocsAndPositionsEnum previous = (PulsingDocsAndPositionsEnum) GetOther(reuse);
                     if (previous != null && previous.CanReuse(field))
                     {
                         postings = previous;
@@ -232,19 +238,25 @@ namespace Lucene.Net.Codecs.Pulsing
                 {
                     SetOther(postings, reuse); // postings.other = reuse 
                 }
-                return postings.Reset(liveDocs, termState);
+                return postings.reset(liveDocs, termState);
+            }
+            else
+            {
+                if (reuse is PulsingDocsAndPositionsEnum)
+                {
+                    DocsAndPositionsEnum wrapped = _wrappedPostingsReader.DocsAndPositions(field,
+                        termState.WrappedTermState,
+                        liveDocs, (DocsAndPositionsEnum) GetOther(reuse),
+                        flags);
+                    SetOther(wrapped, reuse); // wrapped.other = reuse
+                    return wrapped;
+                }
+                else
+                {
+                    return _wrappedPostingsReader.DocsAndPositions(field, termState.WrappedTermState, liveDocs, reuse,
+                        flags);
+                }
             }
-
-            if (!(reuse is PulsingDocsAndPositionsEnum))
-                return _wrappedPostingsReader.DocsAndPositions(field, termState.WrappedTermState, liveDocs, reuse,
-                    flags);
-
-            var wrapped = _wrappedPostingsReader.DocsAndPositions(field,
-                termState.WrappedTermState,
-                liveDocs, (DocsAndPositionsEnum) GetOther(reuse),
-                flags);
-            SetOther(wrapped, reuse); // wrapped.other = reuse
-            return wrapped;
         }
 
         public override long RamBytesUsed()
@@ -275,10 +287,14 @@ namespace Lucene.Net.Codecs.Pulsing
         private DocsEnum GetOther(DocsEnum de)
         {
             if (de == null)
+            {
                 return null;
-            
-            var atts = de.Attributes();
-            return atts.AddAttribute(PulsingEnumAttribute.class).Enums().get(this);
+            }
+            else
+            {
+                AttributeSource atts = de.Attributes();
+                return atts.AddAttribute(PulsingEnumAttribute.Enums().get(this);
+            }
         }
 
         /// <summary>
@@ -287,8 +303,8 @@ namespace Lucene.Net.Codecs.Pulsing
         /// </summary>
         private DocsEnum SetOther(DocsEnum de, DocsEnum other)
         {
-            var atts = de.Attributes();
-            return atts.AddAttribute(PulsingEnumAttribute.class).Enums().put(this, other);
+            AttributeSource atts = de.Attributes();
+            return atts.AddAttribute(PulsingEnumAttributeImpl.Enums().put(this, other));
         }
 
         ///<summary>
@@ -313,7 +329,7 @@ namespace Lucene.Net.Codecs.Pulsing
 
             public override object Clone()
             {
-                var clone = (PulsingTermState) base.Clone();
+                PulsingTermState clone = (PulsingTermState) base.Clone();
                 if (PostingsSize != -1)
                 {
                     clone.Postings = new byte[PostingsSize];
@@ -321,14 +337,14 @@ namespace Lucene.Net.Codecs.Pulsing
                 }
                 else
                 {
-                    Debug.Assert(WrappedTermState != null);
+                    Debug.Debug.Assert((WrappedTermState != null);
                     clone.WrappedTermState = (BlockTermState) WrappedTermState.Clone();
                     clone.Absolute = Absolute;
-                    
-                    if (Longs == null) return clone;
-
-                    clone.Longs = new long[Longs.Length];
-                    Array.Copy(Longs, 0, clone.Longs, 0, Longs.Length);
+                    if (Longs != null)
+                    {
+                        clone.Longs = new long[Longs.Length];
+                        Array.Copy(Longs, 0, clone.Longs, 0, Longs.Length);
+                    }
                 }
                 return clone;
             }
@@ -344,7 +360,7 @@ namespace Lucene.Net.Codecs.Pulsing
                     {
                         Postings = new byte[ArrayUtil.Oversize(_other.PostingsSize, 1)];
                     }
-                    Array.Copy(_other.Postings, 0, Postings, 0, _other.PostingsSize);
+                    System.Array.Copy(_other.Postings, 0, Postings, 0, _other.PostingsSize);
                 }
                 else
                 {
@@ -355,341 +371,373 @@ namespace Lucene.Net.Codecs.Pulsing
             public override String ToString()
             {
                 if (PostingsSize == -1)
+                {
                     return "PulsingTermState: not inlined: wrapped=" + WrappedTermState;
-                
-                return "PulsingTermState: inlined size=" + PostingsSize + " " + base.ToString();
+                }
+                else
+                {
+                    return "PulsingTermState: inlined size=" + PostingsSize + " " + base.ToString();
+                }
             }
         }
 
         internal class PulsingDocsEnum : DocsEnum
         {
-            private byte[] _postingsBytes;
-            private readonly ByteArrayDataInput _postings = new ByteArrayDataInput();
-            private readonly FieldInfo.IndexOptions? _indexOptions;
-            private readonly bool _storePayloads;
-            private readonly bool _storeOffsets;
-            private Bits _liveDocs;
-
-            private int _docId = -1;
-            private int _accum;
-            private int _freq;
-            private int _payloadLength;
-            private int _cost;
+            private byte[] postingsBytes;
+            private readonly ByteArrayDataInput postings = new ByteArrayDataInput();
+            private readonly FieldInfo.IndexOptions_e? indexOptions;
+            private readonly bool storePayloads;
+            private readonly bool storeOffsets;
+            private Bits liveDocs;
+
+            private int docID = -1;
+            private int accum;
+            private int freq;
+            private int payloadLength;
+            private int cost;
 
             public PulsingDocsEnum(FieldInfo fieldInfo)
             {
-                _indexOptions = fieldInfo.FieldIndexOptions;
-                _storePayloads = fieldInfo.HasPayloads();
-                _storeOffsets = _indexOptions.Value.CompareTo(FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
+                indexOptions = fieldInfo.IndexOptions;
+                storePayloads = fieldInfo.HasPayloads();
+                storeOffsets = indexOptions.Value.CompareTo(FieldInfo.IndexOptions_e.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
             }
 
             public PulsingDocsEnum Reset(Bits liveDocs, PulsingTermState termState)
             {
-                Debug.Assert(termState.PostingsSize != -1);
+                Debug.Debug.Assert((termState.PostingsSize != -1);
 
                 // Must make a copy of termState's byte[] so that if
                 // app does TermsEnum.next(), this DocsEnum is not affected
-                if (_postingsBytes == null)
+                if (postingsBytes == null)
                 {
-                    _postingsBytes = new byte[termState.PostingsSize];
+                    postingsBytes = new byte[termState.PostingsSize];
                 }
-                else if (_postingsBytes.Length < termState.PostingsSize)
+                else if (postingsBytes.Length < termState.PostingsSize)
                 {
-                    _postingsBytes = ArrayUtil.Grow(_postingsBytes, termState.PostingsSize);
+                    postingsBytes = ArrayUtil.Grow(postingsBytes, termState.PostingsSize);
                 }
-                System.Array.Copy(termState.Postings, 0, _postingsBytes, 0, termState.PostingsSize);
-                _postings.Reset(_postingsBytes, 0, termState.PostingsSize);
-                _docId = -1;
-                _accum = 0;
-                _freq = 1;
-                _cost = termState.DocFreq;
-                _payloadLength = 0;
-                this._liveDocs = liveDocs;
+                System.Array.Copy(termState.Postings, 0, postingsBytes, 0, termState.PostingsSize);
+                postings.Reset(postingsBytes, 0, termState.PostingsSize);
+                docID = -1;
+                accum = 0;
+                freq = 1;
+                cost = termState.DocFreq;
+                payloadLength = 0;
+                this.liveDocs = liveDocs;
                 return this;
             }
 
             public bool CanReuse(FieldInfo fieldInfo)
             {
-                return _indexOptions == fieldInfo.FieldIndexOptions && _storePayloads == fieldInfo.HasPayloads();
+                return indexOptions == fieldInfo.IndexOptions && storePayloads == fieldInfo.HasPayloads();
             }
 
             public override int DocID()
             {
-                return _docId;
+                return docID;
             }
 
             public override int NextDoc()
             {
+                //System.out.println("PR nextDoc this= "+ this);
                 while (true)
                 {
-                    if (_postings.Eof())
-                        return _docId = NO_MORE_DOCS;
-                    
-                    var code = _postings.ReadVInt();
-                    if (_indexOptions == FieldInfo.IndexOptions.DOCS_ONLY)
+                    if (postings.Eof())
                     {
-                        _accum += code;
+                        return docID = NO_MORE_DOCS;
+                    }
+
+                    int code = postings.ReadVInt();
+                    if (indexOptions == FieldInfo.IndexOptions_e.DOCS_ONLY)
+                    {
+                        accum += code;
                     }
                     else
                     {
-                        _accum += (int)((uint)code >> 1); ; // shift off low bit
-                        _freq = (code & 1) != 0 ? 1 : _postings.ReadVInt();
+                        accum += (int)((uint)code >> 1); ; // shift off low bit
+                        if ((code & 1) != 0)
+                        {
+                            // if low bit is set
+                            freq = 1; // freq is one
+                        }
+                        else
+                        {
+                            freq = postings.ReadVInt(); // else read freq
+                        }
 
-                        if (_indexOptions.Value.CompareTo(FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0)
+                        if (indexOptions.Value.CompareTo(FieldInfo.IndexOptions_e.DOCS_AND_FREQS_AND_POSITIONS) >= 0)
                         {
                             // Skip positions
-                            if (_storePayloads)
+                            if (storePayloads)
                             {
-                                for (var pos = 0; pos < _freq; pos++)
+                                for (int pos = 0; pos < freq; pos++)
                                 {
-                                    var posCode = _postings.ReadVInt();
+                                    int posCode = postings.ReadVInt();
                                     if ((posCode & 1) != 0)
                                     {
-                                        _payloadLength = _postings.ReadVInt();
+                                        payloadLength = postings.ReadVInt();
                                     }
-                                    if (_storeOffsets && (_postings.ReadVInt() & 1) != 0)
+                                    if (storeOffsets && (postings.ReadVInt() & 1) != 0)
                                     {
                                         // new offset length
-                                        _postings.ReadVInt();
+                                        postings.ReadVInt();
                                     }
-                                    if (_payloadLength != 0)
+                                    if (payloadLength != 0)
                                     {
-                                        _postings.SkipBytes(_payloadLength);
+                                        postings.SkipBytes(payloadLength);
                                     }
                                 }
                             }
                             else
                             {
-                                for (var pos = 0; pos < _freq; pos++)
+                                for (int pos = 0; pos < freq; pos++)
                                 {
                                     // TODO: skipVInt
-                                    _postings.ReadVInt();
-                                    if (_storeOffsets && (_postings.ReadVInt() & 1) != 0)
+                                    postings.ReadVInt();
+                                    if (storeOffsets && (postings.ReadVInt() & 1) != 0)
                                     {
                                         // new offset length
-                                        _postings.ReadVInt();
+                                        postings.ReadVInt();
                                     }
                                 }
                             }
                         }
                     }
 
-                    if (_liveDocs == null || _liveDocs.Get(_accum))
-                        return (_docId = _accum);
+                    if (liveDocs == null || liveDocs.Get(accum))
+                    {
+                        return (docID = accum);
+                    }
+
                 }
             }
 
             public override int Advance(int target)
             {
-                return _docId = SlowAdvance(target);
+                return docID = SlowAdvance(target);
             }
 
             public override long Cost()
             {
-                return _cost;
+                return cost;
             }
 
             public override int Freq()
             {
-                return _freq;
+                return freq;
             }
         }
 
         internal class PulsingDocsAndPositionsEnum : DocsAndPositionsEnum
         {
-            private byte[] _postingsBytes;
-            private readonly ByteArrayDataInput _postings = new ByteArrayDataInput();
-            private readonly bool _storePayloads;
-            private readonly bool _storeOffsets;
+            private byte[] postingsBytes;
+            private readonly ByteArrayDataInput postings = new ByteArrayDataInput();
+            private readonly bool storePayloads;
+            private readonly bool storeOffsets;
             // note: we could actually reuse across different options, if we passed this to reset()
             // and re-init'ed storeOffsets accordingly (made it non-final)
-            private readonly FieldInfo.IndexOptions? _indexOptions;
-
-            private Bits _liveDocs;
-            private int _docId = -1;
-            private int _accum;
-            private int _freq;
-            private int _posPending;
-            private int _position;
-            private int _payloadLength;
-            private BytesRef _payload;
-            private int _startOffset;
-            private int _offsetLength;
-
-            private bool _payloadRetrieved;
-            private int _cost;
+            private readonly FieldInfo.IndexOptions_e? indexOptions;
+
+            private Bits liveDocs;
+            private int docID = -1;
+            private int accum;
+            private int freq;
+            private int posPending;
+            private int position;
+            private int payloadLength;
+            private BytesRef payload;
+            private int startOffset;
+            private int offsetLength;
+
+            private bool payloadRetrieved;
+            private int cost;
 
             public PulsingDocsAndPositionsEnum(FieldInfo fieldInfo)
             {
-                _indexOptions = fieldInfo.FieldIndexOptions;
-                _storePayloads = fieldInfo.HasPayloads();
-                _storeOffsets =
-                    _indexOptions.Value.CompareTo(FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
+                indexOptions = fieldInfo.IndexOptions;
+                storePayloads = fieldInfo.HasPayloads();
+                storeOffsets =
+                    indexOptions.Value.CompareTo(FieldInfo.IndexOptions_e.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
             }
 
-            public PulsingDocsAndPositionsEnum Reset(Bits liveDocs, PulsingTermState termState)
+            public PulsingDocsAndPositionsEnum reset(Bits liveDocs, PulsingTermState termState)
             {
-                Debug.Assert(termState.PostingsSize != -1);
+                Debug.Debug.Assert((termState.PostingsSize != -1);
 
-                if (_postingsBytes == null)
+                if (postingsBytes == null)
                 {
-                    _postingsBytes = new byte[termState.PostingsSize];
+                    postingsBytes = new byte[termState.PostingsSize];
                 }
-                else if (_postingsBytes.Length < termState.PostingsSize)
+                else if (postingsBytes.Length < termState.PostingsSize)
                 {
-                    _postingsBytes = ArrayUtil.Grow(_postingsBytes, termState.PostingsSize);
+                    postingsBytes = ArrayUtil.Grow(postingsBytes, termState.PostingsSize);
                 }
 
-                Array.Copy(termState.Postings, 0, _postingsBytes, 0, termState.PostingsSize);
-                _postings.Reset(_postingsBytes, 0, termState.PostingsSize);
-                this._liveDocs = liveDocs;
-                _payloadLength = 0;
-                _posPending = 0;
-                _docId = -1;
-                _accum = 0;
-                _cost = termState.DocFreq;
-                _startOffset = _storeOffsets ? 0 : -1; // always return -1 if no offsets are stored
-                _offsetLength = 0;
+                System.Array.Copy(termState.Postings, 0, postingsBytes, 0, termState.PostingsSize);
+                postings.Reset(postingsBytes, 0, termState.PostingsSize);
+                this.liveDocs = liveDocs;
+                payloadLength = 0;
+                posPending = 0;
+                docID = -1;
+                accum = 0;
+                cost = termState.DocFreq;
+                startOffset = storeOffsets ? 0 : -1; // always return -1 if no offsets are stored
+                offsetLength = 0;
                 //System.out.println("PR d&p reset storesPayloads=" + storePayloads + " bytes=" + bytes.length + " this=" + this);
                 return this;
             }
 
             public bool CanReuse(FieldInfo fieldInfo)
             {
-                return _indexOptions == fieldInfo.FieldIndexOptions && _storePayloads == fieldInfo.HasPayloads();
+                return indexOptions == fieldInfo.IndexOptions && storePayloads == fieldInfo.HasPayloads();
             }
 
             public override int NextDoc()
             {
+
                 while (true)
                 {
+
                     SkipPositions();
 
-                    if (_postings.Eof())
+                    if (postings.Eof())
                     {
-                        return _docId = NO_MORE_DOCS;
+                        return docID = NO_MORE_DOCS;
                     }
 
-                    var code = _postings.ReadVInt();
-                    _accum += (int)((uint)code >> 1); // shift off low bit 
-                    _freq = (code & 1) != 0 ? 1 : _postings.ReadVInt();
-                    _posPending = _freq;
-                    _startOffset = _storeOffsets ? 0 : -1; // always return -1 if no offsets are stored
-
-                    if (_liveDocs != null && !_liveDocs.Get(_accum)) continue;
+                    int code = postings.ReadVInt();
+                    accum += (int)((uint)code >> 1); // shift off low bit 
+                    if ((code & 1) != 0)
+                    {
+                        // if low bit is set
+                        freq = 1; // freq is one
+                    }
+                    else
+                    {
+                        freq = postings.ReadVInt(); // else read freq
+                    }
+                    posPending = freq;
+                    startOffset = storeOffsets ? 0 : -1; // always return -1 if no offsets are stored
 
-                    _position = 0;
-                    return (_docId = _accum);
+                    if (liveDocs == null || liveDocs.Get(accum))
+                    {
+                        position = 0;
+                        return (docID = accum);
+                    }
                 }
             }
 
             public override int Freq()
             {
-                return _freq;
+                return freq;
             }
 
             public override int DocID()
             {
-                return _docId;
+                return docID;
             }
 
             public override int Advance(int target)
             {
-                return _docId = SlowAdvance(target);
+                return docID = SlowAdvance(target);
             }
 
             public override int NextPosition()
             {
-                Debug.Assert(_posPending > 0);
+                Debug.Debug.Assert((posPending > 0);
 
-                _posPending--;
+                posPending--;
 
-                if (_storePayloads)
+                if (storePayloads)
                 {
-                    if (!_payloadRetrieved)
+                    if (!payloadRetrieved)
                     {
-                        _postings.SkipBytes(_payloadLength);
+                        postings.SkipBytes(payloadLength);
                     }
-                    int code = _postings.ReadVInt();
+                    int code = postings.ReadVInt();
                     if ((code & 1) != 0)
                     {
-                        _payloadLength = _postings.ReadVInt();
+                        payloadLength = postings.ReadVInt();
                     }
-                    _position += (int)((uint)code >> 1);
-                    _payloadRetrieved = false;
+                    position += (int)((uint)code >> 1);
+                    payloadRetrieved = false;
                 }
                 else
                 {
-                    _position += _postings.ReadVInt();
+                    position += postings.ReadVInt();
                 }
 
-                if (_storeOffsets)
+                if (storeOffsets)
                 {
-                    int offsetCode = _postings.ReadVInt();
+                    int offsetCode = postings.ReadVInt();
                     if ((offsetCode & 1) != 0)
                     {
                         // new offset length
-                        _offsetLength = _postings.ReadVInt();
+                        offsetLength = postings.ReadVInt();
                     }
-                    _startOffset += (int)((uint)offsetCode >> 1);
+                    startOffset += (int)((uint)offsetCode >> 1);
                 }
 
-                return _position;
+                return position;
             }
 
             public override int StartOffset()
             {
-                return _startOffset;
+                return startOffset;
             }
 
             public override int EndOffset()
             {
-                return _startOffset + _offsetLength;
+                return startOffset + offsetLength;
             }
 
             public override BytesRef Payload
             {
                 get
                 {
-                    if (_payloadRetrieved)
-                        return _payload;
-                    
-                    if (_storePayloads && _payloadLength > 0)
+                    if (payloadRetrieved)
+                    {
+                        return payload;
+                    }
+                    else if (storePayloads && payloadLength > 0)
                     {
-                        _payloadRetrieved = true;
-                        if (_payload == null)
+                        payloadRetrieved = true;
+                        if (payload == null)
                         {
-                            _payload = new BytesRef(_payloadLength);
+                            payload = new BytesRef(payloadLength);
                         }
                         else
                         {
-                            _payload.Grow(_payloadLength);
+                            payload.Grow(payloadLength);
                         }
-                        _postings.ReadBytes(_payload.Bytes, 0, _payloadLength);
-                        _payload.Length = _payloadLength;
-                        return _payload;
+                        postings.ReadBytes(payload.Bytes, 0, payloadLength);
+                        payload.Length = payloadLength;
+                        return payload;
+                    }
+                    else
+                    {
+                        return null;
                     }
-                    
-                    return null;
                 }
             }
 
             private void SkipPositions()
             {
-                while (_posPending != 0)
+                while (posPending != 0)
                 {
                     NextPosition();
                 }
-                if (_storePayloads && !_payloadRetrieved)
+                if (storePayloads && !payloadRetrieved)
                 {
-                    _postings.SkipBytes(_payloadLength);
-                    _payloadRetrieved = true;
+                    postings.SkipBytes(payloadLength);
+                    payloadRetrieved = true;
                 }
             }
             
             public override long Cost()
             {
-                return _cost;
+                return cost;
             }
         }
         

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ce4970c8/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsWriter.cs b/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsWriter.cs
index 82fe52a..528f8de 100644
--- a/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsWriter.cs
+++ b/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsWriter.cs
@@ -15,14 +15,15 @@
  * limitations under the License.
  */
 
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using Lucene.Net.Index;
+using Lucene.Net.Store;
+using Lucene.Net.Util;
+
 namespace Lucene.Net.Codecs.Pulsing
 {
-    using System;
-    using System.Collections.Generic;
-    using System.Diagnostics;
-    using Index;
-    using Store;
-    using Util;
 
     /// <summary>
     /// TODO: we now inline based on total TF of the term,
@@ -52,36 +53,36 @@ namespace Lucene.Net.Codecs.Pulsing
         internal static readonly int VERSION_META_ARRAY = 1;
         internal static readonly int VERSION_CURRENT = VERSION_META_ARRAY;
 
-        private readonly SegmentWriteState _segmentState;
-        private IndexOutput _termsOut;
-        private readonly List<FieldMetaData> _fields;
-        private FieldInfo.IndexOptions? _indexOptions;
-        private bool _storePayloads;
+        private SegmentWriteState segmentState;
+        private IndexOutput termsOut;
+        private List<FieldMetaData> fields;
+        private FieldInfo.IndexOptions_e? indexOptions;
+        private bool storePayloads;
 
         // information for wrapped PF, in current field
-        private int _longsSize;
-        private long[] _longs;
-        private bool _absolute;
+        private int longsSize;
+        private long[] longs;
+        private bool absolute;
 
         private class PulsingTermState : BlockTermState
         {
-            internal byte[] BYTES;
-            internal BlockTermState WRAPPED_STATE;
+            internal byte[] bytes;
+            internal BlockTermState wrappedState;
 
             public override String ToString()
             {
-                if (BYTES != null)
+                if (bytes != null)
                 {
                     return "inlined";
                 }
-                return "not inlined wrapped=" + WRAPPED_STATE;
+                return "not inlined wrapped=" + wrappedState;
             }
         }
 
         // one entry per position
-        private readonly Position[] _pending;
-        private int _pendingCount = 0;   // -1 once we've hit too many positions
-        private Position _currentDoc;    // first Position entry of current doc
+        private Position[] pending;
+        private int pendingCount = 0;   // -1 once we've hit too many positions
+        private Position currentDoc;    // first Position entry of current doc
 
         private sealed class Position
         {
@@ -113,42 +114,43 @@ namespace Lucene.Net.Codecs.Pulsing
 
         /// <summary>
         /// If the total number of positions (summed across all docs
-        /// for this term) is less than or equal maxPositions, then the postings are
+        /// for this term) is <= maxPositions, then the postings are
         /// inlined into terms dict
         /// </summary>
         public PulsingPostingsWriter(SegmentWriteState state, int maxPositions, PostingsWriterBase wrappedPostingsWriter)
         {
 
-            _pending = new Position[maxPositions];
-            for (var i = 0; i < maxPositions; i++)
+            pending = new Position[maxPositions];
+            for (int i = 0; i < maxPositions; i++)
             {
-                _pending[i] = new Position();
+                pending[i] = new Position();
             }
-            _fields = new List<FieldMetaData>();
+            fields = new List<FieldMetaData>();
 
             // We simply wrap another postings writer, but only call
             // on it when tot positions is >= the cutoff:
-            _wrappedPostingsWriter = wrappedPostingsWriter;
-            _segmentState = state;
+            this._wrappedPostingsWriter = wrappedPostingsWriter;
+            this.segmentState = state;
         }
 
         public override void Init(IndexOutput termsOut)
         {
-            _termsOut = termsOut;
+            this.termsOut = termsOut;
             CodecUtil.WriteHeader(termsOut, CODEC, VERSION_CURRENT);
-            termsOut.WriteVInt(_pending.Length); // encode maxPositions in header
+            termsOut.WriteVInt(pending.Length); // encode maxPositions in header
             _wrappedPostingsWriter.Init(termsOut);
         }
 
         public override BlockTermState NewTermState()
         {
-            var state = new PulsingTermState {WRAPPED_STATE = _wrappedPostingsWriter.NewTermState()};
+            PulsingTermState state = new PulsingTermState();
+            state.wrappedState = _wrappedPostingsWriter.NewTermState();
             return state;
         }
 
         public override void StartTerm()
         {
-            Debug.Assert(_pendingCount == 0);
+            Debug.Debug.Assert((pendingCount == 0);
         }
 
         /// <summary>
@@ -161,61 +163,61 @@ namespace Lucene.Net.Codecs.Pulsing
         /// <returns></returns>
         public override int SetField(FieldInfo fieldInfo)
         {
-            _indexOptions = fieldInfo.FieldIndexOptions;
-            _storePayloads = fieldInfo.HasPayloads();
-            _absolute = false;
-            _longsSize = _wrappedPostingsWriter.SetField(fieldInfo);
-            _longs = new long[_longsSize];
-            _fields.Add(new FieldMetaData(fieldInfo.Number, _longsSize));
+            this.indexOptions = fieldInfo.IndexOptions;
+            storePayloads = fieldInfo.HasPayloads();
+            absolute = false;
+            longsSize = _wrappedPostingsWriter.SetField(fieldInfo);
+            longs = new long[longsSize];
+            fields.Add(new FieldMetaData(fieldInfo.Number, longsSize));
             return 0;
         }
 
-        public override void StartDoc(int docId, int termDocFreq)
+        public override void StartDoc(int docID, int termDocFreq)
         {
-            Debug.Assert(docId >= 0, "Got DocID=" + docId);
+            Debug.Debug.Assert((docID >= 0, "Got DocID=" + docID);
 
-            if (_pendingCount == _pending.Length)
+            if (pendingCount == pending.Length)
             {
-                Push();
+                push();
                 _wrappedPostingsWriter.FinishDoc();
             }
 
-            if (_pendingCount != -1)
+            if (pendingCount != -1)
             {
-                Debug.Assert(_pendingCount < _pending.Length);
-                _currentDoc = _pending[_pendingCount];
-                _currentDoc.docID = docId;
-                if (_indexOptions == FieldInfo.IndexOptions.DOCS_ONLY)
+                Debug.Debug.Assert((pendingCount < pending.Length);
+                currentDoc = pending[pendingCount];
+                currentDoc.docID = docID;
+                if (indexOptions == FieldInfo.IndexOptions_e.DOCS_ONLY)
                 {
-                    _pendingCount++;
+                    pendingCount++;
                 }
-                else if (_indexOptions == FieldInfo.IndexOptions.DOCS_AND_FREQS)
+                else if (indexOptions == FieldInfo.IndexOptions_e.DOCS_AND_FREQS)
                 {
-                    _pendingCount++;
-                    _currentDoc.termFreq = termDocFreq;
+                    pendingCount++;
+                    currentDoc.termFreq = termDocFreq;
                 }
                 else
                 {
-                    _currentDoc.termFreq = termDocFreq;
+                    currentDoc.termFreq = termDocFreq;
                 }
             }
             else
             {
                 // We've already seen too many docs for this term --
                 // just forward to our fallback writer
-                _wrappedPostingsWriter.StartDoc(docId, termDocFreq);
+                _wrappedPostingsWriter.StartDoc(docID, termDocFreq);
             }
         }
 
         public override void AddPosition(int position, BytesRef payload, int startOffset, int endOffset)
         {
 
-            if (_pendingCount == _pending.Length)
+            if (pendingCount == pending.Length)
             {
-                Push();
+                push();
             }
 
-            if (_pendingCount == -1)
+            if (pendingCount == -1)
             {
                 // We've already seen too many docs for this term --
                 // just forward to our fallback writer
@@ -224,11 +226,11 @@ namespace Lucene.Net.Codecs.Pulsing
             else
             {
                 // buffer up
-                Position pos = _pending[_pendingCount++];
+                Position pos = pending[pendingCount++];
                 pos.pos = position;
                 pos.startOffset = startOffset;
                 pos.endOffset = endOffset;
-                pos.docID = _currentDoc.docID;
+                pos.docID = currentDoc.docID;
                 if (payload != null && payload.Length > 0)
                 {
                     if (pos.payload == null)
@@ -249,13 +251,13 @@ namespace Lucene.Net.Codecs.Pulsing
 
         public override void FinishDoc()
         {
-            if (_pendingCount == -1)
+            if (pendingCount == -1)
             {
                 _wrappedPostingsWriter.FinishDoc();
             }
         }
 
-        private readonly RAMOutputStream _buffer = new RAMOutputStream();
+        private readonly RAMOutputStream buffer = new RAMOutputStream();
 
         /// <summary>
         /// Called when we are done adding docs to this term
@@ -263,16 +265,16 @@ namespace Lucene.Net.Codecs.Pulsing
         /// <param name="_state"></param>
         public override void FinishTerm(BlockTermState _state)
         {
-            var state = (PulsingTermState) _state;
+            PulsingTermState state = (PulsingTermState) _state;
 
-            Debug.Assert(_pendingCount > 0 || _pendingCount == -1);
+            Debug.Debug.Assert((pendingCount > 0 || pendingCount == -1);
 
-            if (_pendingCount == -1)
+            if (pendingCount == -1)
             {
-                state.WRAPPED_STATE.DocFreq = state.DocFreq;
-                state.WRAPPED_STATE.TotalTermFreq = state.TotalTermFreq;
-                state.BYTES = null;
-                _wrappedPostingsWriter.FinishTerm(state.WRAPPED_STATE);
+                state.wrappedState.DocFreq = state.DocFreq;
+                state.wrappedState.TotalTermFreq = state.TotalTermFreq;
+                state.bytes = null;
+                _wrappedPostingsWriter.FinishTerm(state.wrappedState);
             }
             else
             {
@@ -286,72 +288,72 @@ namespace Lucene.Net.Codecs.Pulsing
                 // given codec wants to store other interesting
                 // stuff, it could use this pulsing codec to do so
 
-                if (_indexOptions >= FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS)
+                if (indexOptions.Value.CompareTo(FieldInfo.IndexOptions_e.DOCS_AND_FREQS_AND_POSITIONS) >= 0)
                 {
-                    var lastDocID = 0;
-                    var pendingIDX = 0;
-                    var lastPayloadLength = -1;
-                    var lastOffsetLength = -1;
-                    while (pendingIDX < _pendingCount)
+                    int lastDocID = 0;
+                    int pendingIDX = 0;
+                    int lastPayloadLength = -1;
+                    int lastOffsetLength = -1;
+                    while (pendingIDX < pendingCount)
                     {
-                        var doc = _pending[pendingIDX];
+                        Position doc = pending[pendingIDX];
 
-                        var delta = doc.docID - lastDocID;
+                        int delta = doc.docID - lastDocID;
                         lastDocID = doc.docID;
 
                         // if (DEBUG) System.out.println("  write doc=" + doc.docID + " freq=" + doc.termFreq);
 
                         if (doc.termFreq == 1)
                         {
-                            _buffer.WriteVInt((delta << 1) | 1);
+                            buffer.WriteVInt((delta << 1) | 1);
                         }
                         else
                         {
-                            _buffer.WriteVInt(delta << 1);
-                            _buffer.WriteVInt(doc.termFreq);
+                            buffer.WriteVInt(delta << 1);
+                            buffer.WriteVInt(doc.termFreq);
                         }
 
-                        var lastPos = 0;
-                        var lastOffset = 0;
-                        for (var posIDX = 0; posIDX < doc.termFreq; posIDX++)
+                        int lastPos = 0;
+                        int lastOffset = 0;
+                        for (int posIDX = 0; posIDX < doc.termFreq; posIDX++)
                         {
-                            var pos = _pending[pendingIDX++];
-                            Debug.Assert(pos.docID == doc.docID);
-                            var posDelta = pos.pos - lastPos;
+                            Position pos = pending[pendingIDX++];
+                            Debug.Debug.Assert((pos.docID == doc.docID);
+                            int posDelta = pos.pos - lastPos;
                             lastPos = pos.pos;
                             
-                            var payloadLength = pos.payload == null ? 0 : pos.payload.Length;
-                            if (_storePayloads)
+                            int payloadLength = pos.payload == null ? 0 : pos.payload.Length;
+                            if (storePayloads)
                             {
                                 if (payloadLength != lastPayloadLength)
                                 {
-                                    _buffer.WriteVInt((posDelta << 1) | 1);
-                                    _buffer.WriteVInt(payloadLength);
+                                    buffer.WriteVInt((posDelta << 1) | 1);
+                                    buffer.WriteVInt(payloadLength);
                                     lastPayloadLength = payloadLength;
                                 }
                                 else
                                 {
-                                    _buffer.WriteVInt(posDelta << 1);
+                                    buffer.WriteVInt(posDelta << 1);
                                 }
                             }
                             else
                             {
-                                _buffer.WriteVInt(posDelta);
+                                buffer.WriteVInt(posDelta);
                             }
 
-                            if (_indexOptions >= FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS)
+                            if (indexOptions.Value.CompareTo(FieldInfo.IndexOptions_e.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0)
                             {
                                 //System.out.println("write=" + pos.startOffset + "," + pos.endOffset);
-                                var offsetDelta = pos.startOffset - lastOffset;
-                                var offsetLength = pos.endOffset - pos.startOffset;
+                                int offsetDelta = pos.startOffset - lastOffset;
+                                int offsetLength = pos.endOffset - pos.startOffset;
                                 if (offsetLength != lastOffsetLength)
                                 {
-                                    _buffer.WriteVInt(offsetDelta << 1 | 1);
-                                    _buffer.WriteVInt(offsetLength);
+                                    buffer.WriteVInt(offsetDelta << 1 | 1);
+                                    buffer.WriteVInt(offsetLength);
                                 }
                                 else
                                 {
-                                    _buffer.WriteVInt(offsetDelta << 1);
+                                    buffer.WriteVInt(offsetDelta << 1);
                                 }
                                 lastOffset = pos.startOffset;
                                 lastOffsetLength = offsetLength;
@@ -359,79 +361,73 @@ namespace Lucene.Net.Codecs.Pulsing
 
                             if (payloadLength > 0)
                             {
-                                Debug.Assert(_storePayloads);
-                                _buffer.WriteBytes(pos.payload.Bytes, 0, pos.payload.Length);
+                                Debug.Debug.Assert((storePayloads);
+                                buffer.WriteBytes(pos.payload.Bytes, 0, pos.payload.Length);
                             }
                         }
                     }
                 }
-                else switch (_indexOptions)
+                else if (indexOptions == FieldInfo.IndexOptions_e.DOCS_AND_FREQS)
                 {
-                    case FieldInfo.IndexOptions.DOCS_AND_FREQS:
+                    int lastDocID = 0;
+                    for (int posIDX = 0; posIDX < pendingCount; posIDX++)
                     {
-                        var lastDocId = 0;
-                        for (var posIdx = 0; posIdx < _pendingCount; posIdx++)
-                        {
-                            var doc = _pending[posIdx];
-                            var delta = doc.docID - lastDocId;
-
-                            Debug.Assert(doc.termFreq != 0);
+                        Position doc = pending[posIDX];
+                        int delta = doc.docID - lastDocID;
+                        Debug.Debug.Assert((doc.termFreq != 0);
 
-                            if (doc.termFreq == 1)
-                            {
-                                _buffer.WriteVInt((delta << 1) | 1);
-                            }
-                            else
-                            {
-                                _buffer.WriteVInt(delta << 1);
-                                _buffer.WriteVInt(doc.termFreq);
-                            }
-                            lastDocId = doc.docID;
+                        if (doc.termFreq == 1)
+                        {
+                            buffer.WriteVInt((delta << 1) | 1);
                         }
-                    }
-                        break;
-                    case FieldInfo.IndexOptions.DOCS_ONLY:
-                    {
-                        var lastDocId = 0;
-                        for (var posIdx = 0; posIdx < _pendingCount; posIdx++)
+                        else
                         {
-                            var doc = _pending[posIdx];
-                            _buffer.WriteVInt(doc.docID - lastDocId);
-                            lastDocId = doc.docID;
+                            buffer.WriteVInt(delta << 1);
+                            buffer.WriteVInt(doc.termFreq);
                         }
+                        lastDocID = doc.docID;
+                    }
+                }
+                else if (indexOptions == FieldInfo.IndexOptions_e.DOCS_ONLY)
+                {
+                    int lastDocID = 0;
+                    for (int posIDX = 0; posIDX < pendingCount; posIDX++)
+                    {
+                        Position doc = pending[posIDX];
+                        buffer.WriteVInt(doc.docID - lastDocID);
+                        lastDocID = doc.docID;
                     }
-                        break;
                 }
 
-                state.BYTES = new byte[(int) _buffer.FilePointer];
-                _buffer.WriteTo((sbyte[])(Array)state.BYTES, 0);
-                _buffer.Reset();
+                state.bytes = new byte[(int) buffer.FilePointer];
+                buffer.WriteTo((sbyte[])(Array)state.bytes, 0);
+                buffer.Reset();
             }
-            _pendingCount = 0;
+            pendingCount = 0;
         }
 
-        public override void EncodeTerm(long[] empty, DataOutput output, FieldInfo fieldInfo, BlockTermState state,
-            bool abs)
+        public override void EncodeTerm(long[] empty, DataOutput output, FieldInfo fieldInfo, BlockTermState _state,
+            bool absolute)
         {
-            var _state = (PulsingTermState) state;
-            Debug.Assert(empty.Length == 0);
-            _absolute = _absolute || abs;
-            if (_state.BYTES == null)
+            PulsingTermState state = (PulsingTermState) _state;
+            Debug.Debug.Assert((empty.Length == 0);
+            this.absolute = this.absolute || absolute;
+            if (state.bytes == null)
             {
-                _wrappedPostingsWriter.EncodeTerm(_longs, _buffer, fieldInfo, _state.WRAPPED_STATE, _absolute);
-                for (var i = 0; i < _longsSize; i++)
+                _wrappedPostingsWriter.EncodeTerm(longs, buffer, fieldInfo, state.wrappedState, this.absolute);
+                for (int i = 0; i < longsSize; i++)
                 {
-                    output.WriteVLong(_longs[i]);
+                    output.WriteVLong(longs[i]);
                 }
-                _buffer.WriteTo(output);
-                _buffer.Reset();
-                _absolute = false;
+                buffer.WriteTo(output);
+                buffer.Reset();
+                this.absolute = false;
             }
             else
             {
-                output.WriteVInt(_state.BYTES.Length);
-                output.WriteBytes(_state.BYTES, 0, _state.BYTES.Length);
-                _absolute = _absolute || abs;
+                output.WriteVInt(state.bytes.Length);
+                output.WriteBytes(state.bytes, 0, state.bytes.Length);
+                this.absolute = this.absolute || absolute;
             }
         }
 
@@ -445,16 +441,16 @@ namespace Lucene.Net.Codecs.Pulsing
                 return;
             }
 
-            var summaryFileName = IndexFileNames.SegmentFileName(_segmentState.SegmentInfo.Name,
-                _segmentState.SegmentSuffix, SUMMARY_EXTENSION);
+            String summaryFileName = IndexFileNames.SegmentFileName(segmentState.SegmentInfo.Name,
+                segmentState.SegmentSuffix, SUMMARY_EXTENSION);
             IndexOutput output = null;
             try
             {
                 output =
-                    _segmentState.Directory.CreateOutput(summaryFileName, _segmentState.Context);
+                    segmentState.Directory.CreateOutput(summaryFileName, segmentState.Context);
                 CodecUtil.WriteHeader(output, CODEC, VERSION_CURRENT);
-                output.WriteVInt(_fields.Count);
-                foreach (var field in _fields)
+                output.WriteVInt(fields.Count);
+                foreach (FieldMetaData field in fields)
                 {
                     output.WriteVInt(field.FieldNumber);
                     output.WriteVInt(field.LongsSize);
@@ -468,43 +464,48 @@ namespace Lucene.Net.Codecs.Pulsing
         }
 
         // Pushes pending positions to the wrapped codec
-        private void Push()
+        private void push()
         {
-            Debug.Assert(_pendingCount == _pending.Length);
+            // if (DEBUG) System.out.println("PW now push @ " + pendingCount + " wrapped=" + wrappedPostingsWriter);
+            Debug.Debug.Assert((pendingCount == pending.Length);
 
             _wrappedPostingsWriter.StartTerm();
 
             // Flush all buffered docs
-            if (_indexOptions >= FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS)
+            if (indexOptions.Value.CompareTo(FieldInfo.IndexOptions_e.DOCS_AND_FREQS_AND_POSITIONS) >= 0)
             {
                 Position doc = null;
 
-                foreach(var pos in _pending)
+                foreach(Position pos in pending)
                 {
                     if (doc == null)
                     {
                         doc = pos;
+                        // if (DEBUG) System.out.println("PW: wrapped.startDoc docID=" + doc.docID + " tf=" + doc.termFreq);
                         _wrappedPostingsWriter.StartDoc(doc.docID, doc.termFreq);
                     }
                     else if (doc.docID != pos.docID)
                     {
-                        Debug.Assert(pos.docID > doc.docID);
+                        Debug.Debug.Assert((pos.docID > doc.docID);
+                        // if (DEBUG) System.out.println("PW: wrapped.finishDoc");
                         _wrappedPostingsWriter.FinishDoc();
                         doc = pos;
+                        // if (DEBUG) System.out.println("PW: wrapped.startDoc docID=" + doc.docID + " tf=" + doc.termFreq);
                         _wrappedPostingsWriter.StartDoc(doc.docID, doc.termFreq);
                     }
+                    // if (DEBUG) System.out.println("PW:   wrapped.addPos pos=" + pos.pos);
                     _wrappedPostingsWriter.AddPosition(pos.pos, pos.payload, pos.startOffset, pos.endOffset);
                 }
                 //wrappedPostingsWriter.finishDoc();
             }
             else
             {
-                foreach(var doc in _pending)
+                foreach(Position doc in pending)
                 {
-                    _wrappedPostingsWriter.StartDoc(doc.docID, _indexOptions == FieldInfo.IndexOptions.DOCS_ONLY ? 0 : doc.termFreq);
+                    _wrappedPostingsWriter.StartDoc(doc.docID, indexOptions == FieldInfo.IndexOptions_e.DOCS_ONLY ? 0 : doc.termFreq);
                 }
             }
-            _pendingCount = -1;
+            pendingCount = -1;
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ce4970c8/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 65710df..8515972 100644
--- a/src/Lucene.Net.Core/Codecs/PostingsConsumer.cs
+++ b/src/Lucene.Net.Core/Codecs/PostingsConsumer.cs
@@ -63,7 +63,7 @@ namespace Lucene.Net.Codecs
         /// <code>freq</code> will be -1 when term frequencies are omitted
         /// for the field.
         /// </summary>
-        public abstract void StartDoc(int docId, int freq);
+        public abstract void StartDoc(int docID, int freq);
 
         /// <summary>
         /// Add a new position & payload, and start/end offset.  A


Mime
View raw message