You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by pn...@apache.org on 2014/09/29 09:23:57 UTC

[3/3] git commit: Lucene.Net.Codecs/Memory porting part 1

Lucene.Net.Codecs/Memory porting part 1


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

Branch: refs/heads/master
Commit: af4d125b5f23179c54c21269c96092819643c0eb
Parents: d852d5b
Author: Prescott Nasser <pn...@apache.org>
Authored: Mon Sep 29 00:23:08 2014 -0700
Committer: Prescott Nasser <pn...@apache.org>
Committed: Mon Sep 29 00:23:08 2014 -0700

----------------------------------------------------------------------
 .../Memory/DirectDocValuesConsumer.cs           | 806 +++++++++----------
 .../Memory/DirectDocValuesFormat.cs             | 161 ++--
 .../Memory/DirectDocValuesProducer.cs           |  89 +-
 .../Memory/DirectPostingsFormat.cs              |  66 +-
 .../Memory/FSTOrdPulsing41PostingsFormat.cs     | 175 ++--
 .../Memory/FSTOrdTermsReader.cs                 | 121 +--
 .../Memory/FSTPulsing41PostingsFormat.cs        | 178 ++--
 src/Lucene.Net.Codecs/Memory/FSTTermOutputs.cs  | 803 +++++++++---------
 src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs  | 131 +--
 src/Lucene.Net.Codecs/Memory/FSTTermsWriter.cs  | 578 +++++++------
 .../Memory/MemoryDocValuesConsumer.cs           |  85 +-
 .../Memory/MemoryDocValuesFormat.cs             | 117 ++-
 .../Memory/MemoryDocValuesProducer.cs           | 124 +--
 .../Memory/MemoryPostingsFormat.cs              | 120 +--
 14 files changed, 1718 insertions(+), 1836 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/af4d125b/src/Lucene.Net.Codecs/Memory/DirectDocValuesConsumer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Memory/DirectDocValuesConsumer.cs b/src/Lucene.Net.Codecs/Memory/DirectDocValuesConsumer.cs
