lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [09/62] [abbrv] [partial] lucenenet git commit: Renamed Lucene.Net.Core folder Lucene.Net because the dotnet.exe pack command doesn't allow creating a NuGet package with a different name than its folder. Working around it with the script was much more co
Date Tue, 04 Apr 2017 17:19:15 GMT
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Index/MultiTermsEnum.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/MultiTermsEnum.cs b/src/Lucene.Net.Core/Index/MultiTermsEnum.cs
deleted file mode 100644
index 813897a..0000000
--- a/src/Lucene.Net.Core/Index/MultiTermsEnum.cs
+++ /dev/null
@@ -1,694 +0,0 @@
-using Lucene.Net.Support;
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Diagnostics.CodeAnalysis;
-
-namespace Lucene.Net.Index
-{
-    /*
-     * 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 IBits = Lucene.Net.Util.IBits;
-    using BytesRef = Lucene.Net.Util.BytesRef;
-
-    /// <summary>
-    /// Exposes <seealso cref="TermsEnum"/> API, merged from <seealso cref="TermsEnum"/> API of sub-segments.
-    /// this does a merge sort, by term text, of the sub-readers.
-    ///
-    /// @lucene.experimental
-    /// </summary>
-#if FEATURE_SERIALIZABLE
-    [Serializable]
-#endif
-    public sealed class MultiTermsEnum : TermsEnum
-    {
-        private readonly TermMergeQueue queue;
-        private readonly TermsEnumWithSlice[] subs; // all of our subs (one per sub-reader)
-        private readonly TermsEnumWithSlice[] currentSubs; // current subs that have at least one term for this field
-        private readonly TermsEnumWithSlice[] top;
-        private readonly MultiDocsEnum.EnumWithSlice[] subDocs;
-        private readonly MultiDocsAndPositionsEnum.EnumWithSlice[] subDocsAndPositions;
-
-        private BytesRef lastSeek;
-        private bool lastSeekExact;
-        private readonly BytesRef lastSeekScratch = new BytesRef();
-
-        private int numTop;
-        private int numSubs;
-        private BytesRef current;
-        private IComparer<BytesRef> termComp;
-
-#if FEATURE_SERIALIZABLE
-        [Serializable]
-#endif
-        public class TermsEnumIndex
-        {
-            public static readonly TermsEnumIndex[] EMPTY_ARRAY = new TermsEnumIndex[0];
-            internal int SubIndex { get; private set; }
-            internal TermsEnum TermsEnum { get; private set; }
-
-            public TermsEnumIndex(TermsEnum termsEnum, int subIndex)
-            {
-                this.TermsEnum = termsEnum;
-                this.SubIndex = subIndex;
-            }
-        }
-
-        /// <summary>
-        /// Returns how many sub-reader slices contain the current </summary>
-        ///  term.  <seealso cref= #getMatchArray  </seealso>
-        public int MatchCount
-        {
-            get
-            {
-                return numTop;
-            }
-        }
-
-        /// <summary>
-        /// Returns sub-reader slices positioned to the current term. </summary>
-        [WritableArray]
-        [SuppressMessage("Microsoft.Performance", "CA1819", Justification = "Lucene's design requires some writable array properties")]
-        public TermsEnumWithSlice[] MatchArray
-        {
-            get { return top; }
-        }
-
-        /// <summary>
-        /// Sole constructor. </summary>
-        ///  <param name="slices"> Which sub-reader slices we should
-        ///  merge.  </param>
-        public MultiTermsEnum(ReaderSlice[] slices)
-        {
-            queue = new TermMergeQueue(slices.Length);
-            top = new TermsEnumWithSlice[slices.Length];
-            subs = new TermsEnumWithSlice[slices.Length];
-            subDocs = new MultiDocsEnum.EnumWithSlice[slices.Length];
-            subDocsAndPositions = new MultiDocsAndPositionsEnum.EnumWithSlice[slices.Length];
-            for (int i = 0; i < slices.Length; i++)
-            {
-                subs[i] = new TermsEnumWithSlice(i, slices[i]);
-                subDocs[i] = new MultiDocsEnum.EnumWithSlice();
-                subDocs[i].Slice = slices[i];
-                subDocsAndPositions[i] = new MultiDocsAndPositionsEnum.EnumWithSlice();
-                subDocsAndPositions[i].Slice = slices[i];
-            }
-            currentSubs = new TermsEnumWithSlice[slices.Length];
-        }
-
-        public override BytesRef Term
-        {
-            get { return current; }
-        }
-
-        public override IComparer<BytesRef> Comparer
-        {
-            get
-            {
-                return termComp;
-            }
-        }
-
-        /// <summary>
-        /// The terms array must be newly created TermsEnum, ie
-        ///  <seealso cref="TermsEnum#next"/> has not yet been called.
-        /// </summary>
-        public TermsEnum Reset(TermsEnumIndex[] termsEnumsIndex)
-        {
-            Debug.Assert(termsEnumsIndex.Length <= top.Length);
-            numSubs = 0;
-            numTop = 0;
-            termComp = null;
-            queue.Clear();
-            for (int i = 0; i < termsEnumsIndex.Length; i++)
-            {
-                TermsEnumIndex termsEnumIndex = termsEnumsIndex[i];
-                Debug.Assert(termsEnumIndex != null);
-
-                // init our term comp
-                if (termComp == null)
-                {
-                    queue.termComp = termComp = termsEnumIndex.TermsEnum.Comparer;
-                }
-                else
-                {
-                    // We cannot merge sub-readers that have
-                    // different TermComps
-                    IComparer<BytesRef> subTermComp = termsEnumIndex.TermsEnum.Comparer;
-                    if (subTermComp != null && !subTermComp.Equals(termComp))
-                    {
-                        throw new InvalidOperationException("sub-readers have different BytesRef.Comparers: " + subTermComp + " vs " + termComp + "; cannot merge");
-                    }
-                }
-
-                BytesRef term = termsEnumIndex.TermsEnum.Next();
-                if (term != null)
-                {
-                    TermsEnumWithSlice entry = subs[termsEnumIndex.SubIndex];
-                    entry.Reset(termsEnumIndex.TermsEnum, term);
-                    queue.Add(entry);
-                    currentSubs[numSubs++] = entry;
-                }
-                else
-                {
-                    // field has no terms
-                }
-            }
-
-            if (queue.Count == 0)
-            {
-                return TermsEnum.EMPTY;
-            }
-            else
-            {
-                return this;
-            }
-        }
-
-        public override bool SeekExact(BytesRef term)
-        {
-            queue.Clear();
-            numTop = 0;
-
-            bool seekOpt = false;
-            if (lastSeek != null && termComp.Compare(lastSeek, term) <= 0)
-            {
-                seekOpt = true;
-            }
-
-            lastSeek = null;
-            lastSeekExact = true;
-
-            for (int i = 0; i < numSubs; i++)
-            {
-                bool status;
-                // LUCENE-2130: if we had just seek'd already, prior
-                // to this seek, and the new seek term is after the
-                // previous one, don't try to re-seek this sub if its
-                // current term is already beyond this new seek term.
-                // Doing so is a waste because this sub will simply
-                // seek to the same spot.
-                if (seekOpt)
-                {
-                    BytesRef curTerm = currentSubs[i].Current;
-                    if (curTerm != null)
-                    {
-                        int cmp = termComp.Compare(term, curTerm);
-                        if (cmp == 0)
-                        {
-                            status = true;
-                        }
-                        else if (cmp < 0)
-                        {
-                            status = false;
-                        }
-                        else
-                        {
-                            status = currentSubs[i].Terms.SeekExact(term);
-                        }
-                    }
-                    else
-                    {
-                        status = false;
-                    }
-                }
-                else
-                {
-                    status = currentSubs[i].Terms.SeekExact(term);
-                }
-
-                if (status)
-                {
-                    top[numTop++] = currentSubs[i];
-                    current = currentSubs[i].Current = currentSubs[i].Terms.Term;
-                    Debug.Assert(term.Equals(currentSubs[i].Current));
-                }
-            }
-
-            // if at least one sub had exact match to the requested
-            // term then we found match
-            return numTop > 0;
-        }
-
-        public override SeekStatus SeekCeil(BytesRef term)
-        {
-            queue.Clear();
-            numTop = 0;
-            lastSeekExact = false;
-
-            bool seekOpt = false;
-            if (lastSeek != null && termComp.Compare(lastSeek, term) <= 0)
-            {
-                seekOpt = true;
-            }
-
-            lastSeekScratch.CopyBytes(term);
-            lastSeek = lastSeekScratch;
-
-            for (int i = 0; i < numSubs; i++)
-            {
-                SeekStatus status;
-                // LUCENE-2130: if we had just seek'd already, prior
-                // to this seek, and the new seek term is after the
-                // previous one, don't try to re-seek this sub if its
-                // current term is already beyond this new seek term.
-                // Doing so is a waste because this sub will simply
-                // seek to the same spot.
-                if (seekOpt)
-                {
-                    BytesRef curTerm = currentSubs[i].Current;
-                    if (curTerm != null)
-                    {
-                        int cmp = termComp.Compare(term, curTerm);
-                        if (cmp == 0)
-                        {
-                            status = SeekStatus.FOUND;
-                        }
-                        else if (cmp < 0)
-                        {
-                            status = SeekStatus.NOT_FOUND;
-                        }
-                        else
-                        {
-                            status = currentSubs[i].Terms.SeekCeil(term);
-                        }
-                    }
-                    else
-                    {
-                        status = SeekStatus.END;
-                    }
-                }
-                else
-                {
-                    status = currentSubs[i].Terms.SeekCeil(term);
-                }
-
-                if (status == SeekStatus.FOUND)
-                {
-                    top[numTop++] = currentSubs[i];
-                    current = currentSubs[i].Current = currentSubs[i].Terms.Term;
-                }
-                else
-                {
-                    if (status == SeekStatus.NOT_FOUND)
-                    {
-                        currentSubs[i].Current = currentSubs[i].Terms.Term;
-                        Debug.Assert(currentSubs[i].Current != null);
-                        queue.Add(currentSubs[i]);
-                    }
-                    else
-                    {
-                        // enum exhausted
-                        currentSubs[i].Current = null;
-                    }
-                }
-            }
-
-            if (numTop > 0)
-            {
-                // at least one sub had exact match to the requested term
-                return SeekStatus.FOUND;
-            }
-            else if (queue.Count > 0)
-            {
-                // no sub had exact match, but at least one sub found
-                // a term after the requested term -- advance to that
-                // next term:
-                PullTop();
-                return SeekStatus.NOT_FOUND;
-            }
-            else
-            {
-                return SeekStatus.END;
-            }
-        }
-
-        public override void SeekExact(long ord)
-        {
-            throw new System.NotSupportedException();
-        }
-
-        public override long Ord
-        {
-            get { throw new System.NotSupportedException(); }
-        }
-
-        private void PullTop()
-        {
-            // extract all subs from the queue that have the same
-            // top term
-            Debug.Assert(numTop == 0);
-            while (true)
-            {
-                top[numTop++] = queue.Pop();
-                if (queue.Count == 0 || !(queue.Top).Current.BytesEquals(top[0].Current))
-                {
-                    break;
-                }
-            }
-            current = top[0].Current;
-        }
-
-        private void PushTop()
-        {
-            // call next() on each top, and put back into queue
-            for (int i = 0; i < numTop; i++)
-            {
-                top[i].Current = top[i].Terms.Next();
-                if (top[i].Current != null)
-                {
-                    queue.Add(top[i]);
-                }
-                else
-                {
-                    // no more fields in this reader
-                }
-            }
-            numTop = 0;
-        }
-
-        public override BytesRef Next()
-        {
-            if (lastSeekExact)
-            {
-                // Must SeekCeil at this point, so those subs that
-                // didn't have the term can find the following term.
-                // NOTE: we could save some CPU by only SeekCeil the
-                // subs that didn't match the last exact seek... but
-                // most impls short-circuit if you SeekCeil to term
-                // they are already on.
-                SeekStatus status = SeekCeil(current);
-                Debug.Assert(status == SeekStatus.FOUND);
-                lastSeekExact = false;
-            }
-            lastSeek = null;
-
-            // restore queue
-            PushTop();
-
-            // gather equal top fields
-            if (queue.Count > 0)
-            {
-                PullTop();
-            }
-            else
-            {
-                current = null;
-            }
-
-            return current;
-        }
-
-        public override int DocFreq
-        {
-            get
-            {
-                int sum = 0;
-                for (int i = 0; i < numTop; i++)
-                {
-                    sum += top[i].Terms.DocFreq;
-                }
-                return sum;
-            }
-        }
-
-        public override long TotalTermFreq
-        {
-            get
-            {
-                long sum = 0;
-                for (int i = 0; i < numTop; i++)
-                {
-                    long v = top[i].Terms.TotalTermFreq;
-                    if (v == -1)
-                    {
-                        return v;
-                    }
-                    sum += v;
-                }
-                return sum;
-            }
-        }
-
-        public override DocsEnum Docs(IBits liveDocs, DocsEnum reuse, DocsFlags flags)
-        {
-            MultiDocsEnum docsEnum;
-            // Can only reuse if incoming enum is also a MultiDocsEnum
-            if (reuse != null && reuse is MultiDocsEnum)
-            {
-                docsEnum = (MultiDocsEnum)reuse;
-                // ... and was previously created w/ this MultiTermsEnum:
-                if (!docsEnum.CanReuse(this))
-                {
-                    docsEnum = new MultiDocsEnum(this, subs.Length);
-                }
-            }
-            else
-            {
-                docsEnum = new MultiDocsEnum(this, subs.Length);
-            }
-
-            MultiBits multiLiveDocs;
-            if (liveDocs is MultiBits)
-            {
-                multiLiveDocs = (MultiBits)liveDocs;
-            }
-            else
-            {
-                multiLiveDocs = null;
-            }
-
-            int upto = 0;
-
-            for (int i = 0; i < numTop; i++)
-            {
-                TermsEnumWithSlice entry = top[i];
-
-                IBits b;
-
-                if (multiLiveDocs != null)
-                {
-                    // optimize for common case: requested skip docs is a
-                    // congruent sub-slice of MultiBits: in this case, we
-                    // just pull the liveDocs from the sub reader, rather
-                    // than making the inefficient
-                    // Slice(Multi(sub-readers)):
-                    MultiBits.SubResult sub = multiLiveDocs.GetMatchingSub(entry.SubSlice);
-                    if (sub.Matches)
-                    {
-                        b = sub.Result;
-                    }
-                    else
-                    {
-                        // custom case: requested skip docs is foreign:
-                        // must slice it on every access
-                        b = new BitsSlice(liveDocs, entry.SubSlice);
-                    }
-                }
-                else if (liveDocs != null)
-                {
-                    b = new BitsSlice(liveDocs, entry.SubSlice);
-                }
-                else
-                {
-                    // no deletions
-                    b = null;
-                }
-
-                Debug.Assert(entry.Index < docsEnum.subDocsEnum.Length, entry.Index + " vs " + docsEnum.subDocsEnum.Length + "; " + subs.Length);
-                DocsEnum subDocsEnum = entry.Terms.Docs(b, docsEnum.subDocsEnum[entry.Index], flags);
-                if (subDocsEnum != null)
-                {
-                    docsEnum.subDocsEnum[entry.Index] = subDocsEnum;
-                    subDocs[upto].DocsEnum = subDocsEnum;
-                    subDocs[upto].Slice = entry.SubSlice;
-                    upto++;
-                }
-                else
-                {
-                    // should this be an error?
-                    Debug.Assert(false, "One of our subs cannot provide a docsenum");
-                }
-            }
-
-            if (upto == 0)
-            {
-                return null;
-            }
-            else
-            {
-                return docsEnum.Reset(subDocs, upto);
-            }
-        }
-
-        public override DocsAndPositionsEnum DocsAndPositions(IBits liveDocs, DocsAndPositionsEnum reuse, DocsAndPositionsFlags flags)
-        {
-            MultiDocsAndPositionsEnum docsAndPositionsEnum;
-            // Can only reuse if incoming enum is also a MultiDocsAndPositionsEnum
-            if (reuse != null && reuse is MultiDocsAndPositionsEnum)
-            {
-                docsAndPositionsEnum = (MultiDocsAndPositionsEnum)reuse;
-                // ... and was previously created w/ this MultiTermsEnum:
-                if (!docsAndPositionsEnum.CanReuse(this))
-                {
-                    docsAndPositionsEnum = new MultiDocsAndPositionsEnum(this, subs.Length);
-                }
-            }
-            else
-            {
-                docsAndPositionsEnum = new MultiDocsAndPositionsEnum(this, subs.Length);
-            }
-
-            MultiBits multiLiveDocs;
-            if (liveDocs is MultiBits)
-            {
-                multiLiveDocs = (MultiBits)liveDocs;
-            }
-            else
-            {
-                multiLiveDocs = null;
-            }
-
-            int upto = 0;
-
-            for (int i = 0; i < numTop; i++)
-            {
-                TermsEnumWithSlice entry = top[i];
-
-                IBits b;
-
-                if (multiLiveDocs != null)
-                {
-                    // Optimize for common case: requested skip docs is a
-                    // congruent sub-slice of MultiBits: in this case, we
-                    // just pull the liveDocs from the sub reader, rather
-                    // than making the inefficient
-                    // Slice(Multi(sub-readers)):
-                    MultiBits.SubResult sub = multiLiveDocs.GetMatchingSub(top[i].SubSlice);
-                    if (sub.Matches)
-                    {
-                        b = sub.Result;
-                    }
-                    else
-                    {
-                        // custom case: requested skip docs is foreign:
-                        // must slice it on every access (very
-                        // inefficient)
-                        b = new BitsSlice(liveDocs, top[i].SubSlice);
-                    }
-                }
-                else if (liveDocs != null)
-                {
-                    b = new BitsSlice(liveDocs, top[i].SubSlice);
-                }
-                else
-                {
-                    // no deletions
-                    b = null;
-                }
-
-                Debug.Assert(entry.Index < docsAndPositionsEnum.subDocsAndPositionsEnum.Length, entry.Index + " vs " + docsAndPositionsEnum.subDocsAndPositionsEnum.Length + "; " + subs.Length);
-                DocsAndPositionsEnum subPostings = entry.Terms.DocsAndPositions(b, docsAndPositionsEnum.subDocsAndPositionsEnum[entry.Index], flags);
-
-                if (subPostings != null)
-                {
-                    docsAndPositionsEnum.subDocsAndPositionsEnum[entry.Index] = subPostings;
-                    subDocsAndPositions[upto].DocsAndPositionsEnum = subPostings;
-                    subDocsAndPositions[upto].Slice = entry.SubSlice;
-                    upto++;
-                }
-                else
-                {
-                    if (entry.Terms.Docs(b, null, DocsFlags.NONE) != null)
-                    {
-                        // At least one of our subs does not store
-                        // offsets or positions -- we can't correctly
-                        // produce a MultiDocsAndPositions enum
-                        return null;
-                    }
-                }
-            }
-
-            if (upto == 0)
-            {
-                return null;
-            }
-            else
-            {
-                return docsAndPositionsEnum.Reset(subDocsAndPositions, upto);
-            }
-        }
-
-#if FEATURE_SERIALIZABLE
-        [Serializable]
-#endif
-        public sealed class TermsEnumWithSlice
-        {
-            internal ReaderSlice SubSlice { get; private set; }
-            internal TermsEnum Terms { get; set; }
-            public BytesRef Current { get; set; }
-            internal int Index { get; private set; }
-
-            public TermsEnumWithSlice(int index, ReaderSlice subSlice)
-            {
-                this.SubSlice = subSlice;
-                this.Index = index;
-                Debug.Assert(subSlice.Length >= 0, "length=" + subSlice.Length);
-            }
-
-            public void Reset(TermsEnum terms, BytesRef term)
-            {
-                this.Terms = terms;
-                Current = term;
-            }
-
-            public override string ToString()
-            {
-                return SubSlice.ToString() + ":" + Terms;
-            }
-        }
-
-        private sealed class TermMergeQueue : Util.PriorityQueue<TermsEnumWithSlice>
-        {
-            internal IComparer<BytesRef> termComp;
-
-            internal TermMergeQueue(int size)
-                : base(size)
-            {
-            }
-
-            protected internal override bool LessThan(TermsEnumWithSlice termsA, TermsEnumWithSlice termsB)
-            {
-                int cmp = termComp.Compare(termsA.Current, termsB.Current);
-                if (cmp != 0)
-                {
-                    return cmp < 0;
-                }
-                else
-                {
-                    return termsA.SubSlice.Start < termsB.SubSlice.Start;
-                }
-            }
-        }
-
-        public override string ToString()
-        {
-            return "MultiTermsEnum(" + Arrays.ToString(subs) + ")";
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Index/NoDeletionPolicy.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/NoDeletionPolicy.cs b/src/Lucene.Net.Core/Index/NoDeletionPolicy.cs
deleted file mode 100644
index e36a523..0000000
--- a/src/Lucene.Net.Core/Index/NoDeletionPolicy.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace Lucene.Net.Index
-{
-    /*
-     * 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.
-     */
-
-    /// <summary>
-    /// An <seealso cref="IndexDeletionPolicy"/> which keeps all index commits around, never
-    /// deleting them. this class is a singleton and can be accessed by referencing
-    /// <seealso cref="#INSTANCE"/>.
-    /// </summary>
-#if FEATURE_SERIALIZABLE
-    [Serializable]
-#endif
-    public sealed class NoDeletionPolicy : IndexDeletionPolicy
-    {
-        /// <summary>
-        /// The single instance of this class. </summary>
-        public static readonly IndexDeletionPolicy INSTANCE = new NoDeletionPolicy();
-
-        private NoDeletionPolicy()
-        {
-            // keep private to avoid instantiation
-        }
-
-        public override void OnCommit<T>(IList<T> commits)
-        {
-        }
-
-        public override void OnInit<T>(IList<T> commits)
-        {
-        }
-
-        public override object Clone()
-        {
-            return this;
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Index/NoMergePolicy.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/NoMergePolicy.cs b/src/Lucene.Net.Core/Index/NoMergePolicy.cs
deleted file mode 100644
index beb702c..0000000
--- a/src/Lucene.Net.Core/Index/NoMergePolicy.cs
+++ /dev/null
@@ -1,96 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace Lucene.Net.Index
-{
-    /*
-     * 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.
-     */
-
-    /// <summary>
-    /// A <seealso cref="MergePolicy"/> which never returns merges to execute (hence it's
-    /// name). It is also a singleton and can be accessed through
-    /// <seealso cref="NoMergePolicy#NO_COMPOUND_FILES"/> if you want to indicate the index
-    /// does not use compound files, or through <seealso cref="NoMergePolicy#COMPOUND_FILES"/>
-    /// otherwise. Use it if you want to prevent an <seealso cref="IndexWriter"/> from ever
-    /// executing merges, without going through the hassle of tweaking a merge
-    /// policy's settings to achieve that, such as changing its merge factor.
-    /// </summary>
-#if FEATURE_SERIALIZABLE
-    [Serializable]
-#endif
-    public sealed class NoMergePolicy : MergePolicy
-    {
-        /// <summary>
-        /// A singleton <seealso cref="NoMergePolicy"/> which indicates the index does not use
-        /// compound files.
-        /// </summary>
-        public static readonly MergePolicy NO_COMPOUND_FILES = new NoMergePolicy(false);
-
-        /// <summary>
-        /// A singleton <seealso cref="NoMergePolicy"/> which indicates the index uses compound
-        /// files.
-        /// </summary>
-        public static readonly MergePolicy COMPOUND_FILES = new NoMergePolicy(true);
-
-        private readonly bool useCompoundFile;
-
-        private NoMergePolicy(bool useCompoundFile)
-            : base(useCompoundFile ? 1.0 : 0.0, 0)
-        {
-            // prevent instantiation
-            this.useCompoundFile = useCompoundFile;
-        }
-
-        protected override void Dispose(bool disposing)
-        {
-        }
-
-        public override MergeSpecification FindMerges(MergeTrigger mergeTrigger, SegmentInfos segmentInfos)
-        {
-            return null;
-        }
-
-        public override MergeSpecification FindForcedMerges(SegmentInfos segmentInfos, int maxSegmentCount, IDictionary<SegmentCommitInfo, bool?> segmentsToMerge)
-        {
-            return null;
-        }
-
-        public override MergeSpecification FindForcedDeletesMerges(SegmentInfos segmentInfos)
-        {
-            return null;
-        }
-
-        public override bool UseCompoundFile(SegmentInfos segments, SegmentCommitInfo newSegment)
-        {
-            return useCompoundFile;
-        }
-
-        public override void SetIndexWriter(IndexWriter writer)
-        {
-        }
-
-        protected override long Size(SegmentCommitInfo info)
-        {
-            return long.MaxValue;
-        }
-
-        public override string ToString()
-        {
-            return "NoMergePolicy";
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Index/NoMergeScheduler.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/NoMergeScheduler.cs b/src/Lucene.Net.Core/Index/NoMergeScheduler.cs
deleted file mode 100644
index 020e8df..0000000
--- a/src/Lucene.Net.Core/Index/NoMergeScheduler.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-using System;
-
-namespace Lucene.Net.Index
-{
-    /*
-     * 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.
-     */
-
-    /// <summary>
-    /// A <see cref="MergeScheduler"/> which never executes any merges. It is also a
-    /// singleton and can be accessed through <see cref="NoMergeScheduler.INSTANCE"/>. Use
-    /// it if you want to prevent an <see cref="IndexWriter"/> from ever executing merges,
-    /// regardless of the <seealso cref="MergePolicy"/> used. Note that you can achieve the
-    /// same thing by using <seealso cref="NoMergePolicy"/>, however with
-    /// <seealso cref="NoMergeScheduler"/> you also ensure that no unnecessary code of any
-    /// <seealso cref="MergeScheduler"/> implementation is ever executed. Hence it is
-    /// recommended to use both if you want to disable merges from ever happening.
-    /// </summary>
-#if FEATURE_SERIALIZABLE
-    [Serializable]
-#endif
-    public sealed class NoMergeScheduler : MergeScheduler
-    {
-        /// <summary>
-        /// The single instance of <seealso cref="NoMergeScheduler"/> </summary>
-        public static readonly MergeScheduler INSTANCE = new NoMergeScheduler();
-
-        private NoMergeScheduler()
-        {
-            // prevent instantiation
-        }
-
-        protected override void Dispose(bool disposing)
-        {
-        }
-
-        public override void Merge(IndexWriter writer, MergeTrigger trigger, bool newMergesFound)
-        {
-        }
-
-        public override IMergeScheduler Clone()
-        {
-            return this;
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Index/NormsConsumer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/NormsConsumer.cs b/src/Lucene.Net.Core/Index/NormsConsumer.cs
deleted file mode 100644
index e0437e0..0000000
--- a/src/Lucene.Net.Core/Index/NormsConsumer.cs
+++ /dev/null
@@ -1,103 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-
-namespace Lucene.Net.Index
-{
-    /*
-     * 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 DocValuesConsumer = Lucene.Net.Codecs.DocValuesConsumer;
-    using IOUtils = Lucene.Net.Util.IOUtils;
-    using NormsFormat = Lucene.Net.Codecs.NormsFormat;
-
-    // TODO FI: norms could actually be stored as doc store
-
-    /// <summary>
-    /// Writes norms.  Each thread X field accumulates the norms
-    ///  for the doc/fields it saw, then the flush method below
-    ///  merges all of these together into a single _X.nrm file.
-    /// </summary>
-#if FEATURE_SERIALIZABLE
-    [Serializable]
-#endif
-    internal sealed class NormsConsumer : InvertedDocEndConsumer
-    {
-        internal override void Abort()
-        {
-        }
-
-        internal override void Flush(IDictionary<string, InvertedDocEndConsumerPerField> fieldsToFlush, SegmentWriteState state)
-        {
-            bool success = false;
-            DocValuesConsumer normsConsumer = null;
-            try
-            {
-                if (state.FieldInfos.HasNorms)
-                {
-                    NormsFormat normsFormat = state.SegmentInfo.Codec.NormsFormat;
-                    Debug.Assert(normsFormat != null);
-                    normsConsumer = normsFormat.NormsConsumer(state);
-
-                    foreach (FieldInfo fi in state.FieldInfos)
-                    {
-                        NormsConsumerPerField toWrite = (NormsConsumerPerField)fieldsToFlush[fi.Name];
-                        // we must check the final value of omitNorms for the fieldinfo, it could have
-                        // changed for this field since the first time we added it.
-                        if (!fi.OmitsNorms)
-                        {
-                            if (toWrite != null && !toWrite.IsEmpty)
-                            {
-                                toWrite.Flush(state, normsConsumer);
-                                Debug.Assert(fi.NormType == DocValuesType.NUMERIC);
-                            }
-                            else if (fi.IsIndexed)
-                            {
-                                Debug.Assert(fi.NormType == DocValuesType.NONE, "got " + fi.NormType + "; field=" + fi.Name);
-                            }
-                        }
-                    }
-                }
-                success = true;
-            }
-            finally
-            {
-                if (success)
-                {
-                    IOUtils.Close(normsConsumer);
-                }
-                else
-                {
-                    IOUtils.CloseWhileHandlingException(normsConsumer);
-                }
-            }
-        }
-
-        internal override void FinishDocument()
-        {
-        }
-
-        internal override void StartDocument()
-        {
-        }
-
-        internal override InvertedDocEndConsumerPerField AddField(DocInverterPerField docInverterPerField, FieldInfo fieldInfo)
-        {
-            return new NormsConsumerPerField(docInverterPerField, fieldInfo, this);
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Index/NormsConsumerPerField.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/NormsConsumerPerField.cs b/src/Lucene.Net.Core/Index/NormsConsumerPerField.cs
deleted file mode 100644
index 32c16c6..0000000
--- a/src/Lucene.Net.Core/Index/NormsConsumerPerField.cs
+++ /dev/null
@@ -1,89 +0,0 @@
-using Lucene.Net.Support;
-using System;
-
-namespace Lucene.Net.Index
-{
-    /*
-     * 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 DocValuesConsumer = Lucene.Net.Codecs.DocValuesConsumer;
-    using Similarity = Lucene.Net.Search.Similarities.Similarity;
-
-#if FEATURE_SERIALIZABLE
-    [Serializable]
-#endif
-    internal sealed class NormsConsumerPerField : InvertedDocEndConsumerPerField, IComparable<NormsConsumerPerField>
-    {
-        private readonly FieldInfo fieldInfo;
-        private readonly DocumentsWriterPerThread.DocState docState;
-        private readonly Similarity similarity;
-        private readonly FieldInvertState fieldState;
-        private NumericDocValuesWriter consumer;
-
-        public NormsConsumerPerField(DocInverterPerField docInverterPerField, FieldInfo fieldInfo, NormsConsumer parent)
-        {
-            this.fieldInfo = fieldInfo;
-            docState = docInverterPerField.docState;
-            fieldState = docInverterPerField.fieldState;
-            similarity = docState.similarity;
-        }
-
-        public int CompareTo(NormsConsumerPerField other)
-        {
-            return fieldInfo.Name.CompareToOrdinal(other.fieldInfo.Name);
-        }
-
-        internal override void Finish()
-        {
-            if (fieldInfo.IsIndexed && !fieldInfo.OmitsNorms)
-            {
-                if (consumer == null)
-                {
-                    fieldInfo.NormType = DocValuesType.NUMERIC;
-                    consumer = new NumericDocValuesWriter(fieldInfo, docState.docWriter.bytesUsed, false);
-                }
-                consumer.AddValue(docState.docID, similarity.ComputeNorm(fieldState));
-            }
-        }
-
-        internal void Flush(SegmentWriteState state, DocValuesConsumer normsWriter)
-        {
-            int docCount = state.SegmentInfo.DocCount;
-            if (consumer == null)
-            {
-                return; // null type - not omitted but not written -
-                // meaning the only docs that had
-                // norms hit exceptions (but indexed=true is set...)
-            }
-            consumer.Finish(docCount);
-            consumer.Flush(state, normsWriter);
-        }
-
-        internal bool IsEmpty
-        {
-            get
-            {
-                return consumer == null;
-            }
-        }
-
-        internal override void Abort()
-        {
-            //
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Index/NumericDocValues.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/NumericDocValues.cs b/src/Lucene.Net.Core/Index/NumericDocValues.cs
deleted file mode 100644
index 226e16e..0000000
--- a/src/Lucene.Net.Core/Index/NumericDocValues.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-using System;
-
-namespace Lucene.Net.Index
-{
-    /*
-     * 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.
-     */
-
-    /// <summary>
-    /// A per-document numeric value.
-    /// </summary>
-#if FEATURE_SERIALIZABLE
-    [Serializable]
-#endif
-    public abstract class NumericDocValues
-    {
-        /// <summary>
-        /// Sole constructor. (For invocation by subclass
-        /// constructors, typically implicit.)
-        /// </summary>
-        protected NumericDocValues()
-        {
-        }
-
-        /// <summary>
-        /// Returns the numeric value for the specified document ID. </summary>
-        /// <param name="docID"> document ID to lookup </param>
-        /// <returns> numeric value </returns>
-        public abstract long Get(int docID);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Index/NumericDocValuesFieldUpdates.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/NumericDocValuesFieldUpdates.cs b/src/Lucene.Net.Core/Index/NumericDocValuesFieldUpdates.cs
deleted file mode 100644
index 3b627d9..0000000
--- a/src/Lucene.Net.Core/Index/NumericDocValuesFieldUpdates.cs
+++ /dev/null
@@ -1,249 +0,0 @@
-using Lucene.Net.Documents;
-using System;
-using System.Diagnostics;
-
-namespace Lucene.Net.Index
-{
-    /*
-     * 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 DocIdSetIterator = Lucene.Net.Search.DocIdSetIterator;
-    using FixedBitSet = Lucene.Net.Util.FixedBitSet;
-    using InPlaceMergeSorter = Lucene.Net.Util.InPlaceMergeSorter;
-    using NumericDocValuesUpdate = Lucene.Net.Index.DocValuesUpdate.NumericDocValuesUpdate;
-    using PackedInt32s = Lucene.Net.Util.Packed.PackedInt32s;
-    using PagedGrowableWriter = Lucene.Net.Util.Packed.PagedGrowableWriter;
-    using PagedMutable = Lucene.Net.Util.Packed.PagedMutable;
-
-    /// <summary>
-    /// A <seealso cref="DocValuesFieldUpdates"/> which holds updates of documents, of a single
-    /// <seealso cref="NumericDocValuesField"/>.
-    ///
-    /// @lucene.experimental
-    /// </summary>
-#if FEATURE_SERIALIZABLE
-    [Serializable]
-#endif
-    internal class NumericDocValuesFieldUpdates : DocValuesFieldUpdates
-    {
-#if FEATURE_SERIALIZABLE
-        [Serializable]
-#endif
-        new internal sealed class Iterator : DocValuesFieldUpdates.Iterator
-        {
-            private readonly int size;
-            private readonly PagedGrowableWriter values;
-            private readonly FixedBitSet docsWithField;
-            private readonly PagedMutable docs;
-            private long idx = 0; // long so we don't overflow if size == Integer.MAX_VALUE
-            private int doc = -1;
-            private long? value = null;
-
-            internal Iterator(int size, PagedGrowableWriter values, FixedBitSet docsWithField, PagedMutable docs)
-            {
-                this.size = size;
-                this.values = values;
-                this.docsWithField = docsWithField;
-                this.docs = docs;
-            }
-
-            public override object Value
-            {
-                get { return value; }
-            }
-
-            public override int NextDoc()
-            {
-                if (idx >= size)
-                {
-                    value = null;
-                    return doc = DocIdSetIterator.NO_MORE_DOCS;
-                }
-                doc = (int)docs.Get(idx);
-                ++idx;
-                while (idx < size && docs.Get(idx) == doc)
-                {
-                    ++idx;
-                }
-                if (!docsWithField.Get((int)(idx - 1)))
-                {
-                    value = null;
-                }
-                else
-                {
-                    // idx points to the "next" element
-                    value = Convert.ToInt64(values.Get(idx - 1));
-                }
-                return doc;
-            }
-
-            public override int Doc
-            {
-                get { return doc; }
-            }
-
-            public override void Reset()
-            {
-                doc = -1;
-                value = null;
-                idx = 0;
-            }
-        }
-
-        private FixedBitSet docsWithField;
-        private PagedMutable docs;
-        private PagedGrowableWriter values;
-        private int size;
-
-        public NumericDocValuesFieldUpdates(string field, int maxDoc)
-            : base(field, DocValuesFieldUpdatesType.NUMERIC)
-        {
-            docsWithField = new FixedBitSet(64);
-            docs = new PagedMutable(1, 1024, PackedInt32s.BitsRequired(maxDoc - 1), PackedInt32s.COMPACT);
-            values = new PagedGrowableWriter(1, 1024, 1, PackedInt32s.FAST);
-            size = 0;
-        }
-
-        public override void Add(int doc, object value)
-        {
-            // TODO: if the Sorter interface changes to take long indexes, we can remove that limitation
-            if (size == int.MaxValue)
-            {
-                throw new InvalidOperationException("cannot support more than System.Int32.MaxValue doc/value entries");
-            }
-
-            long? val = (long?)value;
-            if (val == null)
-            {
-                val = NumericDocValuesUpdate.MISSING;
-            }
-
-            // grow the structures to have room for more elements
-            if (docs.Count == size)
-            {
-                docs = docs.Grow(size + 1);
-                values = values.Grow(size + 1);
-                docsWithField = FixedBitSet.EnsureCapacity(docsWithField, (int)docs.Count);
-            }
-
-            if (val != NumericDocValuesUpdate.MISSING)
-            {
-                // only mark the document as having a value in that field if the value wasn't set to null (MISSING)
-                docsWithField.Set(size);
-            }
-
-            docs.Set(size, doc);
-            values.Set(size, (long)val);
-            ++size;
-        }
-
-        public override DocValuesFieldUpdates.Iterator GetIterator()
-        {
-            PagedMutable docs = this.docs;
-            PagedGrowableWriter values = this.values;
-            FixedBitSet docsWithField = this.docsWithField;
-            new InPlaceMergeSorterAnonymousInnerClassHelper(this, docs, values, docsWithField).Sort(0, size);
-
-            return new Iterator(size, values, docsWithField, docs);
-        }
-
-#if FEATURE_SERIALIZABLE
-        [Serializable]
-#endif
-        private class InPlaceMergeSorterAnonymousInnerClassHelper : InPlaceMergeSorter
-        {
-            private readonly NumericDocValuesFieldUpdates outerInstance;
-
-            private PagedMutable docs;
-            private PagedGrowableWriter values;
-            private FixedBitSet docsWithField;
-
-            public InPlaceMergeSorterAnonymousInnerClassHelper(NumericDocValuesFieldUpdates outerInstance, PagedMutable docs, PagedGrowableWriter values, FixedBitSet docsWithField)
-            {
-                this.outerInstance = outerInstance;
-                this.docs = docs;
-                this.values = values;
-                this.docsWithField = docsWithField;
-            }
-
-            protected override void Swap(int i, int j)
-            {
-                long tmpDoc = docs.Get(j);
-                docs.Set(j, docs.Get(i));
-                docs.Set(i, tmpDoc);
-
-                long tmpVal = values.Get(j);
-                values.Set(j, values.Get(i));
-                values.Set(i, tmpVal);
-
-                bool tmpBool = docsWithField.Get(j);
-                if (docsWithField.Get(i))
-                {
-                    docsWithField.Set(j);
-                }
-                else
-                {
-                    docsWithField.Clear(j);
-                }
-                if (tmpBool)
-                {
-                    docsWithField.Set(i);
-                }
-                else
-                {
-                    docsWithField.Clear(i);
-                }
-            }
-
-            protected override int Compare(int i, int j)
-            {
-                int x = (int)docs.Get(i);
-                int y = (int)docs.Get(j);
-                return (x < y) ? -1 : ((x == y) ? 0 : 1);
-            }
-        }
-
-        public override void Merge(DocValuesFieldUpdates other)
-        {
-            Debug.Assert(other is NumericDocValuesFieldUpdates);
-            NumericDocValuesFieldUpdates otherUpdates = (NumericDocValuesFieldUpdates)other;
-            if (size + otherUpdates.size > int.MaxValue)
-            {
-                throw new InvalidOperationException("cannot support more than System.Int32.MaxValue doc/value entries; size=" + size + " other.size=" + otherUpdates.size);
-            }
-            docs = docs.Grow(size + otherUpdates.size);
-            values = values.Grow(size + otherUpdates.size);
-            docsWithField = FixedBitSet.EnsureCapacity(docsWithField, (int)docs.Count);
-            for (int i = 0; i < otherUpdates.size; i++)
-            {
-                int doc = (int)otherUpdates.docs.Get(i);
-                if (otherUpdates.docsWithField.Get(i))
-                {
-                    docsWithField.Set(size);
-                }
-                docs.Set(size, doc);
-                values.Set(size, otherUpdates.values.Get(i));
-                ++size;
-            }
-        }
-
-        public override bool Any()
-        {
-            return size > 0;
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Index/NumericDocValuesWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/NumericDocValuesWriter.cs b/src/Lucene.Net.Core/Index/NumericDocValuesWriter.cs
deleted file mode 100644
index fdfbccc..0000000
--- a/src/Lucene.Net.Core/Index/NumericDocValuesWriter.cs
+++ /dev/null
@@ -1,229 +0,0 @@
-using Lucene.Net.Util.Packed;
-using System;
-using System.Collections.Generic;
-
-namespace Lucene.Net.Index
-{
-    /*
-     * 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 AppendingDeltaPackedInt64Buffer = Lucene.Net.Util.Packed.AppendingDeltaPackedInt64Buffer;
-    using Counter = Lucene.Net.Util.Counter;
-    using DocValuesConsumer = Lucene.Net.Codecs.DocValuesConsumer;
-    using FixedBitSet = Lucene.Net.Util.FixedBitSet;
-    using PackedInt32s = Lucene.Net.Util.Packed.PackedInt32s;
-    using RamUsageEstimator = Lucene.Net.Util.RamUsageEstimator;
-
-    /// <summary>
-    /// Buffers up pending long per doc, then flushes when
-    ///  segment flushes.
-    /// </summary>
-#if FEATURE_SERIALIZABLE
-    [Serializable]
-#endif
-    internal class NumericDocValuesWriter : DocValuesWriter
-    {
-        private const long MISSING = 0L;
-
-        private AppendingDeltaPackedInt64Buffer pending;
-        private readonly Counter iwBytesUsed;
-        private long bytesUsed;
-        private FixedBitSet docsWithField;
-        private readonly FieldInfo fieldInfo;
-
-        public NumericDocValuesWriter(FieldInfo fieldInfo, Counter iwBytesUsed, bool trackDocsWithField)
-        {
-            pending = new AppendingDeltaPackedInt64Buffer(PackedInt32s.COMPACT);
-            docsWithField = trackDocsWithField ? new FixedBitSet(64) : null;
-            bytesUsed = pending.RamBytesUsed() + DocsWithFieldBytesUsed();
-            this.fieldInfo = fieldInfo;
-            this.iwBytesUsed = iwBytesUsed;
-            iwBytesUsed.AddAndGet(bytesUsed);
-        }
-
-        public virtual void AddValue(int docID, long value)
-        {
-            if (docID < pending.Count)
-            {
-                throw new System.ArgumentException("DocValuesField \"" + fieldInfo.Name + "\" appears more than once in this document (only one value is allowed per field)");
-            }
-
-            // Fill in any holes:
-            for (int i = (int)pending.Count; i < docID; ++i)
-            {
-                pending.Add(MISSING);
-            }
-
-            pending.Add(value);
-            if (docsWithField != null)
-            {
-                docsWithField = FixedBitSet.EnsureCapacity(docsWithField, docID);
-                docsWithField.Set(docID);
-            }
-
-            UpdateBytesUsed();
-        }
-
-        private long DocsWithFieldBytesUsed()
-        {
-            // size of the long[] + some overhead
-            return docsWithField == null ? 0 : RamUsageEstimator.SizeOf(docsWithField.Bits) + 64;
-        }
-
-        private void UpdateBytesUsed()
-        {
-            long newBytesUsed = pending.RamBytesUsed() + DocsWithFieldBytesUsed();
-            iwBytesUsed.AddAndGet(newBytesUsed - bytesUsed);
-            bytesUsed = newBytesUsed;
-        }
-
-        public override void Finish(int maxDoc)
-        {
-        }
-
-        public override void Flush(SegmentWriteState state, DocValuesConsumer dvConsumer)
-        {
-            int maxDoc = state.SegmentInfo.DocCount;
-
-            dvConsumer.AddNumericField(fieldInfo, GetNumericIterator(maxDoc));
-        }
-
-        private IEnumerable<long?> GetNumericIterator(int maxDoc)
-        {
-            // LUCENENET specific: using yield return instead of custom iterator type. Much less code.
-            AbstractAppendingInt64Buffer.Iterator iter = pending.GetIterator();
-            int size = (int)pending.Count;
-            int upto = 0;
-
-            while (upto < maxDoc)
-            {
-                long? value;
-                if (upto < size)
-                {
-                    var v = iter.Next();
-                    if (docsWithField == null || docsWithField.Get(upto))
-                    {
-                        value = v;
-                    }
-                    else
-                    {
-                        value = null;
-                    }
-                }
-                else
-                {
-                    value = docsWithField != null ? (long?) null : MISSING;
-                }
-                upto++;
-                // TODO: make reusable Number
-                yield return value;
-            }
-        }
-
-        /*
-	  private class IterableAnonymousInnerClassHelper : IEnumerable<Number>
-	  {
-		  private readonly NumericDocValuesWriter OuterInstance;
-
-		  private int MaxDoc;
-
-		  public IterableAnonymousInnerClassHelper(NumericDocValuesWriter outerInstance, int maxDoc)
-		  {
-			  this.OuterInstance = outerInstance;
-			  this.MaxDoc = maxDoc;
-		  }
-
-		  public virtual IEnumerator<Number> GetEnumerator()
-		  {
-			return new NumericIterator(OuterInstance, MaxDoc);
-		  }
-	  }*/
-
-        public override void Abort()
-        {
-        }
-
-        /*
-	  // iterates over the values we have in ram
-	  private class NumericIterator : IEnumerator<Number>
-	  {
-		  internal bool InstanceFieldsInitialized = false;
-
-		  internal virtual void InitializeInstanceFields()
-		  {
-			  Iter = OuterInstance.Pending.Iterator();
-			  Size = (int)OuterInstance.Pending.Size();
-		  }
-
-		  private readonly NumericDocValuesWriter OuterInstance;
-
-		internal AppendingDeltaPackedLongBuffer.Iterator Iter;
-		internal int Size;
-		internal readonly int MaxDoc;
-		internal int Upto;
-
-		internal NumericIterator(NumericDocValuesWriter outerInstance, int maxDoc)
-		{
-			this.OuterInstance = outerInstance;
-
-			if (!InstanceFieldsInitialized)
-			{
-				InitializeInstanceFields();
-				InstanceFieldsInitialized = true;
-			}
-		  this.MaxDoc = maxDoc;
-		}
-
-		public override bool HasNext()
-		{
-		  return Upto < MaxDoc;
-		}
-
-		public override Number Next()
-		{
-		  if (!HasNext())
-		  {
-			throw new NoSuchElementException();
-		  }
-		  long? value;
-		  if (Upto < Size)
-		  {
-			long v = Iter.next();
-            if (OuterInstance.DocsWithField == null || OuterInstance.DocsWithField.Get(Upto))
-			{
-			  value = v;
-			}
-			else
-			{
-			  value = null;
-			}
-		  }
-		  else
-		  {
-              value = OuterInstance.DocsWithField != null ? null : MISSING;
-		  }
-		  Upto++;
-		  return value;
-		}
-
-		public override void Remove()
-		{
-		  throw new System.NotSupportedException();
-		}
-	  }*/
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Index/OrdTermState.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/OrdTermState.cs b/src/Lucene.Net.Core/Index/OrdTermState.cs
deleted file mode 100644
index 7a9a2ed..0000000
--- a/src/Lucene.Net.Core/Index/OrdTermState.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-using System;
-using System.Diagnostics;
-
-namespace Lucene.Net.Index
-{
-    /*
-     * 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.
-     */
-
-    /// <summary>
-    /// An ordinal based <seealso cref="TermState"/>
-    ///
-    /// @lucene.experimental
-    /// </summary>
-#if FEATURE_SERIALIZABLE
-    [Serializable]
-#endif
-    public class OrdTermState : TermState
-    {
-        /// <summary>
-        /// Term ordinal, i.e. it's position in the full list of
-        ///  sorted terms.
-        /// </summary>
-        public long Ord { get; set; }
-
-        /// <summary>
-        /// Sole constructor. </summary>
-        public OrdTermState()
-        {
-        }
-
-        public override void CopyFrom(TermState other)
-        {
-            Debug.Assert(other is OrdTermState, "can not copy from " + other.GetType().Name);
-            this.Ord = ((OrdTermState)other).Ord;
-        }
-
-        public override string ToString()
-        {
-            return "OrdTermState ord=" + Ord;
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Index/ParallelAtomicReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/ParallelAtomicReader.cs b/src/Lucene.Net.Core/Index/ParallelAtomicReader.cs
deleted file mode 100644
index 95ee25e..0000000
--- a/src/Lucene.Net.Core/Index/ParallelAtomicReader.cs
+++ /dev/null
@@ -1,403 +0,0 @@
-using Lucene.Net.Support;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Text;
-
-namespace Lucene.Net.Index
-{
-    /*
-     * 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 IBits = Lucene.Net.Util.IBits;
-
-    /// <summary>
-    /// An <seealso cref="AtomicReader"/> which reads multiple, parallel indexes.  Each index
-    /// added must have the same number of documents, but typically each contains
-    /// different fields. Deletions are taken from the first reader.
-    /// Each document contains the union of the fields of all documents
-    /// with the same document number.  When searching, matches for a
-    /// query term are from the first index added that has the field.
-    ///
-    /// <p>this is useful, e.g., with collections that have large fields which
-    /// change rarely and small fields that change more frequently.  The smaller
-    /// fields may be re-indexed in a new index and both indexes may be searched
-    /// together.
-    ///
-    /// <p><strong>Warning:</strong> It is up to you to make sure all indexes
-    /// are created and modified the same way. For example, if you add
-    /// documents to one index, you need to add the same documents in the
-    /// same order to the other indexes. <em>Failure to do so will result in
-    /// undefined behavior</em>.
-    /// </summary>
-#if FEATURE_SERIALIZABLE
-    [Serializable]
-#endif
-    public class ParallelAtomicReader : AtomicReader
-    {
-        private void InitializeInstanceFields()
-        {
-            fields = new ParallelFields(this);
-        }
-
-        private readonly FieldInfos fieldInfos;
-        private ParallelFields fields;
-        private readonly AtomicReader[] parallelReaders, storedFieldsReaders;
-        private readonly ISet<AtomicReader> completeReaderSet = new IdentityHashSet<AtomicReader>();
-        private readonly bool closeSubReaders;
-        private readonly int maxDoc, numDocs;
-        private readonly bool hasDeletions;
-
-        // LUCENENET specific: Use StringComparer.Ordinal to get the same ordering as Java
-        private readonly IDictionary<string, AtomicReader> fieldToReader = new SortedDictionary<string, AtomicReader>(StringComparer.Ordinal);
-        private readonly IDictionary<string, AtomicReader> tvFieldToReader = new SortedDictionary<string, AtomicReader>(StringComparer.Ordinal);
-
-        /// <summary>
-        /// Create a ParallelAtomicReader based on the provided
-        ///  readers; auto-closes the given readers on <seealso cref="#close()"/>.
-        /// </summary>
-        public ParallelAtomicReader(params AtomicReader[] readers)
-            : this(true, readers)
-        {
-        }
-
-        /// <summary>
-        /// Create a ParallelAtomicReader based on the provided
-        ///  readers.
-        /// </summary>
-        public ParallelAtomicReader(bool closeSubReaders, params AtomicReader[] readers)
-            : this(closeSubReaders, readers, readers)
-        {
-        }
-
-        /// <summary>
-        /// Expert: create a ParallelAtomicReader based on the provided
-        ///  readers and storedFieldReaders; when a document is
-        ///  loaded, only storedFieldsReaders will be used.
-        /// </summary>
-        public ParallelAtomicReader(bool closeSubReaders, AtomicReader[] readers, AtomicReader[] storedFieldsReaders)
-        {
-            InitializeInstanceFields();
-            this.closeSubReaders = closeSubReaders;
-            if (readers.Length == 0 && storedFieldsReaders.Length > 0)
-            {
-                throw new System.ArgumentException("There must be at least one main reader if storedFieldsReaders are used.");
-            }
-            this.parallelReaders = (AtomicReader[])readers.Clone();
-            this.storedFieldsReaders = (AtomicReader[])storedFieldsReaders.Clone();
-            if (parallelReaders.Length > 0)
-            {
-                AtomicReader first = parallelReaders[0];
-                this.maxDoc = first.MaxDoc;
-                this.numDocs = first.NumDocs;
-                this.hasDeletions = first.HasDeletions;
-            }
-            else
-            {
-                this.maxDoc = this.numDocs = 0;
-                this.hasDeletions = false;
-            }
-            Collections.AddAll(completeReaderSet, this.parallelReaders);
-            Collections.AddAll(completeReaderSet, this.storedFieldsReaders);
-
-            // check compatibility:
-            foreach (AtomicReader reader in completeReaderSet)
-            {
-                if (reader.MaxDoc != maxDoc)
-                {
-                    throw new System.ArgumentException("All readers must have same MaxDoc: " + maxDoc + "!=" + reader.MaxDoc);
-                }
-            }
-
-            // TODO: make this read-only in a cleaner way?
-            FieldInfos.Builder builder = new FieldInfos.Builder();
-            // build FieldInfos and fieldToReader map:
-            foreach (AtomicReader reader in this.parallelReaders)
-            {
-                FieldInfos readerFieldInfos = reader.FieldInfos;
-                foreach (FieldInfo fieldInfo in readerFieldInfos)
-                {
-                    // NOTE: first reader having a given field "wins":
-                    if (!fieldToReader.ContainsKey(fieldInfo.Name))
-                    {
-                        builder.Add(fieldInfo);
-                        fieldToReader[fieldInfo.Name] = reader;
-                        if (fieldInfo.HasVectors)
-                        {
-                            tvFieldToReader[fieldInfo.Name] = reader;
-                        }
-                    }
-                }
-            }
-            fieldInfos = builder.Finish();
-
-            // build Fields instance
-            foreach (AtomicReader reader in this.parallelReaders)
-            {
-                Fields readerFields = reader.Fields;
-                if (readerFields != null)
-                {
-                    foreach (string field in readerFields)
-                    {
-                        // only add if the reader responsible for that field name is the current:
-                        if (fieldToReader[field].Equals(reader))
-                        {
-                            this.fields.AddField(field, readerFields.GetTerms(field));
-                        }
-                    }
-                }
-            }
-
-            // do this finally so any Exceptions occurred before don't affect refcounts:
-            foreach (AtomicReader reader in completeReaderSet)
-            {
-                if (!closeSubReaders)
-                {
-                    reader.IncRef();
-                }
-                reader.RegisterParentReader(this);
-            }
-        }
-
-        public override string ToString()
-        {
-            StringBuilder buffer = new StringBuilder("ParallelAtomicReader(");
-            bool removeLastCommaSpace = false;
-            foreach (AtomicReader reader in completeReaderSet)
-            {
-                buffer.Append(reader);
-                buffer.Append(", ");
-                removeLastCommaSpace = true;
-            }
-
-            if (removeLastCommaSpace)
-            {
-                buffer.Remove(buffer.Length - 2, 2);
-            }
-
-            return buffer.Append(')').ToString();
-        }
-
-        // Single instance of this, per ParallelReader instance
-        private sealed class ParallelFields : Fields
-        {
-            private readonly ParallelAtomicReader outerInstance;
-
-            // LUCENENET specific: Use StringComparer.Ordinal to get the same ordering as Java
-            internal readonly IDictionary<string, Terms> fields = new SortedDictionary<string, Terms>(StringComparer.Ordinal);
-
-            internal ParallelFields(ParallelAtomicReader outerInstance)
-            {
-                this.outerInstance = outerInstance;
-            }
-
-            internal void AddField(string fieldName, Terms terms)
-            {
-                fields[fieldName] = terms;
-            }
-
-            public override IEnumerator<string> GetEnumerator()
-            {
-                return fields.Keys.GetEnumerator();
-            }
-
-            public override Terms GetTerms(string field)
-            {
-                Terms result;
-                fields.TryGetValue(field, out result);
-                return result;
-            }
-
-            public override int Count
-            {
-                get { return fields.Count; }
-            }
-        }
-
-        /// <summary>
-        /// {@inheritDoc}
-        /// <p>
-        /// NOTE: the returned field numbers will likely not
-        /// correspond to the actual field numbers in the underlying
-        /// readers, and codec metadata (<seealso cref="FieldInfo#getAttribute(String)"/>
-        /// will be unavailable.
-        /// </summary>
-        public override FieldInfos FieldInfos
-        {
-            get
-            {
-                return fieldInfos;
-            }
-        }
-
-        public override IBits LiveDocs
-        {
-            get
-            {
-                EnsureOpen();
-                return hasDeletions ? parallelReaders[0].LiveDocs : null;
-            }
-        }
-
-        public override Fields Fields
-        {
-            get
-            {
-                EnsureOpen();
-                return fields;
-            }
-        }
-
-        public override int NumDocs
-        {
-            get
-            {
-                // Don't call ensureOpen() here (it could affect performance)
-                return numDocs;
-            }
-        }
-
-        public override int MaxDoc
-        {
-            get
-            {
-                // Don't call ensureOpen() here (it could affect performance)
-                return maxDoc;
-            }
-        }
-
-        public override void Document(int docID, StoredFieldVisitor visitor)
-        {
-            EnsureOpen();
-            foreach (AtomicReader reader in storedFieldsReaders)
-            {
-                reader.Document(docID, visitor);
-            }
-        }
-
-        public override Fields GetTermVectors(int docID)
-        {
-            EnsureOpen();
-            ParallelFields fields = null;
-            foreach (KeyValuePair<string, AtomicReader> ent in tvFieldToReader/*.EntrySet()*/)
-            {
-                string fieldName = ent.Key;
-                Terms vector = ent.Value.GetTermVector(docID, fieldName);
-                if (vector != null)
-                {
-                    if (fields == null)
-                    {
-                        fields = new ParallelFields(this);
-                    }
-                    fields.AddField(fieldName, vector);
-                }
-            }
-
-            return fields;
-        }
-
-        protected internal override void DoClose()
-        {
-            lock (this)
-            {
-                IOException ioe = null;
-                foreach (AtomicReader reader in completeReaderSet)
-                {
-                    try
-                    {
-                        if (closeSubReaders)
-                        {
-                            reader.Dispose();
-                        }
-                        else
-                        {
-                            reader.DecRef();
-                        }
-                    }
-                    catch (IOException e)
-                    {
-                        if (ioe == null)
-                        {
-                            ioe = e;
-                        }
-                    }
-                }
-                // throw the first exception
-                if (ioe != null)
-                {
-                    throw ioe;
-                }
-            }
-        }
-
-        public override NumericDocValues GetNumericDocValues(string field)
-        {
-            EnsureOpen();
-            AtomicReader reader;
-            return fieldToReader.TryGetValue(field, out reader) ? reader.GetNumericDocValues(field) : null;
-        }
-
-        public override BinaryDocValues GetBinaryDocValues(string field)
-        {
-            EnsureOpen();
-            AtomicReader reader;
-            return fieldToReader.TryGetValue(field, out reader) ? reader.GetBinaryDocValues(field) : null;
-        }
-
-        public override SortedDocValues GetSortedDocValues(string field)
-        {
-            EnsureOpen();
-            AtomicReader reader;
-            return fieldToReader.TryGetValue(field, out reader) ? reader.GetSortedDocValues(field) : null;
-        }
-
-        public override SortedSetDocValues GetSortedSetDocValues(string field)
-        {
-            EnsureOpen();
-            AtomicReader reader;
-            return fieldToReader.TryGetValue(field, out reader) ? reader.GetSortedSetDocValues(field) : null;
-        }
-
-        public override IBits GetDocsWithField(string field)
-        {
-            EnsureOpen();
-            AtomicReader reader;
-            return fieldToReader.TryGetValue(field, out reader) ? reader.GetDocsWithField(field) : null;
-        }
-
-        public override NumericDocValues GetNormValues(string field)
-        {
-            EnsureOpen();
-            AtomicReader reader;
-            NumericDocValues values = null;
-            if (fieldToReader.TryGetValue(field, out reader))
-            {
-                values = reader.GetNormValues(field);
-            }
-            return values;
-        }
-
-        public override void CheckIntegrity()
-        {
-            EnsureOpen();
-            foreach (AtomicReader reader in completeReaderSet)
-            {
-                reader.CheckIntegrity();
-            }
-        }
-    }
-}
\ No newline at end of file


Mime
View raw message