index 8362727..23e7a16 100644
--- a/src/Lucene.Net.Codecs/Memory/DirectDocValuesConsumer.cs
+++ b/src/Lucene.Net.Codecs/Memory/DirectDocValuesConsumer.cs
@@ -1,423 +1,387 @@
-using System;
-using System.Diagnostics;
-using System.Collections.Generic;
-
-namespace org.apache.lucene.codecs.memory
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Lucene.Net.Codecs.Memory
 {
-
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
-
-
-	using FieldInfo = org.apache.lucene.index.FieldInfo;
-	using IndexFileNames = org.apache.lucene.index.IndexFileNames;
-	using SegmentWriteState = org.apache.lucene.index.SegmentWriteState;
-	using IndexOutput = org.apache.lucene.store.IndexOutput;
-	using BytesRef = org.apache.lucene.util.BytesRef;
-	using IOUtils = org.apache.lucene.util.IOUtils;
-
-//JAVA TO C# CONVERTER TODO TASK: This Java 'import static' statement cannot be converted to .NET:
-	import static org.apache.lucene.codecs.memory.DirectDocValuesProducer.VERSION_CURRENT;
-//JAVA TO C# CONVERTER TODO TASK: This Java 'import static' statement cannot be converted to .NET:
-	import static org.apache.lucene.codecs.memory.DirectDocValuesProducer.BYTES;
-//JAVA TO C# CONVERTER TODO TASK: This Java 'import static' statement cannot be converted to .NET:
-	import static org.apache.lucene.codecs.memory.DirectDocValuesProducer.SORTED;
-//JAVA TO C# CONVERTER TODO TASK: This Java 'import static' statement cannot be converted to .NET:
-	import static org.apache.lucene.codecs.memory.DirectDocValuesProducer.SORTED_SET;
-//JAVA TO C# CONVERTER TODO TASK: This Java 'import static' statement cannot be converted to .NET:
-	import static org.apache.lucene.codecs.memory.DirectDocValuesProducer.NUMBER;
-
-	/// <summary>
-	/// Writer for <seealso cref="DirectDocValuesFormat"/>
-	/// </summary>
-
-	internal class DirectDocValuesConsumer : DocValuesConsumer
-	{
-	  internal IndexOutput data, meta;
-	  internal readonly int maxDoc;
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: DirectDocValuesConsumer(org.apache.lucene.index.SegmentWriteState state, String dataCodec, String dataExtension, String metaCodec, String metaExtension) throws java.io.IOException
-	  internal DirectDocValuesConsumer(SegmentWriteState state, string dataCodec, string dataExtension, string metaCodec, string metaExtension)
-	  {
-		maxDoc = state.segmentInfo.DocCount;
-		bool success = false;
-		try
-		{
-		  string dataName = IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, dataExtension);
-		  data = state.directory.createOutput(dataName, state.context);
-		  CodecUtil.writeHeader(data, dataCodec, VERSION_CURRENT);
-		  string metaName = IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, metaExtension);
-		  meta = state.directory.createOutput(metaName, state.context);
-		  CodecUtil.writeHeader(meta, metaCodec, VERSION_CURRENT);
-		  success = true;
-		}
-		finally
-		{
-		  if (!success)
-		  {
-			IOUtils.closeWhileHandlingException(this);
-		  }
-		}
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void addNumericField(org.apache.lucene.index.FieldInfo field, Iterable<Number> values) throws java.io.IOException
-	  public override void addNumericField(FieldInfo field, IEnumerable<Number> values)
-	  {
-		meta.writeVInt(field.number);
-		meta.writeByte(NUMBER);
-		addNumericFieldValues(field, values);
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: private void addNumericFieldValues(org.apache.lucene.index.FieldInfo field, Iterable<Number> values) throws java.io.IOException
-	  private void addNumericFieldValues(FieldInfo field, IEnumerable<Number> values)
-	  {
-		meta.writeLong(data.FilePointer);
-		long minValue = long.MaxValue;
-		long maxValue = long.MinValue;
-		bool missing = false;
-
-		long count = 0;
-		foreach (Number nv in values)
-		{
-		  if (nv != null)
-		  {
-			long v = (long)nv;
-			minValue = Math.Min(minValue, v);
-			maxValue = Math.Max(maxValue, v);
-		  }
-		  else
-		  {
-			missing = true;
-		  }
-		  count++;
-		  if (count >= DirectDocValuesFormat.MAX_SORTED_SET_ORDS)
-		  {
-			throw new System.ArgumentException("DocValuesField \"" + field.name + "\" is too large, must be <= " + DirectDocValuesFormat.MAX_SORTED_SET_ORDS + " values/total ords");
-		  }
-		}
-		meta.writeInt((int) count);
-
-		if (missing)
-		{
-		  long start = data.FilePointer;
-		  writeMissingBitset(values);
-		  meta.writeLong(start);
-		  meta.writeLong(data.FilePointer - start);
-		}
-		else
-		{
-		  meta.writeLong(-1L);
-		}
-
-		sbyte byteWidth;
-		if (minValue >= sbyte.MinValue && maxValue <= sbyte.MaxValue)
-		{
-		  byteWidth = 1;
-		}
-		else if (minValue >= short.MinValue && maxValue <= short.MaxValue)
-		{
-		  byteWidth = 2;
-		}
-		else if (minValue >= int.MinValue && maxValue <= int.MaxValue)
-		{
-		  byteWidth = 4;
-		}
-		else
-		{
-		  byteWidth = 8;
-		}
-		meta.writeByte(byteWidth);
-
-		foreach (Number nv in values)
-		{
-		  long v;
-		  if (nv != null)
-		  {
-			v = (long)nv;
-		  }
-		  else
-		  {
-			v = 0;
-		  }
-
-		  switch (byteWidth)
-		  {
-		  case 1:
-			data.writeByte((sbyte) v);
-			break;
-		  case 2:
-			data.writeShort((short) v);
-			break;
-		  case 4:
-			data.writeInt((int) v);
-			break;
-		  case 8:
-			data.writeLong(v);
-			break;
-		  }
-		}
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void close() throws java.io.IOException
-	  public override void close()
-	  {
-		bool success = false;
-		try
-		{
-		  if (meta != null)
-		  {
-			meta.writeVInt(-1); // write EOF marker
-			CodecUtil.writeFooter(meta); // write checksum
-		  }
-		  if (data != null)
-		  {
-			CodecUtil.writeFooter(data);
-		  }
-		  success = true;
-		}
-		finally
-		{
-		  if (success)
-		  {
-			IOUtils.close(data, meta);
-		  }
-		  else
-		  {
-			IOUtils.closeWhileHandlingException(data, meta);
-		  }
-		  data = meta = null;
-		}
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void addBinaryField(org.apache.lucene.index.FieldInfo field, final Iterable<org.apache.lucene.util.BytesRef> values) throws java.io.IOException
-//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
-	  public override void addBinaryField(FieldInfo field, IEnumerable<BytesRef> values)
-	  {
-		meta.writeVInt(field.number);
-		meta.writeByte(BYTES);
-		addBinaryFieldValues(field, values);
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: private void addBinaryFieldValues(org.apache.lucene.index.FieldInfo field, final Iterable<org.apache.lucene.util.BytesRef> values) throws java.io.IOException
-//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
-	  private void addBinaryFieldValues(FieldInfo field, IEnumerable<BytesRef> values)
-	  {
-		// write the byte[] data
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final long startFP = data.getFilePointer();
-		long startFP = data.FilePointer;
-		bool missing = false;
-		long totalBytes = 0;
-		int count = 0;
-		foreach (BytesRef v in values)
-		{
-		  if (v != null)
-		  {
-			data.writeBytes(v.bytes, v.offset, v.length);
-			totalBytes += v.length;
-			if (totalBytes > DirectDocValuesFormat.MAX_TOTAL_BYTES_LENGTH)
-			{
-			  throw new System.ArgumentException("DocValuesField \"" + field.name + "\" is too large, cannot have more than DirectDocValuesFormat.MAX_TOTAL_BYTES_LENGTH (" + DirectDocValuesFormat.MAX_TOTAL_BYTES_LENGTH + ") bytes");
-			}
-		  }
-		  else
-		  {
-			missing = true;
-		  }
-		  count++;
-		}
-
-		meta.writeLong(startFP);
-		meta.writeInt((int) totalBytes);
-		meta.writeInt(count);
-		if (missing)
-		{
-		  long start = data.FilePointer;
-		  writeMissingBitset(values);
-		  meta.writeLong(start);
-		  meta.writeLong(data.FilePointer - start);
-		}
-		else
-		{
-		  meta.writeLong(-1L);
-		}
-
-		int addr = 0;
-		foreach (BytesRef v in values)
-		{
-		  data.writeInt(addr);
-		  if (v != null)
-		  {
-			addr += v.length;
-		  }
-		}
-		data.writeInt(addr);
-	  }
-
-	  // TODO: in some cases representing missing with minValue-1 wouldn't take up additional space and so on,
-	  // but this is very simple, and algorithms only check this for values of 0 anyway (doesnt slow down normal decode)
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: void writeMissingBitset(Iterable<?> values) throws java.io.IOException
-	  internal virtual void writeMissingBitset<T1>(IEnumerable<T1> values)
-	  {
-		long bits = 0;
-		int count = 0;
-		foreach (object v in values)
-		{
-		  if (count == 64)
-		  {
-			data.writeLong(bits);
-			count = 0;
-			bits = 0;
-		  }
-		  if (v != null)
-		  {
-			bits |= 1L << (count & 0x3f);
-		  }
-		  count++;
-		}
-		if (count > 0)
-		{
-		  data.writeLong(bits);
-		}
-	  }
-
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void addSortedField(org.apache.lucene.index.FieldInfo field, Iterable<org.apache.lucene.util.BytesRef> values, Iterable<Number> docToOrd) throws java.io.IOException
-	  public override void addSortedField(FieldInfo field, IEnumerable<BytesRef> values, IEnumerable<Number> docToOrd)
-	  {
-		meta.writeVInt(field.number);
-		meta.writeByte(SORTED);
-
-		// write the ordinals as numerics
-		addNumericFieldValues(field, docToOrd);
-
-		// write the values as binary
-		addBinaryFieldValues(field, values);
-	  }
-
-	  // note: this might not be the most efficient... but its fairly simple
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void addSortedSetField(org.apache.lucene.index.FieldInfo field, Iterable<org.apache.lucene.util.BytesRef> values, final Iterable<Number> docToOrdCount, final Iterable<Number> ords) throws java.io.IOException
-//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
-	  public override void addSortedSetField(FieldInfo field, IEnumerable<BytesRef> values, IEnumerable<Number> docToOrdCount, IEnumerable<Number> ords)
-	  {
-		meta.writeVInt(field.number);
-		meta.writeByte(SORTED_SET);
-
-		// First write docToOrdCounts, except we "aggregate" the
-		// counts so they turn into addresses, and add a final
-		// value = the total aggregate:
-		addNumericFieldValues(field, new IterableAnonymousInnerClassHelper(this, docToOrdCount));
-
-		// Write ordinals for all docs, appended into one big
-		// numerics:
-		addNumericFieldValues(field, ords);
-
-		// write the values as binary
-		addBinaryFieldValues(field, values);
-	  }
-
-	  private class IterableAnonymousInnerClassHelper : IEnumerable<Number>
-	  {
-		  private readonly DirectDocValuesConsumer outerInstance;
-
-		  private IEnumerable<Number> docToOrdCount;
-
-		  public IterableAnonymousInnerClassHelper(DirectDocValuesConsumer outerInstance, IEnumerable<Number> docToOrdCount)
-		  {
-			  this.outerInstance = outerInstance;
-			  this.docToOrdCount = docToOrdCount;
-		  }
-
-
-			  // Just aggregates the count values so they become
-			  // "addresses", and adds one more value in the end
-			  // (the final sum):
-
-		  public virtual IEnumerator<Number> GetEnumerator()
-		  {
-//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final java.util.Iterator<Number> iter = docToOrdCount.iterator();
-			IEnumerator<Number> iter = docToOrdCount.GetEnumerator();
-
-			return new IteratorAnonymousInnerClassHelper(this, iter);
-		  }
-
-		  private class IteratorAnonymousInnerClassHelper : IEnumerator<Number>
-		  {
-			  private readonly IterableAnonymousInnerClassHelper outerInstance;
-
-			  private IEnumerator<Number> iter;
-
-			  public IteratorAnonymousInnerClassHelper(IterableAnonymousInnerClassHelper outerInstance, IEnumerator<Number> iter)
-			  {
-				  this.outerInstance = outerInstance;
-				  this.iter = iter;
-			  }
-
-
-			  internal long sum;
-			  internal bool ended;
-
-			  public virtual bool hasNext()
-			  {
-//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
-				return iter.hasNext() || !ended;
-			  }
-
-			  public virtual Number next()
-			  {
-				long toReturn = sum;
-
-//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
-				if (iter.hasNext())
-				{
-//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
-				  Number n = iter.next();
-				  if (n != null)
-				  {
-					sum += (long)n;
-				  }
-				}
-				else if (!ended)
-				{
-				  ended = true;
-				}
-				else
-				{
-				  Debug.Assert(false);
-				}
-
-				return toReturn;
-			  }
-
-			  public virtual void remove()
-			  {
-				throw new System.NotSupportedException();
-			  }
-		  }
-	  }
-	}
-
+    using System;
+    using System.Diagnostics;
+    using System.Collections.Generic;
+   
+    using FieldInfo = Index.FieldInfo;
+    using IndexFileNames = Index.IndexFileNames;
+    using SegmentWriteState = Index.SegmentWriteState;
+    using IndexOutput = Store.IndexOutput;
+    using BytesRef = Util.BytesRef;
+    using IOUtils = Util.IOUtils;
+
+    /// <summary>
+    /// Writer for <seealso cref="DirectDocValuesFormat"/>
+    /// </summary>
+    internal class DirectDocValuesConsumer : DocValuesConsumer
+    {
+        internal IndexOutput data, meta;
+        internal readonly int maxDoc;
+
+        internal DirectDocValuesConsumer(SegmentWriteState state, string dataCodec, string dataExtension,
+            string metaCodec, string metaExtension)
+        {
+            maxDoc = state.SegmentInfo.DocCount;
+            bool success = false;
+            try
+            {
+                string dataName = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix,
+                    dataExtension);
+                data = state.Directory.CreateOutput(dataName, state.Context);
+                CodecUtil.WriteHeader(data, dataCodec, VERSION_CURRENT);
+                string metaName = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix,
+                    metaExtension);
+                meta = state.Directory.CreateOutput(metaName, state.Context);
+                CodecUtil.WriteHeader(meta, metaCodec, VERSION_CURRENT);
+                success = true;
+            }
+            finally
+            {
+                if (!success)
+                {
+                    IOUtils.CloseWhileHandlingException(this);
+                }
+            }
+        }
+
+        public override void AddNumericField(FieldInfo field, IEnumerable<long> values)
+        {
+            meta.WriteVInt(field.Number);
+            meta.WriteByte(NUMBER);
+            AddNumericFieldValues(field, values);
+        }
+
+        private void AddNumericFieldValues(FieldInfo field, IEnumerable<long> values)
+        {
+            meta.WriteLong(data.FilePointer);
+            long minValue = long.MaxValue;
+            long maxValue = long.MinValue;
+            bool missing = false;
+
+            long count = 0;
+            foreach (var nv in values)
+            {
+                if (nv != null)
+                {
+                    var v = nv;
+                    minValue = Math.Min(minValue, v);
+                    maxValue = Math.Max(maxValue, v);
+                }
+                else
+                {
+                    missing = true;
+                }
+                count++;
+                if (count >= DirectDocValuesFormat.MAX_SORTED_SET_ORDS)
+                {
+                    throw new ArgumentException("DocValuesField \"" + field.name + "\" is too large, must be <= " +
+                                                       DirectDocValuesFormat.MAX_SORTED_SET_ORDS + " values/total ords");
+                }
+            }
+            meta.WriteInt((int) count);
+
+            if (missing)
+            {
+                long start = data.FilePointer;
+                WriteMissingBitset(values);
+                meta.WriteLong(start);
+                meta.WriteLong(data.FilePointer - start);
+            }
+            else
+            {
+                meta.WriteLong(-1L);
+            }
+
+            sbyte byteWidth;
+            if (minValue >= sbyte.MinValue && maxValue <= sbyte.MaxValue)
+            {
+                byteWidth = 1;
+            }
+            else if (minValue >= short.MinValue && maxValue <= short.MaxValue)
+            {
+                byteWidth = 2;
+            }
+            else if (minValue >= int.MinValue && maxValue <= int.MaxValue)
+            {
+                byteWidth = 4;
+            }
+            else
+            {
+                byteWidth = 8;
+            }
+            meta.WriteByte(byteWidth);
+
+            foreach (var nv in values)
+            {
+                long v;
+                if (nv != null)
+                {
+                    v = (long) nv;
+                }
+                else
+                {
+                    v = 0;
+                }
+
+                switch (byteWidth)
+                {
+                    case 1:
+                        data.WriteByte((sbyte) v);
+                        break;
+                    case 2:
+                        data.WriteShort((short) v);
+                        break;
+                    case 4:
+                        data.WriteInt((int) v);
+                        break;
+                    case 8:
+                        data.WriteLong(v);
+                        break;
+                }
+            }
+        }
+
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing) return;
+
+            var success = false;
+            try
+            {
+                if (meta != null)
+                {
+                    meta.WriteVInt(-1); // write EOF marker
+                    CodecUtil.WriteFooter(meta); // write checksum
+                }
+                if (data != null)
+                {
+                    CodecUtil.WriteFooter(data);
+                }
+                success = true;
+            }
+            finally
+            {
+                if (success)
+                {
+                    IOUtils.Close(data, meta);
+                }
+                else
+                {
+                    IOUtils.CloseWhileHandlingException(data, meta);
+                }
+                data = meta = null;
+            }
+        }
+
+        public override void AddBinaryField(FieldInfo field, IEnumerable<BytesRef> values)
+        {
+            meta.WriteVInt(field.Number);
+            meta.WriteByte(BYTES);
+            AddBinaryFieldValues(field, values);
+        }
+
+        private void AddBinaryFieldValues(FieldInfo field, IEnumerable<BytesRef> values)
+        {
+            // write the byte[] data
+            long startFP = data.FilePointer;
+            bool missing = false;
+            long totalBytes = 0;
+            int count = 0;
+            foreach (BytesRef v in values)
+            {
+                if (v != null)
+                {
+                    data.WriteBytes(v.Bytes, v.Offset, v.Length);
+                    totalBytes += v.Length;
+                    if (totalBytes > DirectDocValuesFormat.MAX_TOTAL_BYTES_LENGTH)
+                    {
+                        throw new ArgumentException("DocValuesField \"" + field.name +
+                                                           "\" is too large, cannot have more than DirectDocValuesFormat.MAX_TOTAL_BYTES_LENGTH (" +
+                                                           DirectDocValuesFormat.MAX_TOTAL_BYTES_LENGTH + ") bytes");
+                    }
+                }
+                else
+                {
+                    missing = true;
+                }
+                count++;
+            }
+
+            meta.WriteLong(startFP);
+            meta.WriteInt((int) totalBytes);
+            meta.WriteInt(count);
+            if (missing)
+            {
+                long start = data.FilePointer;
+                WriteMissingBitset(values);
+                meta.WriteLong(start);
+                meta.WriteLong(data.FilePointer - start);
+            }
+            else
+            {
+                meta.WriteLong(-1L);
+            }
+
+            int addr = 0;
+            foreach (BytesRef v in values)
+            {
+                data.WriteInt(addr);
+                if (v != null)
+                {
+                    addr += v.Length;
+                }
+            }
+            data.WriteInt(addr);
+        }
+
+        // TODO: in some cases representing missing with minValue-1 wouldn't take up additional space and so on,
+        // but this is very simple, and algorithms only check this for values of 0 anyway (doesnt slow down normal decode)
+        internal virtual void WriteMissingBitset<T1>(IEnumerable<T1> values)
+        {
+            long bits = 0;
+            int count = 0;
+            foreach (object v in values)
+            {
+                if (count == 64)
+                {
+                    data.WriteLong(bits);
+                    count = 0;
+                    bits = 0;
+                }
+                if (v != null)
+                {
+                    bits |= 1L << (count & 0x3f);
+                }
+                count++;
+            }
+            if (count > 0)
+            {
+                data.WriteLong(bits);
+            }
+        }
+
+        public override void AddSortedField(FieldInfo field, IEnumerable<BytesRef> values, IEnumerable<long> docToOrd)
+        {
+            meta.WriteVInt(field.Number);
+            meta.WriteByte(SORTED);
+
+            // write the ordinals as numerics
+            AddNumericFieldValues(field, docToOrd);
+
+            // write the values as binary
+            AddBinaryFieldValues(field, values);
+        }
+
+        // note: this might not be the most efficient... but its fairly simple
+        public override void AddSortedSetField(FieldInfo field, IEnumerable<BytesRef> values,
+            IEnumerable<long> docToOrdCount, IEnumerable<long> ords)
+        {
+            meta.WriteVInt(field.Number);
+            meta.WriteByte(SORTED_SET);
+
+            // First write docToOrdCounts, except we "aggregate" the
+            // counts so they turn into addresses, and add a final
+            // value = the total aggregate:
+            AddNumericFieldValues(field, new IterableAnonymousInnerClassHelper(this, docToOrdCount));
+
+            // Write ordinals for all docs, appended into one big
+            // numerics:
+            AddNumericFieldValues(field, ords);
+
+            // write the values as binary
+            AddBinaryFieldValues(field, values);
+        }
+
+        private class IterableAnonymousInnerClassHelper : IEnumerable<Number>
+        {
+            private readonly DirectDocValuesConsumer _outerInstance;
+            private readonly IEnumerable<long> _docToOrdCount;
+
+            public IterableAnonymousInnerClassHelper(DirectDocValuesConsumer outerInstance,
+                IEnumerable<long> docToOrdCount)
+            {
+                _outerInstance = outerInstance;
+                _docToOrdCount = docToOrdCount;
+            }
+
+
+            // Just aggregates the count values so they become
+            // "addresses", and adds one more value in the end
+            // (the final sum):
+
+            public virtual IEnumerator<long> GetEnumerator()
+            {
+                var iter = _docToOrdCount.GetEnumerator();
+                return new IteratorAnonymousInnerClassHelper(this, iter);
+            }
+
+            private class IteratorAnonymousInnerClassHelper : IEnumerator<long>
+            {
+                private readonly IterableAnonymousInnerClassHelper outerInstance;
+                private readonly IEnumerator<long> _iter;
+
+                public IteratorAnonymousInnerClassHelper(IterableAnonymousInnerClassHelper outerInstance,
+                    IEnumerator<long> iter)
+                {
+                    this.outerInstance = outerInstance;
+                    _iter = iter;
+                }
+
+
+                internal long sum;
+                internal bool ended;
+
+                public virtual bool HasNext()
+                {
+                    return _iter.HasNext() || !ended;
+                }
+
+                public virtual long Next()
+                {
+                    long toReturn = sum;
+                    if (_iter.hasNext())
+                    {
+                        long n = _iter.next();
+                        if (n != null)
+                        {
+                            sum += n;
+                        }
+                    }
+                    else if (!ended)
+                    {
+                        ended = true;
+                    }
+                    else
+                    {
+                        Debug.Assert(false);
+                    }
+
+                    return toReturn;
+                }
+
+                public virtual void Remove()
+                {
+                    throw new NotSupportedException();
+                }
+            }
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/af4d125b/src/Lucene.Net.Codecs/Memory/DirectDocValuesFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Memory/DirectDocValuesFormat.cs b/src/Lucene.Net.Codecs/Memory/DirectDocValuesFormat.cs
index 715d190..f2cdfef 100644
--- a/src/Lucene.Net.Codecs/Memory/DirectDocValuesFormat.cs
+++ b/src/Lucene.Net.Codecs/Memory/DirectDocValuesFormat.cs
@@ -1,94 +1,87 @@
-namespace org.apache.lucene.codecs.memory
-{
-
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
-	using SortedSetDocValuesField = org.apache.lucene.document.SortedSetDocValuesField; // javadocs
-	using SegmentReadState = org.apache.lucene.index.SegmentReadState;
-	using SegmentWriteState = org.apache.lucene.index.SegmentWriteState;
-	using ArrayUtil = org.apache.lucene.util.ArrayUtil;
-
-	/// <summary>
-	/// In-memory docvalues format that does no (or very little)
-	///  compression.  Indexed values are stored on disk, but
-	///  then at search time all values are loaded into memory as
-	///  simple java arrays.  For numeric values, it uses
-	///  byte[], short[], int[], long[] as necessary to fit the
-	///  range of the values.  For binary values, there is an int
-	///  (4 bytes) overhead per value.
-	/// 
-	///  <para>Limitations:
-	///  <ul>
-	///    <li>For binary and sorted fields the total space
-	///        required for all binary values cannot exceed about
-	///        2.1 GB (see #MAX_TOTAL_BYTES_LENGTH).</li>
-	/// 
-	///    <li>For sorted set fields, the sum of the size of each
-	///        document's set of values cannot exceed about 2.1 B
-	///        values (see #MAX_SORTED_SET_ORDS).  For example,
-	///        if every document has 10 values (10 instances of
-	///        <seealso cref="SortedSetDocValuesField"/>) added, then no
-	///        more than ~210 M documents can be added to one
-	///        segment. </li>
-	///  </ul> 
-	/// </para>
-	/// </summary>
+namespace Lucene.Net.Codecs.Memory
+{
 
-	public class DirectDocValuesFormat : DocValuesFormat
-	{
+	using SegmentReadState = Index.SegmentReadState;
+	using SegmentWriteState = Index.SegmentWriteState;
+	using ArrayUtil = Util.ArrayUtil;
 
-	  /// <summary>
-	  /// The sum of all byte lengths for binary field, or for
-	  ///  the unique values in sorted or sorted set fields, cannot
-	  ///  exceed this. 
-	  /// </summary>
-	  public static readonly int MAX_TOTAL_BYTES_LENGTH = ArrayUtil.MAX_ARRAY_LENGTH;
+    /// <summary>
+    /// In-memory docvalues format that does no (or very little)
+    ///  compression.  Indexed values are stored on disk, but
+    ///  then at search time all values are loaded into memory as
+    ///  simple java arrays.  For numeric values, it uses
+    ///  byte[], short[], int[], long[] as necessary to fit the
+    ///  range of the values.  For binary values, there is an int
+    ///  (4 bytes) overhead per value.
+    /// 
+    ///  <para>Limitations:
+    ///  <ul>
+    ///    <li>For binary and sorted fields the total space
+    ///        required for all binary values cannot exceed about
+    ///        2.1 GB (see #MAX_TOTAL_BYTES_LENGTH).</li>
+    /// 
+    ///    <li>For sorted set fields, the sum of the size of each
+    ///        document's set of values cannot exceed about 2.1 B
+    ///        values (see #MAX_SORTED_SET_ORDS).  For example,
+    ///        if every document has 10 values (10 instances of
+    ///        <seealso cref="SortedSetDocValuesField"/>) added, then no
+    ///        more than ~210 M documents can be added to one
+    ///        segment. </li>
+    ///  </ul> 
+    /// </para>
+    /// </summary>
+    public class DirectDocValuesFormat : DocValuesFormat
+    {
 
-	  /// <summary>
-	  /// The sum of the number of values across all documents
-	  ///  in a sorted set field cannot exceed this. 
-	  /// </summary>
-	  public static readonly int MAX_SORTED_SET_ORDS = ArrayUtil.MAX_ARRAY_LENGTH;
+        /// <summary>
+        /// The sum of all byte lengths for binary field, or for
+        ///  the unique values in sorted or sorted set fields, cannot
+        ///  exceed this. 
+        /// </summary>
+        public static readonly int MAX_TOTAL_BYTES_LENGTH = ArrayUtil.MAX_ARRAY_LENGTH;
 
-	  /// <summary>
-	  /// Sole constructor. </summary>
-	  public DirectDocValuesFormat() : base("Direct")
-	  {
-	  }
+        /// <summary>
+        /// The sum of the number of values across all documents
+        ///  in a sorted set field cannot exceed this. 
+        /// </summary>
+        public static readonly int MAX_SORTED_SET_ORDS = ArrayUtil.MAX_ARRAY_LENGTH;
 
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.codecs.DocValuesConsumer fieldsConsumer(org.apache.lucene.index.SegmentWriteState state) throws java.io.IOException
-	  public override DocValuesConsumer fieldsConsumer(SegmentWriteState state)
-	  {
-		return new DirectDocValuesConsumer(state, DATA_CODEC, DATA_EXTENSION, METADATA_CODEC, METADATA_EXTENSION);
-	  }
+        internal const string DATA_CODEC = "DirectDocValuesData";
+        internal const string DATA_EXTENSION = "dvdd";
+        internal const string METADATA_CODEC = "DirectDocValuesMetadata";
+        internal const string METADATA_EXTENSION = "dvdm";
 
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.codecs.DocValuesProducer fieldsProducer(org.apache.lucene.index.SegmentReadState state) throws java.io.IOException
-	  public override DocValuesProducer fieldsProducer(SegmentReadState state)
-	  {
-		return new DirectDocValuesProducer(state, DATA_CODEC, DATA_EXTENSION, METADATA_CODEC, METADATA_EXTENSION);
-	  }
+        /// <summary>
+        /// Sole constructor. </summary>
+        public DirectDocValuesFormat() : base("Direct")
+        {
+        }
 
-	  internal const string DATA_CODEC = "DirectDocValuesData";
-	  internal const string DATA_EXTENSION = "dvdd";
-	  internal const string METADATA_CODEC = "DirectDocValuesMetadata";
-	  internal const string METADATA_EXTENSION = "dvdm";
-	}
+        public override DocValuesConsumer FieldsConsumer(SegmentWriteState state)
+        {
+            return new DirectDocValuesConsumer(state, DATA_CODEC, DATA_EXTENSION, METADATA_CODEC, METADATA_EXTENSION);
+        }
 
+        public override DocValuesProducer FieldsProducer(SegmentReadState state)
+        {
+            return new DirectDocValuesProducer(state, DATA_CODEC, DATA_EXTENSION, METADATA_CODEC, METADATA_EXTENSION);
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/af4d125b/src/Lucene.Net.Codecs/Memory/DirectDocValuesProducer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Memory/DirectDocValuesProducer.cs b/src/Lucene.Net.Codecs/Memory/DirectDocValuesProducer.cs
index ee88b68..4435525 100644
--- a/src/Lucene.Net.Codecs/Memory/DirectDocValuesProducer.cs
+++ b/src/Lucene.Net.Codecs/Memory/DirectDocValuesProducer.cs
@@ -1,7 +1,10 @@
 using System.Diagnostics;
 using System.Collections.Generic;
+using Lucene.Net.Index;
+using Lucene.Net.Support;
+using Lucene.Net.Util;
 
-namespace org.apache.lucene.codecs.memory
+namespace Lucene.Net.Codecs.Memory
 {
 
 	/*
@@ -22,23 +25,23 @@ namespace org.apache.lucene.codecs.memory
 	 */
 
 
-	using BinaryDocValues = org.apache.lucene.index.BinaryDocValues;
-	using CorruptIndexException = org.apache.lucene.index.CorruptIndexException;
-	using DocValues = org.apache.lucene.index.DocValues;
-	using FieldInfo = org.apache.lucene.index.FieldInfo;
-	using IndexFileNames = org.apache.lucene.index.IndexFileNames;
-	using NumericDocValues = org.apache.lucene.index.NumericDocValues;
-	using RandomAccessOrds = org.apache.lucene.index.RandomAccessOrds;
-	using SegmentReadState = org.apache.lucene.index.SegmentReadState;
-	using SortedDocValues = org.apache.lucene.index.SortedDocValues;
-	using SortedSetDocValues = org.apache.lucene.index.SortedSetDocValues;
-	using ChecksumIndexInput = org.apache.lucene.store.ChecksumIndexInput;
-	using IndexInput = org.apache.lucene.store.IndexInput;
-	using Bits = org.apache.lucene.util.Bits;
-	using BytesRef = org.apache.lucene.util.BytesRef;
-	using FixedBitSet = org.apache.lucene.util.FixedBitSet;
-	using IOUtils = org.apache.lucene.util.IOUtils;
-	using RamUsageEstimator = org.apache.lucene.util.RamUsageEstimator;
+	using BinaryDocValues = index.BinaryDocValues;
+	using CorruptIndexException = index.CorruptIndexException;
+	using DocValues = index.DocValues;
+	using FieldInfo = index.FieldInfo;
+	using IndexFileNames = index.IndexFileNames;
+	using NumericDocValues = index.NumericDocValues;
+	using RandomAccessOrds = index.RandomAccessOrds;
+	using SegmentReadState = index.SegmentReadState;
+	using SortedDocValues = index.SortedDocValues;
+	using SortedSetDocValues = index.SortedSetDocValues;
+	using ChecksumIndexInput = store.ChecksumIndexInput;
+	using IndexInput = store.IndexInput;
+	using Bits = util.Bits;
+	using BytesRef = util.BytesRef;
+	using FixedBitSet = util.FixedBitSet;
+	using IOUtils = util.IOUtils;
+	using RamUsageEstimator = util.RamUsageEstimator;
 
 	/// <summary>
 	/// Reader for <seealso cref="DirectDocValuesFormat"/>
@@ -74,7 +77,7 @@ namespace org.apache.lucene.codecs.memory
 	  internal const int VERSION_CURRENT = VERSION_CHECKSUM;
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: DirectDocValuesProducer(org.apache.lucene.index.SegmentReadState state, String dataCodec, String dataExtension, String metaCodec, String metaExtension) throws java.io.IOException
+//ORIGINAL LINE: DirectDocValuesProducer(index.SegmentReadState state, String dataCodec, String dataExtension, String metaCodec, String metaExtension) throws java.io.IOException
 	  internal DirectDocValuesProducer(SegmentReadState state, string dataCodec, string dataExtension, string metaCodec, string metaExtension)
 	  {
 		maxDoc = state.segmentInfo.DocCount;
@@ -116,7 +119,7 @@ namespace org.apache.lucene.codecs.memory
 		  string dataName = IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, dataExtension);
 		  data = state.directory.openInput(dataName, state.context);
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final int version2 = org.apache.lucene.codecs.CodecUtil.checkHeader(data, dataCodec, VERSION_START, VERSION_CURRENT);
+//ORIGINAL LINE: final int version2 = codecs.CodecUtil.checkHeader(data, dataCodec, VERSION_START, VERSION_CURRENT);
 		  int version2 = CodecUtil.checkHeader(data, dataCodec, VERSION_START, VERSION_CURRENT);
 		  if (version != version2)
 		  {
@@ -135,7 +138,7 @@ namespace org.apache.lucene.codecs.memory
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: private NumericEntry readNumericEntry(org.apache.lucene.store.IndexInput meta) throws java.io.IOException
+//ORIGINAL LINE: private NumericEntry readNumericEntry(store.IndexInput meta) throws java.io.IOException
 	  private NumericEntry readNumericEntry(IndexInput meta)
 	  {
 		NumericEntry entry = new NumericEntry();
@@ -156,7 +159,7 @@ namespace org.apache.lucene.codecs.memory
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: private BinaryEntry readBinaryEntry(org.apache.lucene.store.IndexInput meta) throws java.io.IOException
+//ORIGINAL LINE: private BinaryEntry readBinaryEntry(store.IndexInput meta) throws java.io.IOException
 	  private BinaryEntry readBinaryEntry(IndexInput meta)
 	  {
 		BinaryEntry entry = new BinaryEntry();
@@ -177,7 +180,7 @@ namespace org.apache.lucene.codecs.memory
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: private SortedEntry readSortedEntry(org.apache.lucene.store.IndexInput meta) throws java.io.IOException
+//ORIGINAL LINE: private SortedEntry readSortedEntry(store.IndexInput meta) throws java.io.IOException
 	  private SortedEntry readSortedEntry(IndexInput meta)
 	  {
 		SortedEntry entry = new SortedEntry();
@@ -187,7 +190,7 @@ namespace org.apache.lucene.codecs.memory
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: private SortedSetEntry readSortedSetEntry(org.apache.lucene.store.IndexInput meta) throws java.io.IOException
+//ORIGINAL LINE: private SortedSetEntry readSortedSetEntry(store.IndexInput meta) throws java.io.IOException
 	  private SortedSetEntry readSortedSetEntry(IndexInput meta)
 	  {
 		SortedSetEntry entry = new SortedSetEntry();
@@ -198,7 +201,7 @@ namespace org.apache.lucene.codecs.memory
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: private void readFields(org.apache.lucene.store.IndexInput meta) throws java.io.IOException
+//ORIGINAL LINE: private void readFields(store.IndexInput meta) throws java.io.IOException
 	  private void readFields(IndexInput meta)
 	  {
 		int fieldNumber = meta.readVInt();
@@ -245,7 +248,7 @@ namespace org.apache.lucene.codecs.memory
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public synchronized org.apache.lucene.index.NumericDocValues getNumeric(org.apache.lucene.index.FieldInfo field) throws java.io.IOException
+//ORIGINAL LINE: @Override public synchronized index.NumericDocValues getNumeric(index.FieldInfo field) throws java.io.IOException
 	  public override NumericDocValues getNumeric(FieldInfo field)
 	  {
 		  lock (this)
@@ -262,7 +265,7 @@ namespace org.apache.lucene.codecs.memory
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: private org.apache.lucene.index.NumericDocValues loadNumeric(NumericEntry entry) throws java.io.IOException
+//ORIGINAL LINE: private index.NumericDocValues loadNumeric(NumericEntry entry) throws java.io.IOException
 	  private NumericDocValues loadNumeric(NumericEntry entry)
 	  {
 		data.seek(entry.offset + entry.missingBytes);
@@ -395,7 +398,7 @@ namespace org.apache.lucene.codecs.memory
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public synchronized org.apache.lucene.index.BinaryDocValues getBinary(org.apache.lucene.index.FieldInfo field) throws java.io.IOException
+//ORIGINAL LINE: @Override public synchronized index.BinaryDocValues getBinary(index.FieldInfo field) throws java.io.IOException
 	  public override BinaryDocValues getBinary(FieldInfo field)
 	  {
 		  lock (this)
@@ -412,7 +415,7 @@ namespace org.apache.lucene.codecs.memory
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: private org.apache.lucene.index.BinaryDocValues loadBinary(BinaryEntry entry) throws java.io.IOException
+//ORIGINAL LINE: private index.BinaryDocValues loadBinary(BinaryEntry entry) throws java.io.IOException
 	  private BinaryDocValues loadBinary(BinaryEntry entry)
 	  {
 		data.seek(entry.offset);
@@ -459,7 +462,7 @@ namespace org.apache.lucene.codecs.memory
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public synchronized org.apache.lucene.index.SortedDocValues getSorted(org.apache.lucene.index.FieldInfo field) throws java.io.IOException
+//ORIGINAL LINE: @Override public synchronized index.SortedDocValues getSorted(index.FieldInfo field) throws java.io.IOException
 	  public override SortedDocValues getSorted(FieldInfo field)
 	  {
 		  lock (this)
@@ -476,17 +479,17 @@ namespace org.apache.lucene.codecs.memory
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: private org.apache.lucene.index.SortedDocValues loadSorted(org.apache.lucene.index.FieldInfo field) throws java.io.IOException
+//ORIGINAL LINE: private index.SortedDocValues loadSorted(index.FieldInfo field) throws java.io.IOException
 	  private SortedDocValues loadSorted(FieldInfo field)
 	  {
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
 //ORIGINAL LINE: final SortedEntry entry = sorteds.get(field.number);
 		SortedEntry entry = sorteds[field.number];
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.index.NumericDocValues docToOrd = loadNumeric(entry.docToOrd);
+//ORIGINAL LINE: final index.NumericDocValues docToOrd = loadNumeric(entry.docToOrd);
 		NumericDocValues docToOrd = loadNumeric(entry.docToOrd);
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.index.BinaryDocValues values = loadBinary(entry.values);
+//ORIGINAL LINE: final index.BinaryDocValues values = loadBinary(entry.values);
 		BinaryDocValues values = loadBinary(entry.values);
 
 		return new SortedDocValuesAnonymousInnerClassHelper(this, entry, docToOrd, values);
@@ -496,11 +499,11 @@ namespace org.apache.lucene.codecs.memory
 	  {
 		  private readonly DirectDocValuesProducer outerInstance;
 
-		  private org.apache.lucene.codecs.memory.DirectDocValuesProducer.SortedEntry entry;
+		  private Lucene.Net.Codecs.Memory.DirectDocValuesProducer.SortedEntry entry;
 		  private NumericDocValues docToOrd;
 		  private BinaryDocValues values;
 
-		  public SortedDocValuesAnonymousInnerClassHelper(DirectDocValuesProducer outerInstance, org.apache.lucene.codecs.memory.DirectDocValuesProducer.SortedEntry entry, NumericDocValues docToOrd, BinaryDocValues values)
+		  public SortedDocValuesAnonymousInnerClassHelper(DirectDocValuesProducer outerInstance, Lucene.Net.Codecs.Memory.DirectDocValuesProducer.SortedEntry entry, NumericDocValues docToOrd, BinaryDocValues values)
 		  {
 			  this.outerInstance = outerInstance;
 			  this.entry = entry;
@@ -533,7 +536,7 @@ namespace org.apache.lucene.codecs.memory
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public synchronized org.apache.lucene.index.SortedSetDocValues getSortedSet(org.apache.lucene.index.FieldInfo field) throws java.io.IOException
+//ORIGINAL LINE: @Override public synchronized index.SortedSetDocValues getSortedSet(index.FieldInfo field) throws java.io.IOException
 	  public override SortedSetDocValues getSortedSet(FieldInfo field)
 	  {
 		  lock (this)
@@ -550,13 +553,13 @@ namespace org.apache.lucene.codecs.memory
 			}
         
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.index.NumericDocValues docToOrdAddress = instance.docToOrdAddress;
+//ORIGINAL LINE: final index.NumericDocValues docToOrdAddress = instance.docToOrdAddress;
 			NumericDocValues docToOrdAddress = instance.docToOrdAddress;
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.index.NumericDocValues ords = instance.ords;
+//ORIGINAL LINE: final index.NumericDocValues ords = instance.ords;
 			NumericDocValues ords = instance.ords;
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.index.BinaryDocValues values = instance.values;
+//ORIGINAL LINE: final index.BinaryDocValues values = instance.values;
 			BinaryDocValues values = instance.values;
         
 			// Must make a new instance since the iterator has state:
@@ -568,12 +571,12 @@ namespace org.apache.lucene.codecs.memory
 	  {
 		  private readonly DirectDocValuesProducer outerInstance;
 
-		  private org.apache.lucene.codecs.memory.DirectDocValuesProducer.SortedSetEntry entry;
+		  private Lucene.Net.Codecs.Memory.DirectDocValuesProducer.SortedSetEntry entry;
 		  private NumericDocValues docToOrdAddress;
 		  private NumericDocValues ords;
 		  private BinaryDocValues values;
 
-		  public RandomAccessOrdsAnonymousInnerClassHelper(DirectDocValuesProducer outerInstance, org.apache.lucene.codecs.memory.DirectDocValuesProducer.SortedSetEntry entry, NumericDocValues docToOrdAddress, NumericDocValues ords, BinaryDocValues values)
+		  public RandomAccessOrdsAnonymousInnerClassHelper(DirectDocValuesProducer outerInstance, Lucene.Net.Codecs.Memory.DirectDocValuesProducer.SortedSetEntry entry, NumericDocValues docToOrdAddress, NumericDocValues ords, BinaryDocValues values)
 		  {
 			  this.outerInstance = outerInstance;
 			  this.entry = entry;
@@ -647,7 +650,7 @@ namespace org.apache.lucene.codecs.memory
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: private org.apache.lucene.util.Bits getMissingBits(int fieldNumber, final long offset, final long length) throws java.io.IOException
+//ORIGINAL LINE: private util.Bits getMissingBits(int fieldNumber, final long offset, final long length) throws java.io.IOException
 //JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
 	  private Bits getMissingBits(int fieldNumber, long offset, long length)
 	  {
@@ -680,7 +683,7 @@ namespace org.apache.lucene.codecs.memory
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.util.Bits getDocsWithField(org.apache.lucene.index.FieldInfo field) throws java.io.IOException
+//ORIGINAL LINE: @Override public util.Bits getDocsWithField(index.FieldInfo field) throws java.io.IOException
 	  public override Bits getDocsWithField(FieldInfo field)
 	  {
 		switch (field.DocValuesType)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/af4d125b/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 310a771..36ba9d5 100644
--- a/src/Lucene.Net.Codecs/Memory/DirectPostingsFormat.cs
+++ b/src/Lucene.Net.Codecs/Memory/DirectPostingsFormat.cs
@@ -2,7 +2,7 @@
 using System.Diagnostics;
 using System.Collections.Generic;
 
-namespace org.apache.lucene.codecs.memory
+namespace Lucene.Net.Codecs.Memory
 {
 
 	/// <summary>
@@ -23,27 +23,27 @@ namespace org.apache.lucene.codecs.memory
 	/// </summary>
 
 
-	using Lucene41PostingsFormat = org.apache.lucene.codecs.lucene41.Lucene41PostingsFormat; // javadocs
-	using DocsAndPositionsEnum = org.apache.lucene.index.DocsAndPositionsEnum;
-	using DocsEnum = org.apache.lucene.index.DocsEnum;
-	using IndexOptions = org.apache.lucene.index.FieldInfo.IndexOptions;
-	using FieldInfo = org.apache.lucene.index.FieldInfo;
-	using Fields = org.apache.lucene.index.Fields;
-	using OrdTermState = org.apache.lucene.index.OrdTermState;
-	using SegmentReadState = org.apache.lucene.index.SegmentReadState;
-	using SegmentWriteState = org.apache.lucene.index.SegmentWriteState;
-	using TermState = org.apache.lucene.index.TermState;
-	using Terms = org.apache.lucene.index.Terms;
-	using TermsEnum = org.apache.lucene.index.TermsEnum;
-	using IOContext = org.apache.lucene.store.IOContext;
-	using RAMOutputStream = org.apache.lucene.store.RAMOutputStream;
-	using ArrayUtil = org.apache.lucene.util.ArrayUtil;
-	using Bits = org.apache.lucene.util.Bits;
-	using BytesRef = org.apache.lucene.util.BytesRef;
-	using RamUsageEstimator = org.apache.lucene.util.RamUsageEstimator;
-	using CompiledAutomaton = org.apache.lucene.util.automaton.CompiledAutomaton;
-	using RunAutomaton = org.apache.lucene.util.automaton.RunAutomaton;
-	using Transition = org.apache.lucene.util.automaton.Transition;
+	using Lucene41PostingsFormat = codecs.lucene41.Lucene41PostingsFormat; // javadocs
+	using DocsAndPositionsEnum = index.DocsAndPositionsEnum;
+	using DocsEnum = index.DocsEnum;
+	using IndexOptions = index.FieldInfo.IndexOptions;
+	using FieldInfo = index.FieldInfo;
+	using Fields = index.Fields;
+	using OrdTermState = index.OrdTermState;
+	using SegmentReadState = index.SegmentReadState;
+	using SegmentWriteState = index.SegmentWriteState;
+	using TermState = index.TermState;
+	using Terms = index.Terms;
+	using TermsEnum = index.TermsEnum;
+	using IOContext = store.IOContext;
+	using RAMOutputStream = store.RAMOutputStream;
+	using ArrayUtil = util.ArrayUtil;
+	using Bits = util.Bits;
+	using BytesRef = util.BytesRef;
+	using RamUsageEstimator = util.RamUsageEstimator;
+	using CompiledAutomaton = util.automaton.CompiledAutomaton;
+	using RunAutomaton = util.automaton.RunAutomaton;
+	using Transition = util.automaton.Transition;
 
 	// TODO: 
 	//   - build depth-N prefix hash?
@@ -104,14 +104,14 @@ namespace org.apache.lucene.codecs.memory
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.codecs.FieldsConsumer fieldsConsumer(org.apache.lucene.index.SegmentWriteState state) throws java.io.IOException
+//ORIGINAL LINE: @Override public codecs.FieldsConsumer fieldsConsumer(index.SegmentWriteState state) throws java.io.IOException
 	  public override FieldsConsumer fieldsConsumer(SegmentWriteState state)
 	  {
 		return PostingsFormat.forName("Lucene41").fieldsConsumer(state);
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.codecs.FieldsProducer fieldsProducer(org.apache.lucene.index.SegmentReadState state) throws java.io.IOException
+//ORIGINAL LINE: @Override public codecs.FieldsProducer fieldsProducer(index.SegmentReadState state) throws java.io.IOException
 	  public override FieldsProducer fieldsProducer(SegmentReadState state)
 	  {
 		FieldsProducer postings = PostingsFormat.forName("Lucene41").fieldsProducer(state);
@@ -141,7 +141,7 @@ namespace org.apache.lucene.codecs.memory
 		internal readonly IDictionary<string, DirectField> fields = new SortedDictionary<string, DirectField>();
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: public DirectFields(org.apache.lucene.index.SegmentReadState state, org.apache.lucene.index.Fields fields, int minSkipCount, int lowFreqCutoff) throws java.io.IOException
+//ORIGINAL LINE: public DirectFields(index.SegmentReadState state, index.Fields fields, int minSkipCount, int lowFreqCutoff) throws java.io.IOException
 		public DirectFields(SegmentReadState state, Fields fields, int minSkipCount, int lowFreqCutoff)
 		{
 		  foreach (string field in fields)
@@ -333,11 +333,11 @@ namespace org.apache.lucene.codecs.memory
 		}
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: public DirectField(org.apache.lucene.index.SegmentReadState state, String field, org.apache.lucene.index.Terms termsIn, int minSkipCount, int lowFreqCutoff) throws java.io.IOException
+//ORIGINAL LINE: public DirectField(index.SegmentReadState state, String field, index.Terms termsIn, int minSkipCount, int lowFreqCutoff) throws java.io.IOException
 		public DirectField(SegmentReadState state, string field, Terms termsIn, int minSkipCount, int lowFreqCutoff)
 		{
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.index.FieldInfo fieldInfo = state.fieldInfos.fieldInfo(field);
+//ORIGINAL LINE: final index.FieldInfo fieldInfo = state.fieldInfos.fieldInfo(field);
 		  FieldInfo fieldInfo = state.fieldInfos.fieldInfo(field);
 
 		  sumTotalTermFreq = termsIn.SumTotalTermFreq;
@@ -367,7 +367,7 @@ namespace org.apache.lucene.codecs.memory
 		  DocsEnum docsEnum = null;
 		  DocsAndPositionsEnum docsAndPositionsEnum = null;
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.index.TermsEnum termsEnum = termsIn.iterator(null);
+//ORIGINAL LINE: final index.TermsEnum termsEnum = termsIn.iterator(null);
 		  TermsEnum termsEnum = termsIn.iterator(null);
 		  int termOffset = 0;
 
@@ -377,7 +377,7 @@ namespace org.apache.lucene.codecs.memory
 
 		  // Used for payloads, if any:
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.store.RAMOutputStream ros = new org.apache.lucene.store.RAMOutputStream();
+//ORIGINAL LINE: final store.RAMOutputStream ros = new store.RAMOutputStream();
 		  RAMOutputStream ros = new RAMOutputStream();
 
 		  // if (DEBUG) {
@@ -421,7 +421,7 @@ namespace org.apache.lucene.codecs.memory
 			TermAndSkip ent;
 
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.index.DocsEnum docsEnum2;
+//ORIGINAL LINE: final index.DocsEnum docsEnum2;
 			DocsEnum docsEnum2;
 			if (hasPos)
 			{
@@ -462,7 +462,7 @@ namespace org.apache.lucene.codecs.memory
 					  if (hasPayloads_Renamed)
 					  {
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.util.BytesRef payload = docsAndPositionsEnum.getPayload();
+//ORIGINAL LINE: final util.BytesRef payload = docsAndPositionsEnum.getPayload();
 						BytesRef payload = docsAndPositionsEnum.Payload;
 						if (payload != null)
 						{
@@ -841,7 +841,7 @@ namespace org.apache.lucene.codecs.memory
 		}
 
 //JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.index.TermsEnum intersect(org.apache.lucene.util.automaton.CompiledAutomaton compiled, final org.apache.lucene.util.BytesRef startTerm)
+//ORIGINAL LINE: @Override public index.TermsEnum intersect(util.automaton.CompiledAutomaton compiled, final util.BytesRef startTerm)
 		public override TermsEnum intersect(CompiledAutomaton compiled, BytesRef startTerm)
 		{
 		  return new DirectIntersectTermsEnum(this, compiled, startTerm);
@@ -1052,7 +1052,7 @@ namespace org.apache.lucene.codecs.memory
 		  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public void seekExact(org.apache.lucene.util.BytesRef term, org.apache.lucene.index.TermState state) throws java.io.IOException
+//ORIGINAL LINE: @Override public void seekExact(util.BytesRef term, index.TermState state) throws java.io.IOException
 		  public override void seekExact(BytesRef term, TermState state)
 		  {
 			termOrd = (int)((OrdTermState) state).ord;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/af4d125b/src/Lucene.Net.Codecs/Memory/FSTOrdPulsing41PostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Memory/FSTOrdPulsing41PostingsFormat.cs b/src/Lucene.Net.Codecs/Memory/FSTOrdPulsing41PostingsFormat.cs
index 8d0317d..0139e35 100644
--- a/src/Lucene.Net.Codecs/Memory/FSTOrdPulsing41PostingsFormat.cs
+++ b/src/Lucene.Net.Codecs/Memory/FSTOrdPulsing41PostingsFormat.cs
@@ -1,101 +1,92 @@
-namespace org.apache.lucene.codecs.memory
-{
-
-	/*
-	 * Licensed to the Apache Software Foundation (ASF) under one or more
-	 * contributor license agreements.  See the NOTICE file distributed with
-	 * this work for additional information regarding copyright ownership.
-	 * The ASF licenses this file to You under the Apache License, Version 2.0
-	 * (the "License"); you may not use this file except in compliance with
-	 * the License.  You may obtain a copy of the License at
-	 *
-	 *     http://www.apache.org/licenses/LICENSE-2.0
-	 *
-	 * Unless required by applicable law or agreed to in writing, software
-	 * distributed under the License is distributed on an "AS IS" BASIS,
-	 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-	 * See the License for the specific language governing permissions and
-	 * limitations under the License.
-	 */
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
-	using Lucene41PostingsWriter = org.apache.lucene.codecs.lucene41.Lucene41PostingsWriter;
-	using Lucene41PostingsReader = org.apache.lucene.codecs.lucene41.Lucene41PostingsReader;
-	using Lucene41PostingsBaseFormat = org.apache.lucene.codecs.lucene41.Lucene41PostingsBaseFormat;
-	using Lucene41PostingsFormat = org.apache.lucene.codecs.lucene41.Lucene41PostingsFormat;
-	using PulsingPostingsWriter = org.apache.lucene.codecs.pulsing.PulsingPostingsWriter;
-	using PulsingPostingsReader = org.apache.lucene.codecs.pulsing.PulsingPostingsReader;
-	using SegmentReadState = org.apache.lucene.index.SegmentReadState;
-	using SegmentWriteState = org.apache.lucene.index.SegmentWriteState;
-	using IOUtils = org.apache.lucene.util.IOUtils;
-
-	/// <summary>
-	/// FSTOrd + Pulsing41
-	///  @lucene.experimental 
-	/// </summary>
+namespace Lucene.Net.Codecs.Memory
+{
+    using Lucene41PostingsBaseFormat = Lucene41.Lucene41PostingsBaseFormat;
+    using PulsingPostingsWriter = Pulsing.PulsingPostingsWriter;
+    using PulsingPostingsReader = Pulsing.PulsingPostingsReader;
+    using SegmentReadState = Index.SegmentReadState;
+    using SegmentWriteState = Index.SegmentWriteState;
+    using IOUtils = Util.IOUtils;
 
-	public class FSTOrdPulsing41PostingsFormat : PostingsFormat
-	{
-	  private readonly PostingsBaseFormat wrappedPostingsBaseFormat;
-	  private readonly int freqCutoff;
+    /// <summary>
+    /// FSTOrd + Pulsing41
+    ///  @lucene.experimental 
+    /// </summary>
 
-	  public FSTOrdPulsing41PostingsFormat() : this(1)
-	  {
-	  }
+    public class FSTOrdPulsing41PostingsFormat : PostingsFormat
+    {
+        private readonly PostingsBaseFormat _wrappedPostingsBaseFormat;
+        private readonly int _freqCutoff;
 
-	  public FSTOrdPulsing41PostingsFormat(int freqCutoff) : base("FSTOrdPulsing41")
-	  {
-		this.wrappedPostingsBaseFormat = new Lucene41PostingsBaseFormat();
-		this.freqCutoff = freqCutoff;
-	  }
+        public FSTOrdPulsing41PostingsFormat() : this(1)
+        {
+        }
 
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.codecs.FieldsConsumer fieldsConsumer(org.apache.lucene.index.SegmentWriteState state) throws java.io.IOException
-	  public override FieldsConsumer fieldsConsumer(SegmentWriteState state)
-	  {
-		PostingsWriterBase docsWriter = null;
-		PostingsWriterBase pulsingWriter = null;
+        public FSTOrdPulsing41PostingsFormat(int freqCutoff) : base("FSTOrdPulsing41")
+        {
+            _wrappedPostingsBaseFormat = new Lucene41PostingsBaseFormat();
+            _freqCutoff = freqCutoff;
+        }
 
-		bool success = false;
-		try
-		{
-		  docsWriter = wrappedPostingsBaseFormat.postingsWriterBase(state);
-		  pulsingWriter = new PulsingPostingsWriter(state, freqCutoff, docsWriter);
-		  FieldsConsumer ret = new FSTOrdTermsWriter(state, pulsingWriter);
-		  success = true;
-		  return ret;
-		}
-		finally
-		{
-		  if (!success)
-		  {
-			IOUtils.closeWhileHandlingException(docsWriter, pulsingWriter);
-		  }
-		}
-	  }
+        public override FieldsConsumer FieldsConsumer(SegmentWriteState state)
+        {
+            PostingsWriterBase docsWriter = null;
+            PostingsWriterBase pulsingWriter = null;
 
-//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.codecs.FieldsProducer fieldsProducer(org.apache.lucene.index.SegmentReadState state) throws java.io.IOException
-	  public override FieldsProducer fieldsProducer(SegmentReadState state)
-	  {
-		PostingsReaderBase docsReader = null;
-		PostingsReaderBase pulsingReader = null;
-		bool success = false;
-		try
-		{
-		  docsReader = wrappedPostingsBaseFormat.postingsReaderBase(state);
-		  pulsingReader = new PulsingPostingsReader(state, docsReader);
-		  FieldsProducer ret = new FSTOrdTermsReader(state, pulsingReader);
-		  success = true;
-		  return ret;
-		}
-		finally
-		{
-		  if (!success)
-		  {
-			IOUtils.closeWhileHandlingException(docsReader, pulsingReader);
-		  }
-		}
-	  }
-	}
+            bool success = false;
+            try
+            {
+                docsWriter = _wrappedPostingsBaseFormat.PostingsWriterBase(state);
+                pulsingWriter = new PulsingPostingsWriter(state, _freqCutoff, docsWriter);
+                FieldsConsumer ret = new FSTOrdTermsWriter(state, pulsingWriter);
+                success = true;
+                return ret;
+            }
+            finally
+            {
+                if (!success)
+                {
+                    IOUtils.CloseWhileHandlingException(docsWriter, pulsingWriter);
+                }
+            }
+        }
 
+        public override FieldsProducer FieldsProducer(SegmentReadState state)
+        {
+            PostingsReaderBase docsReader = null;
+            PostingsReaderBase pulsingReader = null;
+            bool success = false;
+            try
+            {
+                docsReader = _wrappedPostingsBaseFormat.PostingsReaderBase(state);
+                pulsingReader = new PulsingPostingsReader(state, docsReader);
+                FieldsProducer ret = new FSTOrdTermsReader(state, pulsingReader);
+                success = true;
+                return ret;
+            }
+            finally
+            {
+                if (!success)
+                {
+                    IOUtils.CloseWhileHandlingException(docsReader, pulsingReader);
+                }
+            }
+        }
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/af4d125b/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs b/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs
index f57f231..e511aaf 100644
--- a/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs
+++ b/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs
@@ -2,8 +2,9 @@
 using System.Diagnostics;
 using System.Collections;
 using System.Collections.Generic;
+using Lucene.Net.Index;
 
-namespace org.apache.lucene.codecs.memory
+namespace Lucene.Net.Codecs.Memory
 {
 
 	/*
@@ -24,35 +25,35 @@ namespace org.apache.lucene.codecs.memory
 	 */
 
 
-	using TermsReader = org.apache.lucene.codecs.memory.FSTTermsReader.TermsReader;
-	using CorruptIndexException = org.apache.lucene.index.CorruptIndexException;
-	using DocsAndPositionsEnum = org.apache.lucene.index.DocsAndPositionsEnum;
-	using DocsEnum = org.apache.lucene.index.DocsEnum;
-	using IndexOptions = org.apache.lucene.index.FieldInfo.IndexOptions;
-	using FieldInfo = org.apache.lucene.index.FieldInfo;
-	using FieldInfos = org.apache.lucene.index.FieldInfos;
-	using IndexFileNames = org.apache.lucene.index.IndexFileNames;
-	using SegmentInfo = org.apache.lucene.index.SegmentInfo;
-	using SegmentReadState = org.apache.lucene.index.SegmentReadState;
-	using TermState = org.apache.lucene.index.TermState;
-	using Terms = org.apache.lucene.index.Terms;
-	using TermsEnum = org.apache.lucene.index.TermsEnum;
-	using ByteArrayDataInput = org.apache.lucene.store.ByteArrayDataInput;
-	using ChecksumIndexInput = org.apache.lucene.store.ChecksumIndexInput;
-	using IndexInput = org.apache.lucene.store.IndexInput;
-	using ArrayUtil = org.apache.lucene.util.ArrayUtil;
-	using Bits = org.apache.lucene.util.Bits;
-	using BytesRef = org.apache.lucene.util.BytesRef;
-	using IOUtils = org.apache.lucene.util.IOUtils;
-	using RamUsageEstimator = org.apache.lucene.util.RamUsageEstimator;
-	using ByteRunAutomaton = org.apache.lucene.util.automaton.ByteRunAutomaton;
-	using CompiledAutomaton = org.apache.lucene.util.automaton.CompiledAutomaton;
-	using InputOutput = org.apache.lucene.util.fst.BytesRefFSTEnum.InputOutput;
-	using BytesRefFSTEnum = org.apache.lucene.util.fst.BytesRefFSTEnum;
-	using FST = org.apache.lucene.util.fst.FST;
-	using Outputs = org.apache.lucene.util.fst.Outputs;
-	using PositiveIntOutputs = org.apache.lucene.util.fst.PositiveIntOutputs;
-	using Util = org.apache.lucene.util.fst.Util;
+	using TermsReader = Lucene.Net.Codecs.Memory.FSTTermsReader.TermsReader;
+	using CorruptIndexException = index.CorruptIndexException;
+	using DocsAndPositionsEnum = index.DocsAndPositionsEnum;
+	using DocsEnum = index.DocsEnum;
+	using IndexOptions = index.FieldInfo.IndexOptions;
+	using FieldInfo = index.FieldInfo;
+	using FieldInfos = index.FieldInfos;
+	using IndexFileNames = index.IndexFileNames;
+	using SegmentInfo = index.SegmentInfo;
+	using SegmentReadState = index.SegmentReadState;
+	using TermState = index.TermState;
+	using Terms = index.Terms;
+	using TermsEnum = index.TermsEnum;
+	using ByteArrayDataInput = store.ByteArrayDataInput;
+	using ChecksumIndexInput = store.ChecksumIndexInput;
+	using IndexInput = store.IndexInput;
+	using ArrayUtil = util.ArrayUtil;
+	using Bits = util.Bits;
+	using BytesRef = util.BytesRef;
+	using IOUtils = util.IOUtils;
+	using RamUsageEstimator = util.RamUsageEstimator;
+	using ByteRunAutomaton = util.automaton.ByteRunAutomaton;
+	using CompiledAutomaton = util.automaton.CompiledAutomaton;
+	using InputOutput = util.fst.BytesRefFSTEnum.InputOutput;
+	using BytesRefFSTEnum = util.fst.BytesRefFSTEnum;
+	using FST = util.fst.FST;
+	using Outputs = util.fst.Outputs;
+	using PositiveIntOutputs = util.fst.PositiveIntOutputs;
+	using Util = util.fst.Util;
 
 	/// <summary>
 	/// FST-based terms dictionary reader.
@@ -72,14 +73,14 @@ namespace org.apache.lucene.codecs.memory
 	  //static final boolean TEST = false;
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: public FSTOrdTermsReader(org.apache.lucene.index.SegmentReadState state, org.apache.lucene.codecs.PostingsReaderBase postingsReader) throws java.io.IOException
+//ORIGINAL LINE: public FSTOrdTermsReader(index.SegmentReadState state, codecs.PostingsReaderBase postingsReader) throws java.io.IOException
 	  public FSTOrdTermsReader(SegmentReadState state, PostingsReaderBase postingsReader)
 	  {
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final String termsIndexFileName = org.apache.lucene.index.IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, FSTOrdTermsWriter.TERMS_INDEX_EXTENSION);
+//ORIGINAL LINE: final String termsIndexFileName = index.IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, FSTOrdTermsWriter.TERMS_INDEX_EXTENSION);
 		string termsIndexFileName = IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, FSTOrdTermsWriter.TERMS_INDEX_EXTENSION);
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final String termsBlockFileName = org.apache.lucene.index.IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, FSTOrdTermsWriter.TERMS_BLOCK_EXTENSION);
+//ORIGINAL LINE: final String termsBlockFileName = index.IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, FSTOrdTermsWriter.TERMS_BLOCK_EXTENSION);
 		string termsBlockFileName = IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, FSTOrdTermsWriter.TERMS_BLOCK_EXTENSION);
 
 		this.postingsReader = postingsReader;
@@ -101,7 +102,7 @@ namespace org.apache.lucene.codecs.memory
 		  seekDir(blockIn);
 
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.index.FieldInfos fieldInfos = state.fieldInfos;
+//ORIGINAL LINE: final index.FieldInfos fieldInfos = state.fieldInfos;
 		  FieldInfos fieldInfos = state.fieldInfos;
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
 //ORIGINAL LINE: final int numFields = blockIn.readVInt();
@@ -145,13 +146,13 @@ namespace org.apache.lucene.codecs.memory
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: private int readHeader(org.apache.lucene.store.IndexInput in) throws java.io.IOException
+//ORIGINAL LINE: private int readHeader(store.IndexInput in) throws java.io.IOException
 	  private int readHeader(IndexInput @in)
 	  {
 		return CodecUtil.checkHeader(@in, FSTOrdTermsWriter.TERMS_CODEC_NAME, FSTOrdTermsWriter.TERMS_VERSION_START, FSTOrdTermsWriter.TERMS_VERSION_CURRENT);
 	  }
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: private void seekDir(org.apache.lucene.store.IndexInput in) throws java.io.IOException
+//ORIGINAL LINE: private void seekDir(store.IndexInput in) throws java.io.IOException
 	  private void seekDir(IndexInput @in)
 	  {
 		if (version >= FSTOrdTermsWriter.TERMS_VERSION_CHECKSUM)
@@ -165,7 +166,7 @@ namespace org.apache.lucene.codecs.memory
 		@in.seek(@in.readLong());
 	  }
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: private void checkFieldSummary(org.apache.lucene.index.SegmentInfo info, org.apache.lucene.store.IndexInput indexIn, org.apache.lucene.store.IndexInput blockIn, org.apache.lucene.codecs.memory.FSTTermsReader.TermsReader field, org.apache.lucene.codecs.memory.FSTTermsReader.TermsReader previous) throws java.io.IOException
+//ORIGINAL LINE: private void checkFieldSummary(index.SegmentInfo info, store.IndexInput indexIn, store.IndexInput blockIn, Lucene.Net.Codecs.Memory.FSTTermsReader.TermsReader field, Lucene.Net.Codecs.Memory.FSTTermsReader.TermsReader previous) throws java.io.IOException
 	  private void checkFieldSummary(SegmentInfo info, IndexInput indexIn, IndexInput blockIn, TermsReader field, TermsReader previous)
 	  {
 		// #docs with field must be <= #docs
@@ -195,7 +196,7 @@ namespace org.apache.lucene.codecs.memory
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.index.Terms terms(String field) throws java.io.IOException
+//ORIGINAL LINE: @Override public index.Terms terms(String field) throws java.io.IOException
 	  public override Terms terms(string field)
 	  {
 		Debug.Assert(field != null);
@@ -240,7 +241,7 @@ namespace org.apache.lucene.codecs.memory
 		internal readonly sbyte[] metaBytesBlock;
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: org.apache.lucene.codecs.memory.FSTTermsReader.TermsReader(org.apache.lucene.index.FieldInfo fieldInfo, org.apache.lucene.store.IndexInput blockIn, long numTerms, long sumTotalTermFreq, long sumDocFreq, int docCount, int longsSize, org.apache.lucene.util.fst.FST<Long> index) throws java.io.IOException
+//ORIGINAL LINE: Lucene.Net.Codecs.Memory.FSTTermsReader.TermsReader(index.FieldInfo fieldInfo, store.IndexInput blockIn, long numTerms, long sumTotalTermFreq, long sumDocFreq, int docCount, int longsSize, util.fst.FST<Long> index) throws java.io.IOException
 		internal TermsReader(FSTOrdTermsReader outerInstance, FieldInfo fieldInfo, IndexInput blockIn, long numTerms, long sumTotalTermFreq, long sumDocFreq, int docCount, int longsSize, FST<long?> index)
 		{
 			this.outerInstance = outerInstance;
@@ -339,14 +340,14 @@ namespace org.apache.lucene.codecs.memory
 		}
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.index.TermsEnum iterator(org.apache.lucene.index.TermsEnum reuse) throws java.io.IOException
+//ORIGINAL LINE: @Override public index.TermsEnum iterator(index.TermsEnum reuse) throws java.io.IOException
 		public override TermsEnum iterator(TermsEnum reuse)
 		{
 		  return new SegmentTermsEnum(this);
 		}
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.index.TermsEnum intersect(org.apache.lucene.util.automaton.CompiledAutomaton compiled, org.apache.lucene.util.BytesRef startTerm) throws java.io.IOException
+//ORIGINAL LINE: @Override public index.TermsEnum intersect(util.automaton.CompiledAutomaton compiled, util.BytesRef startTerm) throws java.io.IOException
 		public override TermsEnum intersect(CompiledAutomaton compiled, BytesRef startTerm)
 		{
 		  return new IntersectTermsEnum(this, compiled, startTerm);
@@ -529,7 +530,7 @@ namespace org.apache.lucene.codecs.memory
 		  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.index.TermState termState() throws java.io.IOException
+//ORIGINAL LINE: @Override public index.TermState termState() throws java.io.IOException
 		  public override TermState termState()
 		  {
 			decodeMetaData();
@@ -556,7 +557,7 @@ namespace org.apache.lucene.codecs.memory
 		  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.index.DocsEnum docs(org.apache.lucene.util.Bits liveDocs, org.apache.lucene.index.DocsEnum reuse, int flags) throws java.io.IOException
+//ORIGINAL LINE: @Override public index.DocsEnum docs(util.Bits liveDocs, index.DocsEnum reuse, int flags) throws java.io.IOException
 		  public override DocsEnum docs(Bits liveDocs, DocsEnum reuse, int flags)
 		  {
 			decodeMetaData();
@@ -564,7 +565,7 @@ namespace org.apache.lucene.codecs.memory
 		  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.index.DocsAndPositionsEnum docsAndPositions(org.apache.lucene.util.Bits liveDocs, org.apache.lucene.index.DocsAndPositionsEnum reuse, int flags) throws java.io.IOException
+//ORIGINAL LINE: @Override public index.DocsAndPositionsEnum docsAndPositions(util.Bits liveDocs, index.DocsAndPositionsEnum reuse, int flags) throws java.io.IOException
 		  public override DocsAndPositionsEnum docsAndPositions(Bits liveDocs, DocsAndPositionsEnum reuse, int flags)
 		  {
 			if (!outerInstance.hasPositions())
@@ -626,7 +627,7 @@ namespace org.apache.lucene.codecs.memory
 
 		  // Update current enum according to FSTEnum
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: void updateEnum(final org.apache.lucene.util.fst.BytesRefFSTEnum.InputOutput<Long> pair) throws java.io.IOException
+//ORIGINAL LINE: void updateEnum(final util.fst.BytesRefFSTEnum.InputOutput<Long> pair) throws java.io.IOException
 //JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
 		  internal void updateEnum(InputOutput<long?> pair)
 		  {
@@ -645,7 +646,7 @@ namespace org.apache.lucene.codecs.memory
 		  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.util.BytesRef next() throws java.io.IOException
+//ORIGINAL LINE: @Override public util.BytesRef next() throws java.io.IOException
 		  public override BytesRef next()
 		  {
 			if (seekPending) // previously positioned, but termOutputs not fetched
@@ -659,7 +660,7 @@ namespace org.apache.lucene.codecs.memory
 		  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public boolean seekExact(org.apache.lucene.util.BytesRef target) throws java.io.IOException
+//ORIGINAL LINE: @Override public boolean seekExact(util.BytesRef target) throws java.io.IOException
 		  public override bool seekExact(BytesRef target)
 		  {
 			updateEnum(fstEnum.seekExact(target));
@@ -667,7 +668,7 @@ namespace org.apache.lucene.codecs.memory
 		  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public SeekStatus seekCeil(org.apache.lucene.util.BytesRef target) throws java.io.IOException
+//ORIGINAL LINE: @Override public SeekStatus seekCeil(util.BytesRef target) throws java.io.IOException
 		  public override SeekStatus seekCeil(BytesRef target)
 		  {
 			updateEnum(fstEnum.seekCeil(target));
@@ -742,7 +743,7 @@ namespace org.apache.lucene.codecs.memory
 		  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: IntersectTermsEnum(org.apache.lucene.util.automaton.CompiledAutomaton compiled, org.apache.lucene.util.BytesRef startTerm) throws java.io.IOException
+//ORIGINAL LINE: IntersectTermsEnum(util.automaton.CompiledAutomaton compiled, util.BytesRef startTerm) throws java.io.IOException
 		  internal IntersectTermsEnum(FSTOrdTermsReader.TermsReader outerInstance, CompiledAutomaton compiled, BytesRef startTerm) : base(outerInstance)
 		  {
 			//if (TEST) System.out.println("Enum init, startTerm=" + startTerm);
@@ -794,7 +795,7 @@ namespace org.apache.lucene.codecs.memory
 		  internal override void decodeStats()
 		  {
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.util.fst.FST.Arc<Long> arc = topFrame().arc;
+//ORIGINAL LINE: final util.fst.FST.Arc<Long> arc = topFrame().arc;
 			FST.Arc<long?> arc = topFrame().arc;
 			Debug.Assert(arc.nextFinalOutput == fstOutputs.NoOutput);
 			ord_Renamed = arc.output;
@@ -802,14 +803,14 @@ namespace org.apache.lucene.codecs.memory
 		  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public SeekStatus seekCeil(org.apache.lucene.util.BytesRef target) throws java.io.IOException
+//ORIGINAL LINE: @Override public SeekStatus seekCeil(util.BytesRef target) throws java.io.IOException
 		  public override SeekStatus seekCeil(BytesRef target)
 		  {
 			throw new System.NotSupportedException();
 		  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: @Override public org.apache.lucene.util.BytesRef next() throws java.io.IOException
+//ORIGINAL LINE: @Override public util.BytesRef next() throws java.io.IOException
 		  public override BytesRef next()
 		  {
 			//if (TEST) System.out.println("Enum next()");
@@ -855,7 +856,7 @@ namespace org.apache.lucene.codecs.memory
 		  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: org.apache.lucene.util.BytesRef doSeekCeil(org.apache.lucene.util.BytesRef target) throws java.io.IOException
+//ORIGINAL LINE: util.BytesRef doSeekCeil(util.BytesRef target) throws java.io.IOException
 		  internal BytesRef doSeekCeil(BytesRef target)
 		  {
 			//if (TEST) System.out.println("Enum doSeekCeil()");
@@ -1012,7 +1013,7 @@ namespace org.apache.lucene.codecs.memory
 		  internal void pushFrame(Frame frame)
 		  {
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.util.fst.FST.Arc<Long> arc = frame.arc;
+//ORIGINAL LINE: final util.fst.FST.Arc<Long> arc = frame.arc;
 			FST.Arc<long?> arc = frame.arc;
 			arc.output = fstOutputs.add(topFrame().arc.output, arc.output);
 			term_Renamed = grow(arc.label);
@@ -1031,7 +1032,7 @@ namespace org.apache.lucene.codecs.memory
 			if (level + 1 == stack.Length)
 			{
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final Frame[] temp = new Frame[org.apache.lucene.util.ArrayUtil.oversize(level+2, org.apache.lucene.util.RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
+//ORIGINAL LINE: final Frame[] temp = new Frame[util.ArrayUtil.oversize(level+2, util.RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
 			  Frame[] temp = new Frame[ArrayUtil.oversize(level + 2, RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
 			  Array.Copy(stack, 0, temp, 0, stack.Length);
 			  for (int i = stack.Length; i < temp.Length; i++)
@@ -1081,26 +1082,26 @@ namespace org.apache.lucene.codecs.memory
 	  }
 
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
-//ORIGINAL LINE: static<T> void walk(org.apache.lucene.util.fst.FST<T> fst) throws java.io.IOException
+//ORIGINAL LINE: static<T> void walk(util.fst.FST<T> fst) throws java.io.IOException
 	  internal static void walk<T>(FST<T> fst)
 	  {
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final java.util.ArrayList<org.apache.lucene.util.fst.FST.Arc<T>> queue = new java.util.ArrayList<>();
+//ORIGINAL LINE: final java.util.ArrayList<util.fst.FST.Arc<T>> queue = new java.util.ArrayList<>();
 		List<FST.Arc<T>> queue = new List<FST.Arc<T>>();
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
 //ORIGINAL LINE: final java.util.BitSet seen = new java.util.BitSet();
 		BitArray seen = new BitArray();
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.util.fst.FST.BytesReader reader = fst.getBytesReader();
+//ORIGINAL LINE: final util.fst.FST.BytesReader reader = fst.getBytesReader();
 		FST.BytesReader reader = fst.BytesReader;
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.util.fst.FST.Arc<T> startArc = fst.getFirstArc(new org.apache.lucene.util.fst.FST.Arc<T>());
+//ORIGINAL LINE: final util.fst.FST.Arc<T> startArc = fst.getFirstArc(new util.fst.FST.Arc<T>());
 		FST.Arc<T> startArc = fst.getFirstArc(new FST.Arc<T>());
 		queue.Add(startArc);
 		while (queue.Count > 0)
 		{
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
-//ORIGINAL LINE: final org.apache.lucene.util.fst.FST.Arc<T> arc = queue.remove(0);
+//ORIGINAL LINE: final util.fst.FST.Arc<T> arc = queue.remove(0);
 		  FST.Arc<T> arc = queue.Remove(0);
 //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
 //ORIGINAL LINE: final long node = arc.target;