lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [03/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:09 GMT
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Index/TaskMergeScheduler.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/TaskMergeScheduler.cs b/src/Lucene.Net.Core/Index/TaskMergeScheduler.cs
deleted file mode 100644
index cac1a34..0000000
--- a/src/Lucene.Net.Core/Index/TaskMergeScheduler.cs
+++ /dev/null
@@ -1,676 +0,0 @@
-´╗┐using Lucene.Net.Support;
-using Lucene.Net.Util;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using Directory = Lucene.Net.Store.Directory;
-
-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="MergeScheduler"/> that runs each merge using
-    ///  Tasks on the default TaskScheduler.
-    /// 
-    ///  <p>If more than <seealso cref="#GetMaxMergeCount"/> merges are
-    ///  requested then this class will forcefully throttle the
-    ///  incoming threads by pausing until one more more merges
-    ///  complete.</p>
-    ///  
-    /// LUCENENET specific
-    /// </summary>
-#if FEATURE_SERIALIZABLE
-    [Serializable]
-#endif
-    public class TaskMergeScheduler : MergeScheduler, IConcurrentMergeScheduler
-    {
-        public const string COMPONENT_NAME = "CMS";
-
-        private readonly TaskScheduler _taskScheduler = TaskScheduler.Default;
-        private readonly ReaderWriterLockSlim _lock = new ReaderWriterLockSlim();
-        private readonly ManualResetEventSlim _manualResetEvent = new ManualResetEventSlim();
-        /// <summary>
-        /// List of currently active <seealso cref="MergeThread"/>s.</summary>
-        private readonly IList<MergeThread> _mergeThreads = new List<MergeThread>();
-
-        /// <summary>
-        /// How many <seealso cref="MergeThread"/>s have kicked off (this is use
-        ///  to name them).
-        /// </summary>
-        private int _mergeThreadCount;
-
-        /// <summary>
-        /// <seealso cref="Directory"/> that holds the index. </summary>
-        private Directory _directory;
-
-        /// <summary>
-        /// <seealso cref="IndexWriter"/> that owns this instance.
-        /// </summary>
-        private IndexWriter _writer;
-
-        /// <summary>
-        /// Sole constructor, with all settings set to default
-        ///  values.
-        /// </summary>
-        public TaskMergeScheduler() : base()
-        {
-            MaxThreadCount = _taskScheduler.MaximumConcurrencyLevel;
-            MaxMergeCount = _taskScheduler.MaximumConcurrencyLevel;
-        }
-
-        /// <summary>
-        /// Sets the maximum number of merge threads and simultaneous merges allowed.
-        /// </summary>
-        /// <param name="maxMergeCount"> the max # simultaneous merges that are allowed.
-        ///       If a merge is necessary yet we already have this many
-        ///       threads running, the incoming thread (that is calling
-        ///       add/updateDocument) will block until a merge thread
-        ///       has completed.  Note that we will only run the
-        ///       smallest <code>maxThreadCount</code> merges at a time. </param>
-        /// <param name="maxThreadCount"> the max # simultaneous merge threads that should
-        ///       be running at once.  this must be &lt;= <code>maxMergeCount</code> </param>
-        public void SetMaxMergesAndThreads(int maxMergeCount, int maxThreadCount)
-        {
-            // This is handled by TaskScheduler.Default.MaximumConcurrencyLevel
-        }
-
-        /// <summary>
-        /// Max number of merge threads allowed to be running at
-        /// once.  When there are more merges then this, we
-        /// forcefully pause the larger ones, letting the smaller
-        /// ones run, up until maxMergeCount merges at which point
-        /// we forcefully pause incoming threads (that presumably
-        /// are the ones causing so much merging).
-        /// </summary>
-        /// <seealso cref= #setMaxMergesAndThreads(int, int)  </seealso>
-        public int MaxThreadCount { get; private set; }
-
-        /// <summary>
-        /// Max number of merges we accept before forcefully
-        /// throttling the incoming threads
-        /// </summary>
-        public int MaxMergeCount { get; private set; }
-
-        /// <summary>
-        /// Return the priority that merge threads run at. This is always the same.
-        /// </summary>
-        public int MergeThreadPriority
-        {
-            get
-            {
-#if NETSTANDARD
-                return 2;
-#else
-                return (int)ThreadPriority.Normal;
-#endif 
-            }
-        }
-
-        /// <summary>
-        /// This method has no effect in <see cref="TaskMergeScheduler"/> because the
-        /// <see cref="MergeThreadPriority"/> returns a constant value.
-        /// </summary>
-        public void SetMergeThreadPriority(int priority)
-        {
-        }
-
-        /// <summary>
-        /// Called whenever the running merges have changed, to pause & unpause
-        /// threads. this method sorts the merge threads by their merge size in
-        /// descending order and then pauses/unpauses threads from first to last --
-        /// that way, smaller merges are guaranteed to run before larger ones.
-        /// </summary>
-        private void UpdateMergeThreads()
-        {
-            foreach (var merge in _mergeThreads.ToArray())
-            {
-                // Prune any dead threads
-                if (!merge.IsAlive)
-                {
-                    _mergeThreads.Remove(merge);
-                    merge.Dispose();
-                }
-            }
-        }
-
-        /// <summary>
-        /// Returns true if verbosing is enabled. this method is usually used in
-        /// conjunction with <seealso cref="#message(String)"/>, like that:
-        ///
-        /// <pre class="prettyprint">
-        /// if (verbose()) {
-        ///   message(&quot;your message&quot;);
-        /// }
-        /// </pre>
-        /// </summary>
-        protected bool Verbose
-        {
-            get { return _writer != null && _writer.infoStream.IsEnabled(COMPONENT_NAME); }
-        }
-
-        /// <summary>
-        /// Outputs the given message - this method assumes <seealso cref="#verbose()"/> was
-        /// called and returned true.
-        /// </summary>
-        protected virtual void Message(string message)
-        {
-            _writer.infoStream.Message(COMPONENT_NAME, message);
-        }
-
-        protected override void Dispose(bool disposing)
-        {
-            Sync();
-            _manualResetEvent.Dispose();
-        }
-
-        /// <summary>
-        /// Wait for any running merge threads to finish. 
-        /// This call is not interruptible as used by <seealso cref="#Dispose()"/>.
-        /// </summary>
-        public virtual void Sync()
-        {
-            foreach (var merge in _mergeThreads.ToArray())
-            {
-                if (!merge.IsAlive)
-                {
-                    continue;
-                }
-
-                try
-                {
-                    merge.Wait();
-                }
-                catch (OperationCanceledException)
-                {
-                    // expected when we cancel.
-                }
-                catch (AggregateException ae)
-                {
-                    ae.Handle(x => x is OperationCanceledException);
-
-                    foreach (var exception in ae.InnerExceptions)
-                    {
-                        HandleMergeException(ae);
-                    }
-                }
-            }
-        }
-
-        /// <summary>
-        /// Returns the number of merge threads that are alive. Note that this number
-        /// is &lt;= <seealso cref="#mergeThreads"/> size.
-        /// </summary>
-        private int MergeThreadCount
-        {
-            get { return _mergeThreads.Count(x => x.IsAlive && x.CurrentMerge != null); }
-        }
-
-        public override void Merge(IndexWriter writer, MergeTrigger trigger, bool newMergesFound)
-        {
-            using (_lock.Write())
-            {
-                _writer = writer;
-                _directory = writer.Directory;
-
-                if (Verbose)
-                {
-                    Message("now merge");
-                    Message("  index: " + writer.SegString());
-                }
-
-                // First, quickly run through the newly proposed merges
-                // and add any orthogonal merges (ie a merge not
-                // involving segments already pending to be merged) to
-                // the queue.  If we are way behind on merging, many of
-                // these newly proposed merges will likely already be
-                // registered.
-
-                // Iterate, pulling from the IndexWriter's queue of
-                // pending merges, until it's empty:
-                while (true)
-                {
-                    long startStallTime = 0;
-                    while (writer.HasPendingMerges() && MergeThreadCount >= MaxMergeCount)
-                    {
-                        // this means merging has fallen too far behind: we
-                        // have already created maxMergeCount threads, and
-                        // now there's at least one more merge pending.
-                        // Note that only maxThreadCount of
-                        // those created merge threads will actually be
-                        // running; the rest will be paused (see
-                        // updateMergeThreads).  We stall this producer
-                        // thread to prevent creation of new segments,
-                        // until merging has caught up:
-                        startStallTime = Environment.TickCount;
-                        if (Verbose)
-                        {
-                            Message("    too many merges; stalling...");
-                        }
-
-                        _manualResetEvent.Reset();
-                        _manualResetEvent.Wait();
-                    }
-
-                    if (Verbose)
-                    {
-                        if (startStallTime != 0)
-                        {
-                            Message("  stalled for " + (Environment.TickCount - startStallTime) + " msec");
-                        }
-                    }
-
-                    MergePolicy.OneMerge merge = writer.NextMerge();
-                    if (merge == null)
-                    {
-                        if (Verbose)
-                        {
-                            Message("  no more merges pending; now return");
-                        }
-                        return;
-                    }
-
-                    bool success = false;
-                    try
-                    {
-                        if (Verbose)
-                        {
-                            Message("  consider merge " + writer.SegString(merge.Segments));
-                        }
-
-                        // OK to spawn a new merge thread to handle this
-                        // merge:
-                        var merger = CreateTask(writer, merge);
-
-                        merger.MergeThreadCompleted += OnMergeThreadCompleted;
-
-                        _mergeThreads.Add(merger);
-
-                        if (Verbose)
-                        {
-                            Message("    launch new thread [" + merger.Name + "]");
-                        }
-
-                        merger.Start(_taskScheduler);
-
-                        // Must call this after starting the thread else
-                        // the new thread is removed from mergeThreads
-                        // (since it's not alive yet):
-                        UpdateMergeThreads();
-
-                        success = true;
-                    }
-                    finally
-                    {
-                        if (!success)
-                        {
-                            writer.MergeFinish(merge);
-                        }
-                    }
-                }
-            }
-        }
-
-        private void OnMergeThreadCompleted(object sender, EventArgs e)
-        {
-            var mergeThread = sender as MergeThread;
-
-            if (mergeThread == null)
-            {
-                return;
-            }
-
-            mergeThread.MergeThreadCompleted -= OnMergeThreadCompleted;
-
-            using (_lock.Write())
-            {
-                UpdateMergeThreads();
-            }
-        }
-
-        /// <summary>
-        /// Create and return a new MergeThread </summary>
-        private MergeThread CreateTask(IndexWriter writer, MergePolicy.OneMerge merge)
-        {
-            var count = Interlocked.Increment(ref _mergeThreadCount);
-            var name = string.Format("Lucene Merge Task #{0}", count);
-
-            return new MergeThread(name, writer, merge, writer.infoStream, Verbose, _manualResetEvent, HandleMergeException);
-        }
-
-        /// <summary>
-        /// Called when an exception is hit in a background merge
-        ///  thread
-        /// </summary>
-        protected virtual void HandleMergeException(Exception exc)
-        {
-            // suppressExceptions is normally only set during testing
-            if (suppressExceptions)
-            {
-                return;
-            }
-
-#if !NETSTANDARD
-            try
-            {
-#endif
-                // When an exception is hit during merge, IndexWriter
-                // removes any partial files and then allows another
-                // merge to run.  If whatever caused the error is not
-                // transient then the exception will keep happening,
-                // so, we sleep here to avoid saturating CPU in such
-                // cases:
-                Thread.Sleep(250);
-#if !NETSTANDARD
-            }
-            catch (ThreadInterruptedException ie)
-            {
-                throw new ThreadInterruptedException("Thread Interrupted Exception", ie);
-            }
-#endif
-            throw new MergePolicy.MergeException(exc, _directory);
-        }
-
-        private bool suppressExceptions;
-
-        /// <summary>
-        /// Used for testing </summary>
-        public virtual void SetSuppressExceptions()
-        {
-            suppressExceptions = true;
-        }
-
-        /// <summary>
-        /// Used for testing </summary>
-        public virtual void ClearSuppressExceptions()
-        {
-            suppressExceptions = false;
-        }
-
-        public override string ToString()
-        {
-            StringBuilder sb = new StringBuilder(this.GetType().Name + ": ");
-            sb.AppendFormat("maxThreadCount={0}, ", MaxThreadCount);
-            sb.AppendFormat("maxMergeCount={0}", MaxMergeCount);
-            return sb.ToString();
-        }
-
-        public override IMergeScheduler Clone()
-        {
-            TaskMergeScheduler clone = (TaskMergeScheduler)base.Clone();
-            clone._writer = null;
-            clone._directory = null;
-            clone._mergeThreads.Clear();
-            return clone;
-        }
-
-        /// <summary>
-        /// Runs a merge thread, which may run one or more merges
-        ///  in sequence.
-        /// </summary>
-        internal class MergeThread : IDisposable
-        {
-            public event EventHandler MergeThreadCompleted;
-
-            private readonly CancellationTokenSource _cancellationTokenSource;
-            private readonly ReaderWriterLockSlim _lock = new ReaderWriterLockSlim();
-            private readonly ManualResetEventSlim _resetEvent;
-            private readonly Action<Exception> _exceptionHandler;
-            private readonly InfoStream _logger;
-            private readonly IndexWriter _writer;
-            private readonly MergePolicy.OneMerge _startingMerge;
-            private readonly bool _isLoggingEnabled;
-
-            private Task _task;
-            private MergePolicy.OneMerge _runningMerge;
-            private volatile bool _isDisposed = false;
-            private volatile bool _isDone;
-
-            /// <summary>
-            /// Sole constructor. </summary>
-            public MergeThread(string name, IndexWriter writer, MergePolicy.OneMerge startMerge,
-                InfoStream logger, bool isLoggingEnabled,
-                ManualResetEventSlim resetEvent, Action<Exception> exceptionHandler)
-            {
-                Name = name;
-                _cancellationTokenSource = new CancellationTokenSource();
-                _writer = writer;
-                _startingMerge = startMerge;
-                _logger = logger;
-                _isLoggingEnabled = isLoggingEnabled;
-                _resetEvent = resetEvent;
-                _exceptionHandler = exceptionHandler;
-            }
-
-            public string Name { get; private set; }
-
-            public Task Instance
-            {
-                get
-                {
-                    using (_lock.Read())
-                    {
-                        return _task;
-                    }
-                }
-            }
-
-            /// <summary>
-            /// Record the currently running merge. </summary>
-            public virtual MergePolicy.OneMerge RunningMerge
-            {
-                set
-                {
-                    Interlocked.Exchange(ref _runningMerge, value);
-                }
-                get
-                {
-                    using (_lock.Read())
-                    {
-                        return _runningMerge;
-                    }
-                }
-            }
-
-            /// <summary>
-            /// Return the current merge, or null if this {@code
-            ///  MergeThread} is done.
-            /// </summary>
-            public virtual MergePolicy.OneMerge CurrentMerge
-            {
-                get
-                {
-                    using (_lock.Read())
-                    {
-                        if (_isDone)
-                        {
-                            return null;
-                        }
-
-                        return _runningMerge ?? _startingMerge;
-                    }
-                }
-            }
-
-            public bool IsAlive
-            {
-                get
-                {
-                    if (_isDisposed || _isDone)
-                    {
-                        return false;
-                    }
-
-                    using (_lock.Read())
-                    {
-                        return _task != null
-                            && (_task.Status != TaskStatus.Canceled
-                            || _task.Status != TaskStatus.Faulted
-                            || _task.Status != TaskStatus.RanToCompletion);
-                    }
-                }
-            }
-
-            public void Start(TaskScheduler taskScheduler)
-            {
-                using (_lock.Write())
-                {
-                    if (_task == null && !_cancellationTokenSource.IsCancellationRequested)
-                    {
-                        _task = Task.Factory.StartNew(() => Run(_cancellationTokenSource.Token), _cancellationTokenSource.Token, TaskCreationOptions.None, taskScheduler);
-                    }
-                }
-            }
-
-            public void Wait()
-            {
-                if (!IsAlive)
-                {
-                    return;
-                }
-
-                _task.Wait(_cancellationTokenSource.Token);
-            }
-
-            public void Cancel()
-            {
-                if (!IsAlive)
-                {
-                    return;
-                }
-
-                using (_lock.Write())
-                {
-                    if (!_cancellationTokenSource.IsCancellationRequested)
-                    {
-                        _cancellationTokenSource.Cancel();
-                    }
-                }
-            }
-
-            private void Run(CancellationToken cancellationToken)
-            {
-                // First time through the while loop we do the merge
-                // that we were started with:
-                MergePolicy.OneMerge merge = _startingMerge;
-
-                try
-                {
-                    if (_isLoggingEnabled)
-                    {
-                        _logger.Message(COMPONENT_NAME, "  merge thread: start");
-                    }
-
-                    while (true && !cancellationToken.IsCancellationRequested)
-                    {
-                        RunningMerge = merge;
-                        _writer.Merge(merge);
-
-                        // Subsequent times through the loop we do any new
-                        // merge that writer says is necessary:
-                        merge = _writer.NextMerge();
-
-                        // Notify here in case any threads were stalled;
-                        // they will notice that the pending merge has
-                        // been pulled and possibly resume:
-                        _resetEvent.Set();
-
-                        if (merge != null)
-                        {
-                            if (_isLoggingEnabled)
-                            {
-                                _logger.Message(COMPONENT_NAME, "  merge thread: do another merge " + _writer.SegString(merge.Segments));
-                            }
-                        }
-                        else
-                        {
-                            break;
-                        }
-                    }
-
-                    if (_isLoggingEnabled)
-                    {
-                        _logger.Message(COMPONENT_NAME, "  merge thread: done");
-                    }
-                }
-                catch (Exception exc)
-                {
-                    // Ignore the exception if it was due to abort:
-                    if (!(exc is MergePolicy.MergeAbortedException))
-                    {
-                        //System.out.println(Thread.currentThread().getName() + ": CMS: exc");
-                        //exc.printStackTrace(System.out)
-                        _exceptionHandler(exc);
-                    }
-                }
-                finally
-                {
-                    _isDone = true;
-
-                    if (MergeThreadCompleted != null)
-                    {
-                        MergeThreadCompleted(this, EventArgs.Empty);
-                    }
-                }
-            }
-
-            public void Dispose()
-            {
-                if (_isDisposed)
-                {
-                    return;
-                }
-
-                _isDisposed = true;
-                _lock.Dispose();
-                _cancellationTokenSource.Dispose();
-            }
-
-            public override string ToString()
-            {
-                return _task == null
-                    ? string.Format("Task[{0}], Task has not been started yet.", Name)
-                    : string.Format("Task[{0}], Id[{1}], Status[{2}]", Name, _task.Id, _task.Status);
-            }
-
-            public override bool Equals(object obj)
-            {
-                var compared = obj as MergeThread;
-
-                if (compared == null
-                    || (Instance == null && compared.Instance != null)
-                    || (Instance != null && compared.Instance == null))
-                {
-                    return false;
-                }
-
-                return Instance.Id == compared.Instance.Id;
-            }
-
-            public override int GetHashCode()
-            {
-                return Instance == null
-                    ? base.GetHashCode()
-                    : Instance.GetHashCode();
-            }
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Index/Term.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/Term.cs b/src/Lucene.Net.Core/Index/Term.cs
deleted file mode 100644
index 73b8407..0000000
--- a/src/Lucene.Net.Core/Index/Term.cs
+++ /dev/null
@@ -1,202 +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 BytesRef = Lucene.Net.Util.BytesRef;
-
-    /// <summary>
-    ///  A Term represents a word from text.  this is the unit of search.  It is
-    ///  composed of two elements, the text of the word, as a string, and the name of
-    ///  the field that the text occurred in.
-    ///
-    ///  Note that terms may represent more than words from text fields, but also
-    ///  things like dates, email addresses, urls, etc.
-    /// </summary>
-#if FEATURE_SERIALIZABLE
-    [Serializable]
-#endif
-    public sealed class Term : IComparable<Term>, IEquatable<Term> // LUCENENET specific - class implements IEquatable<T>
-    {
-        /// <summary>
-        /// Constructs a Term with the given field and bytes.
-        /// <p>Note that a null field or null bytes value results in undefined
-        /// behavior for most Lucene APIs that accept a Term parameter.
-        ///
-        /// <p>WARNING: the provided BytesRef is not copied, but used directly.
-        /// Therefore the bytes should not be modified after construction, for
-        /// example, you should clone a copy by <seealso cref="BytesRef#deepCopyOf"/>
-        /// rather than pass reused bytes from a TermsEnum.
-        /// </summary>
-        public Term(string fld, BytesRef bytes)
-        {
-            Field = fld;
-            Bytes = bytes;
-        }
-
-        /// <summary>
-        /// Constructs a Term with the given field and text.
-        /// <p>Note that a null field or null text value results in undefined
-        /// behavior for most Lucene APIs that accept a Term parameter.
-        /// </summary>
-        public Term(string fld, string text)
-            : this(fld, new BytesRef(text))
-        {
-        }
-
-        /// <summary>
-        /// Constructs a Term with the given field and empty text.
-        /// this serves two purposes: 1) reuse of a Term with the same field.
-        /// 2) pattern for a query.
-        /// </summary>
-        /// <param name="fld"> field's name </param>
-        public Term(string fld)
-            : this(fld, new BytesRef())
-        {
-        }
-
-        /// <summary>
-        /// Returns the field of this term.   The field indicates
-        ///  the part of a document which this term came from.
-        /// </summary>
-        public string Field { get; internal set; }
-
-        /// <summary>
-        /// Returns the text of this term.  In the case of words, this is simply the
-        ///  text of the word.  In the case of dates and other types, this is an
-        ///  encoding of the object as a string.
-        /// </summary>
-        public string Text()
-        {
-            return ToString(Bytes);
-        }
-
-        /// <summary>
-        /// Returns human-readable form of the term text. If the term is not unicode,
-        /// the raw bytes will be printed instead.
-        /// </summary>
-        public static string ToString(BytesRef termText)
-        {
-            try
-            {
-                // LUCENENET specific: termText already has this handy UTF8ToString method, so we're using that instead of Encoding.UTF8.GetBytes()
-                return termText.Utf8ToString();
-            }
-            catch
-            {
-                return termText.ToString();
-            }
-        }
-
-        /// <summary>
-        /// Returns the bytes of this term.
-        /// </summary>
-        public BytesRef Bytes { get; internal set; }
-
-        public override bool Equals(object obj)
-        {
-            Term t = obj as Term;
-            return this.Equals(t);
-        }
-
-        public override int GetHashCode()
-        {
-            const int prime = 31;
-            int result = 1;
-            result = prime * result + ((Field == null) ? 0 : Field.GetHashCode());
-            result = prime * result + ((Bytes == null) ? 0 : Bytes.GetHashCode());
-            return result;
-        }
-
-        /// <summary>
-        /// Compares two terms, returning a negative integer if this
-        ///  term belongs before the argument, zero if this term is equal to the
-        ///  argument, and a positive integer if this term belongs after the argument.
-        ///
-        ///  The ordering of terms is first by field, then by text.
-        /// </summary>
-        public int CompareTo(Term other)
-        {
-            int compare = Field.CompareToOrdinal(other.Field);
-            if (compare == 0)
-            {
-                return Bytes.CompareTo(other.Bytes);
-            }
-            else
-            {
-                return compare;
-            }
-        }
-
-        /// <summary>
-        /// Resets the field and text of a Term.
-        /// <p>WARNING: the provided BytesRef is not copied, but used directly.
-        /// Therefore the bytes should not be modified after construction, for
-        /// example, you should clone a copy rather than pass reused bytes from
-        /// a TermsEnum.
-        /// </summary>
-        internal void Set(string fld, BytesRef bytes)
-        {
-            Field = fld;
-            this.Bytes = bytes;
-        }
-
-        public bool Equals(Term other)
-        {
-            if (object.ReferenceEquals(null, other))
-            {
-                return object.ReferenceEquals(null, this);
-            }
-            if (object.ReferenceEquals(this, other))
-            {
-                return true;
-            }
-
-            if (this.GetType() != other.GetType())
-            {
-                return false;
-            }
-
-            if (string.Compare(this.Field, other.Field, StringComparison.Ordinal) != 0)
-            {
-                return false;
-            }
-
-            if (Bytes == null)
-            {
-                if (other.Bytes != null)
-                {
-                    return false;
-                }
-            }
-            else if (!Bytes.Equals(other.Bytes))
-            {
-                return false;
-            }
-
-            return true;
-        }
-
-        public override string ToString()
-        {
-            return Field + ":" + Text();
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Index/TermContext.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/TermContext.cs b/src/Lucene.Net.Core/Index/TermContext.cs
deleted file mode 100644
index 945d928..0000000
--- a/src/Lucene.Net.Core/Index/TermContext.cs
+++ /dev/null
@@ -1,193 +0,0 @@
-using Lucene.Net.Support;
-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 BytesRef = Lucene.Net.Util.BytesRef;
-
-    /// <summary>
-    /// Maintains a <seealso cref="IndexReader"/> <seealso cref="TermState"/> view over
-    /// <seealso cref="IndexReader"/> instances containing a single term. The
-    /// <seealso cref="TermContext"/> doesn't track if the given <seealso cref="TermState"/>
-    /// objects are valid, neither if the <seealso cref="TermState"/> instances refer to the
-    /// same terms in the associated readers.
-    ///
-    /// @lucene.experimental
-    /// </summary>
-#if FEATURE_SERIALIZABLE
-    [Serializable]
-#endif
-    public sealed class TermContext
-    {
-        /// <summary>
-        /// Holds the <seealso cref="IndexReaderContext"/> of the top-level
-        ///  <seealso cref="IndexReader"/>, used internally only for
-        ///  asserting.
-        ///
-        ///  @lucene.internal
-        /// </summary>
-        public IndexReaderContext TopReaderContext { get; private set; }
-
-        private readonly TermState[] states;
-        private int docFreq;
-        private long totalTermFreq;
-
-        //public static boolean DEBUG = BlockTreeTermsWriter.DEBUG;
-
-        /// <summary>
-        /// Creates an empty <seealso cref="TermContext"/> from a <seealso cref="IndexReaderContext"/>
-        /// </summary>
-        public TermContext(IndexReaderContext context)
-        {
-            Debug.Assert(context != null && context.IsTopLevel);
-            TopReaderContext = context;
-            docFreq = 0;
-            int len;
-            if (context.Leaves == null)
-            {
-                len = 1;
-            }
-            else
-            {
-                len = context.Leaves.Count;
-            }
-            states = new TermState[len];
-        }
-
-        /// <summary>
-        /// Creates a <seealso cref="TermContext"/> with an initial <seealso cref="TermState"/>,
-        /// <seealso cref="IndexReader"/> pair.
-        /// </summary>
-        public TermContext(IndexReaderContext context, TermState state, int ord, int docFreq, long totalTermFreq)
-            : this(context)
-        {
-            Register(state, ord, docFreq, totalTermFreq);
-        }
-
-        /// <summary>
-        /// Creates a <seealso cref="TermContext"/> from a top-level <seealso cref="IndexReaderContext"/> and the
-        /// given <seealso cref="Term"/>. this method will lookup the given term in all context's leaf readers
-        /// and register each of the readers containing the term in the returned <seealso cref="TermContext"/>
-        /// using the leaf reader's ordinal.
-        /// <p>
-        /// Note: the given context must be a top-level context.
-        /// </summary>
-        public static TermContext Build(IndexReaderContext context, Term term)
-        {
-            Debug.Assert(context != null && context.IsTopLevel);
-            string field = term.Field;
-            BytesRef bytes = term.Bytes;
-            TermContext perReaderTermState = new TermContext(context);
-            //if (DEBUG) System.out.println("prts.build term=" + term);
-            foreach (AtomicReaderContext ctx in context.Leaves)
-            {
-                //if (DEBUG) System.out.println("  r=" + leaves[i].reader);
-                Fields fields = ctx.AtomicReader.Fields;
-                if (fields != null)
-                {
-                    Terms terms = fields.GetTerms(field);
-                    if (terms != null)
-                    {
-                        TermsEnum termsEnum = terms.GetIterator(null);
-                        if (termsEnum.SeekExact(bytes))
-                        {
-                            TermState termState = termsEnum.GetTermState();
-                            //if (DEBUG) System.out.println("    found");
-                            perReaderTermState.Register(termState, ctx.Ord, termsEnum.DocFreq, termsEnum.TotalTermFreq);
-                        }
-                    }
-                }
-            }
-            return perReaderTermState;
-        }
-
-        /// <summary>
-        /// Clears the <seealso cref="TermContext"/> internal state and removes all
-        /// registered <seealso cref="TermState"/>s
-        /// </summary>
-        public void Clear()
-        {
-            docFreq = 0;
-            Arrays.Fill(states, null);
-        }
-
-        /// <summary>
-        /// Registers and associates a <seealso cref="TermState"/> with an leaf ordinal. The leaf ordinal
-        /// should be derived from a <seealso cref="IndexReaderContext"/>'s leaf ord.
-        /// </summary>
-        public void Register(TermState state, int ord, int docFreq, long totalTermFreq)
-        {
-            Debug.Assert(state != null, "state must not be null");
-            Debug.Assert(ord >= 0 && ord < states.Length);
-            Debug.Assert(states[ord] == null, "state for ord: " + ord + " already registered");
-            this.docFreq += docFreq;
-            if (this.totalTermFreq >= 0 && totalTermFreq >= 0)
-            {
-                this.totalTermFreq += totalTermFreq;
-            }
-            else
-            {
-                this.totalTermFreq = -1;
-            }
-            states[ord] = state;
-        }
-
-        /// <summary>
-        /// Returns the <seealso cref="TermState"/> for an leaf ordinal or <code>null</code> if no
-        /// <seealso cref="TermState"/> for the ordinal was registered.
-        /// </summary>
-        /// <param name="ord">
-        ///          the readers leaf ordinal to get the <seealso cref="TermState"/> for. </param>
-        /// <returns> the <seealso cref="TermState"/> for the given readers ord or <code>null</code> if no
-        ///         <seealso cref="TermState"/> for the reader was registered </returns>
-        public TermState Get(int ord)
-        {
-            Debug.Assert(ord >= 0 && ord < states.Length);
-            return states[ord];
-        }
-
-        /// <summary>
-        ///  Returns the accumulated term frequency of all <seealso cref="TermState"/>
-        ///         instances passed to <seealso cref="#register(TermState, int, int, long)"/>. </summary>
-        /// <returns> the accumulated term frequency of all <seealso cref="TermState"/>
-        ///         instances passed to <seealso cref="#register(TermState, int, int, long)"/>. </returns>
-        public long TotalTermFreq
-        {
-            get { return totalTermFreq; }
-        }
-
-        /// <summary>
-        /// expert: only available for queries that want to lie about docfreq
-        /// @lucene.internal
-        /// </summary>
-        public int DocFreq
-        {
-            set
-            {
-                this.docFreq = value;
-            }
-            get
-            {
-                return docFreq;
-            }
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Index/TermState.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/TermState.cs b/src/Lucene.Net.Core/Index/TermState.cs
deleted file mode 100644
index c5dd839..0000000
--- a/src/Lucene.Net.Core/Index/TermState.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>
-    /// Encapsulates all required internal state to position the associated
-    /// <seealso cref="TermsEnum"/> without re-seeking.
-    /// </summary>
-    /// <seealso cref= TermsEnum#seekExact(Lucene.Net.Util.BytesRef, TermState) </seealso>
-    /// <seealso cref= TermsEnum#termState()
-    /// @lucene.experimental </seealso>
-#if FEATURE_SERIALIZABLE
-    [Serializable]
-#endif
-    public abstract class TermState
-    {
-        /// <summary>
-        /// Sole constructor. (For invocation by subclass
-        ///  constructors, typically implicit.)
-        /// </summary>
-        protected TermState()
-        {
-        }
-
-        /// <summary>
-        /// Copies the content of the given <seealso cref="TermState"/> to this instance
-        /// </summary>
-        /// <param name="other">
-        ///          the TermState to copy </param>
-        public abstract void CopyFrom(TermState other);
-
-        public virtual object Clone()
-        {
-            return (TermState)base.MemberwiseClone();
-        }
-
-        public override string ToString()
-        {
-            return "TermState";
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Index/TermVectorsConsumer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/TermVectorsConsumer.cs b/src/Lucene.Net.Core/Index/TermVectorsConsumer.cs
deleted file mode 100644
index 04ba05d..0000000
--- a/src/Lucene.Net.Core/Index/TermVectorsConsumer.cs
+++ /dev/null
@@ -1,209 +0,0 @@
-using Lucene.Net.Support;
-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 ArrayUtil = Lucene.Net.Util.ArrayUtil;
-    using BytesRef = Lucene.Net.Util.BytesRef;
-    using FlushInfo = Lucene.Net.Store.FlushInfo;
-    using IOContext = Lucene.Net.Store.IOContext;
-    using IOUtils = Lucene.Net.Util.IOUtils;
-    using RamUsageEstimator = Lucene.Net.Util.RamUsageEstimator;
-    using TermVectorsWriter = Lucene.Net.Codecs.TermVectorsWriter;
-
-#if FEATURE_SERIALIZABLE
-    [Serializable]
-#endif
-    internal sealed class TermVectorsConsumer : TermsHashConsumer
-    {
-        internal TermVectorsWriter writer;
-        internal readonly DocumentsWriterPerThread docWriter;
-        internal readonly DocumentsWriterPerThread.DocState docState;
-        internal readonly BytesRef flushTerm = new BytesRef();
-
-        // Used by perField when serializing the term vectors
-        internal readonly ByteSliceReader vectorSliceReaderPos = new ByteSliceReader();
-
-        internal readonly ByteSliceReader vectorSliceReaderOff = new ByteSliceReader();
-        internal bool hasVectors;
-        internal int numVectorFields;
-        internal int lastDocID;
-        private TermVectorsConsumerPerField[] perFields = new TermVectorsConsumerPerField[1];
-
-        public TermVectorsConsumer(DocumentsWriterPerThread docWriter)
-        {
-            this.docWriter = docWriter;
-            docState = docWriter.docState;
-        }
-
-        // LUCENENE specific - original was internal, but FreqProxTermsWriter requires public (little point, since both are internal classes)
-        public override void Flush(IDictionary<string, TermsHashConsumerPerField> fieldsToFlush, SegmentWriteState state)
-        {
-            if (writer != null)
-            {
-                int numDocs = state.SegmentInfo.DocCount;
-                Debug.Assert(numDocs > 0);
-                // At least one doc in this run had term vectors enabled
-                try
-                {
-                    Fill(numDocs);
-                    Debug.Assert(state.SegmentInfo != null);
-                    writer.Finish(state.FieldInfos, numDocs);
-                }
-                finally
-                {
-                    IOUtils.Close(writer);
-                    writer = null;
-                    lastDocID = 0;
-                    hasVectors = false;
-                }
-            }
-
-            foreach (TermsHashConsumerPerField field in fieldsToFlush.Values)
-            {
-                TermVectorsConsumerPerField perField = (TermVectorsConsumerPerField)field;
-                perField.termsHashPerField.Reset();
-                perField.ShrinkHash();
-            }
-        }
-
-        /// <summary>
-        /// Fills in no-term-vectors for all docs we haven't seen
-        ///  since the last doc that had term vectors.
-        /// </summary>
-        internal void Fill(int docID)
-        {
-            while (lastDocID < docID)
-            {
-                writer.StartDocument(0);
-                writer.FinishDocument();
-                lastDocID++;
-            }
-        }
-
-        private void InitTermVectorsWriter()
-        {
-            if (writer == null)
-            {
-                IOContext context = new IOContext(new FlushInfo(docWriter.NumDocsInRAM, docWriter.BytesUsed));
-                writer = docWriter.codec.TermVectorsFormat.VectorsWriter(docWriter.directory, docWriter.SegmentInfo, context);
-                lastDocID = 0;
-            }
-        }
-
-        internal override void FinishDocument(TermsHash termsHash)
-        {
-            Debug.Assert(docWriter.TestPoint("TermVectorsTermsWriter.finishDocument start"));
-
-            if (!hasVectors)
-            {
-                return;
-            }
-
-            InitTermVectorsWriter();
-
-            Fill(docState.docID);
-
-            // Append term vectors to the real outputs:
-            writer.StartDocument(numVectorFields);
-            for (int i = 0; i < numVectorFields; i++)
-            {
-                perFields[i].FinishDocument();
-            }
-            writer.FinishDocument();
-
-            Debug.Assert(lastDocID == docState.docID, "lastDocID=" + lastDocID + " docState.docID=" + docState.docID);
-
-            lastDocID++;
-
-            termsHash.Reset();
-            Reset();
-            Debug.Assert(docWriter.TestPoint("TermVectorsTermsWriter.finishDocument end"));
-        }
-
-        public override void Abort()
-        {
-            hasVectors = false;
-
-            if (writer != null)
-            {
-                writer.Abort();
-                writer = null;
-            }
-
-            lastDocID = 0;
-            Reset();
-        }
-
-        internal void Reset()
-        {
-            Arrays.Fill(perFields, null); // don't hang onto stuff from previous doc
-            numVectorFields = 0;
-        }
-
-        public override TermsHashConsumerPerField AddField(TermsHashPerField termsHashPerField, FieldInfo fieldInfo)
-        {
-            return new TermVectorsConsumerPerField(termsHashPerField, this, fieldInfo);
-        }
-
-        internal void AddFieldToFlush(TermVectorsConsumerPerField fieldToFlush)
-        {
-            if (numVectorFields == perFields.Length)
-            {
-                int newSize = ArrayUtil.Oversize(numVectorFields + 1, RamUsageEstimator.NUM_BYTES_OBJECT_REF);
-                TermVectorsConsumerPerField[] newArray = new TermVectorsConsumerPerField[newSize];
-                Array.Copy(perFields, 0, newArray, 0, numVectorFields);
-                perFields = newArray;
-            }
-
-            perFields[numVectorFields++] = fieldToFlush;
-        }
-
-        internal override void StartDocument()
-        {
-            Debug.Assert(ClearLastVectorFieldName());
-            Reset();
-        }
-
-        // Called only by assert
-        internal bool ClearLastVectorFieldName()
-        {
-            lastVectorFieldName = null;
-            return true;
-        }
-
-        // Called only by assert
-        internal string lastVectorFieldName;
-
-        internal bool VectorFieldsInOrder(FieldInfo fi)
-        {
-            try
-            {
-                return lastVectorFieldName != null ? lastVectorFieldName.CompareToOrdinal(fi.Name) < 0 : true;
-            }
-            finally
-            {
-                lastVectorFieldName = fi.Name;
-            }
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Index/TermVectorsConsumerPerField.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/TermVectorsConsumerPerField.cs b/src/Lucene.Net.Core/Index/TermVectorsConsumerPerField.cs
deleted file mode 100644
index f24e457..0000000
--- a/src/Lucene.Net.Core/Index/TermVectorsConsumerPerField.cs
+++ /dev/null
@@ -1,373 +0,0 @@
-using Lucene.Net.Analysis.TokenAttributes;
-using Lucene.Net.Support;
-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 ByteBlockPool = Lucene.Net.Util.ByteBlockPool;
-    using BytesRef = Lucene.Net.Util.BytesRef;
-    using OffsetAttribute = Lucene.Net.Analysis.TokenAttributes.OffsetAttribute;
-    using PayloadAttribute = Lucene.Net.Analysis.TokenAttributes.PayloadAttribute;
-    using RamUsageEstimator = Lucene.Net.Util.RamUsageEstimator;
-    using TermVectorsWriter = Lucene.Net.Codecs.TermVectorsWriter;
-
-#if FEATURE_SERIALIZABLE
-    [Serializable]
-#endif
-    internal sealed class TermVectorsConsumerPerField : TermsHashConsumerPerField
-    {
-        internal readonly TermsHashPerField termsHashPerField;
-        internal readonly TermVectorsConsumer termsWriter;
-        internal readonly FieldInfo fieldInfo;
-        internal readonly DocumentsWriterPerThread.DocState docState;
-        internal readonly FieldInvertState fieldState;
-
-        internal bool doVectors;
-        internal bool doVectorPositions;
-        internal bool doVectorOffsets;
-        internal bool doVectorPayloads;
-
-        internal int maxNumPostings;
-        internal IOffsetAttribute offsetAttribute;
-        internal IPayloadAttribute payloadAttribute;
-        internal bool hasPayloads; // if enabled, and we actually saw any for this field
-
-        public TermVectorsConsumerPerField(TermsHashPerField termsHashPerField, TermVectorsConsumer termsWriter, FieldInfo fieldInfo)
-        {
-            this.termsHashPerField = termsHashPerField;
-            this.termsWriter = termsWriter;
-            this.fieldInfo = fieldInfo;
-            docState = termsHashPerField.docState;
-            fieldState = termsHashPerField.fieldState;
-        }
-
-        internal override int StreamCount
-        {
-            get
-            {
-                return 2;
-            }
-        }
-
-        internal override bool Start(IIndexableField[] fields, int count)
-        {
-            doVectors = false;
-            doVectorPositions = false;
-            doVectorOffsets = false;
-            doVectorPayloads = false;
-            hasPayloads = false;
-
-            for (int i = 0; i < count; i++)
-            {
-                IIndexableField field = fields[i];
-                if (field.FieldType.IsIndexed)
-                {
-                    if (field.FieldType.StoreTermVectors)
-                    {
-                        doVectors = true;
-                        doVectorPositions |= field.FieldType.StoreTermVectorPositions;
-                        doVectorOffsets |= field.FieldType.StoreTermVectorOffsets;
-                        if (doVectorPositions)
-                        {
-                            doVectorPayloads |= field.FieldType.StoreTermVectorPayloads;
-                        }
-                        else if (field.FieldType.StoreTermVectorPayloads)
-                        {
-                            // TODO: move this check somewhere else, and impl the other missing ones
-                            throw new System.ArgumentException("cannot index term vector payloads without term vector positions (field=\"" + field.Name + "\")");
-                        }
-                    }
-                    else
-                    {
-                        if (field.FieldType.StoreTermVectorOffsets)
-                        {
-                            throw new System.ArgumentException("cannot index term vector offsets when term vectors are not indexed (field=\"" + field.Name + "\")");
-                        }
-                        if (field.FieldType.StoreTermVectorPositions)
-                        {
-                            throw new System.ArgumentException("cannot index term vector positions when term vectors are not indexed (field=\"" + field.Name + "\")");
-                        }
-                        if (field.FieldType.StoreTermVectorPayloads)
-                        {
-                            throw new System.ArgumentException("cannot index term vector payloads when term vectors are not indexed (field=\"" + field.Name + "\")");
-                        }
-                    }
-                }
-                else
-                {
-                    if (field.FieldType.StoreTermVectors)
-                    {
-                        throw new System.ArgumentException("cannot index term vectors when field is not indexed (field=\"" + field.Name + "\")");
-                    }
-                    if (field.FieldType.StoreTermVectorOffsets)
-                    {
-                        throw new System.ArgumentException("cannot index term vector offsets when field is not indexed (field=\"" + field.Name + "\")");
-                    }
-                    if (field.FieldType.StoreTermVectorPositions)
-                    {
-                        throw new System.ArgumentException("cannot index term vector positions when field is not indexed (field=\"" + field.Name + "\")");
-                    }
-                    if (field.FieldType.StoreTermVectorPayloads)
-                    {
-                        throw new System.ArgumentException("cannot index term vector payloads when field is not indexed (field=\"" + field.Name + "\")");
-                    }
-                }
-            }
-
-            if (doVectors)
-            {
-                termsWriter.hasVectors = true;
-                if (termsHashPerField.bytesHash.Count != 0)
-                {
-                    // Only necessary if previous doc hit a
-                    // non-aborting exception while writing vectors in
-                    // this field:
-                    termsHashPerField.Reset();
-                }
-            }
-
-            // TODO: only if needed for performance
-            //perThread.postingsCount = 0;
-
-            return doVectors;
-        }
-
-        public void Abort()
-        {
-        }
-
-        /// <summary>
-        /// Called once per field per document if term vectors
-        ///  are enabled, to write the vectors to
-        ///  RAMOutputStream, which is then quickly flushed to
-        ///  the real term vectors files in the Directory. 	  /// </summary>
-        internal override void Finish()
-        {
-            if (!doVectors || termsHashPerField.bytesHash.Count == 0)
-            {
-                return;
-            }
-
-            termsWriter.AddFieldToFlush(this);
-        }
-
-        internal void FinishDocument()
-        {
-            Debug.Assert(docState.TestPoint("TermVectorsTermsWriterPerField.finish start"));
-
-            int numPostings = termsHashPerField.bytesHash.Count;
-
-            BytesRef flushTerm = termsWriter.flushTerm;
-
-            Debug.Assert(numPostings >= 0);
-
-            if (numPostings > maxNumPostings)
-            {
-                maxNumPostings = numPostings;
-            }
-
-            // this is called once, after inverting all occurrences
-            // of a given field in the doc.  At this point we flush
-            // our hash into the DocWriter.
-
-            Debug.Assert(termsWriter.VectorFieldsInOrder(fieldInfo));
-
-            TermVectorsPostingsArray postings = (TermVectorsPostingsArray)termsHashPerField.postingsArray;
-            TermVectorsWriter tv = termsWriter.writer;
-
-            int[] termIDs = termsHashPerField.SortPostings(tv.Comparer);
-
-            tv.StartField(fieldInfo, numPostings, doVectorPositions, doVectorOffsets, hasPayloads);
-
-            ByteSliceReader posReader = doVectorPositions ? termsWriter.vectorSliceReaderPos : null;
-            ByteSliceReader offReader = doVectorOffsets ? termsWriter.vectorSliceReaderOff : null;
-
-            ByteBlockPool termBytePool = termsHashPerField.termBytePool;
-
-            for (int j = 0; j < numPostings; j++)
-            {
-                int termID = termIDs[j];
-                int freq = postings.freqs[termID];
-
-                // Get BytesRef
-                termBytePool.SetBytesRef(flushTerm, postings.textStarts[termID]);
-                tv.StartTerm(flushTerm, freq);
-
-                if (doVectorPositions || doVectorOffsets)
-                {
-                    if (posReader != null)
-                    {
-                        termsHashPerField.InitReader(posReader, termID, 0);
-                    }
-                    if (offReader != null)
-                    {
-                        termsHashPerField.InitReader(offReader, termID, 1);
-                    }
-                    tv.AddProx(freq, posReader, offReader);
-                }
-                tv.FinishTerm();
-            }
-            tv.FinishField();
-
-            termsHashPerField.Reset();
-
-            fieldInfo.SetStoreTermVectors();
-        }
-
-        internal void ShrinkHash()
-        {
-            termsHashPerField.ShrinkHash(maxNumPostings);
-            maxNumPostings = 0;
-        }
-
-        internal override void Start(IIndexableField f)
-        {
-            if (doVectorOffsets)
-            {
-                offsetAttribute = fieldState.AttributeSource.AddAttribute<IOffsetAttribute>();
-            }
-            else
-            {
-                offsetAttribute = null;
-            }
-            if (doVectorPayloads && fieldState.AttributeSource.HasAttribute<IPayloadAttribute>())
-            {
-                payloadAttribute = fieldState.AttributeSource.GetAttribute<IPayloadAttribute>();
-            }
-            else
-            {
-                payloadAttribute = null;
-            }
-        }
-
-        internal void WriteProx(TermVectorsPostingsArray postings, int termID)
-        {
-            if (doVectorOffsets)
-            {
-                int startOffset = fieldState.Offset + offsetAttribute.StartOffset;
-                int endOffset = fieldState.Offset + offsetAttribute.EndOffset;
-
-                termsHashPerField.WriteVInt32(1, startOffset - postings.lastOffsets[termID]);
-                termsHashPerField.WriteVInt32(1, endOffset - startOffset);
-                postings.lastOffsets[termID] = endOffset;
-            }
-
-            if (doVectorPositions)
-            {
-                BytesRef payload;
-                if (payloadAttribute == null)
-                {
-                    payload = null;
-                }
-                else
-                {
-                    payload = payloadAttribute.Payload;
-                }
-
-                int pos = fieldState.Position - postings.lastPositions[termID];
-                if (payload != null && payload.Length > 0)
-                {
-                    termsHashPerField.WriteVInt32(0, (pos << 1) | 1);
-                    termsHashPerField.WriteVInt32(0, payload.Length);
-                    termsHashPerField.WriteBytes(0, payload.Bytes, payload.Offset, payload.Length);
-                    hasPayloads = true;
-                }
-                else
-                {
-                    termsHashPerField.WriteVInt32(0, pos << 1);
-                }
-                postings.lastPositions[termID] = fieldState.Position;
-            }
-        }
-
-        internal override void NewTerm(int termID)
-        {
-            Debug.Assert(docState.TestPoint("TermVectorsTermsWriterPerField.newTerm start"));
-            TermVectorsPostingsArray postings = (TermVectorsPostingsArray)termsHashPerField.postingsArray;
-
-            postings.freqs[termID] = 1;
-            postings.lastOffsets[termID] = 0;
-            postings.lastPositions[termID] = 0;
-
-            WriteProx(postings, termID);
-        }
-
-        internal override void AddTerm(int termID)
-        {
-            Debug.Assert(docState.TestPoint("TermVectorsTermsWriterPerField.addTerm start"));
-            TermVectorsPostingsArray postings = (TermVectorsPostingsArray)termsHashPerField.postingsArray;
-
-            postings.freqs[termID]++;
-
-            WriteProx(postings, termID);
-        }
-
-        [ExceptionToNetNumericConvention]
-        internal override void SkippingLongTerm()
-        {
-        }
-
-        internal override ParallelPostingsArray CreatePostingsArray(int size)
-        {
-            return new TermVectorsPostingsArray(size);
-        }
-
-#if FEATURE_SERIALIZABLE
-        [Serializable]
-#endif
-        internal sealed class TermVectorsPostingsArray : ParallelPostingsArray
-        {
-            public TermVectorsPostingsArray(int size)
-                : base(size)
-            {
-                freqs = new int[size];
-                lastOffsets = new int[size];
-                lastPositions = new int[size];
-            }
-
-            internal int[] freqs; // How many times this term occurred in the current doc
-            internal int[] lastOffsets; // Last offset we saw
-            internal int[] lastPositions; // Last position where this term occurred
-
-            internal override ParallelPostingsArray NewInstance(int size)
-            {
-                return new TermVectorsPostingsArray(size);
-            }
-
-            internal override void CopyTo(ParallelPostingsArray toArray, int numToCopy)
-            {
-                Debug.Assert(toArray is TermVectorsPostingsArray);
-                TermVectorsPostingsArray to = (TermVectorsPostingsArray)toArray;
-
-                base.CopyTo(toArray, numToCopy);
-
-                Array.Copy(freqs, 0, to.freqs, 0, size);
-                Array.Copy(lastOffsets, 0, to.lastOffsets, 0, size);
-                Array.Copy(lastPositions, 0, to.lastPositions, 0, size);
-            }
-
-            internal override int BytesPerPosting()
-            {
-                return base.BytesPerPosting() + 3 * RamUsageEstimator.NUM_BYTES_INT32;
-            }
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Index/Terms.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/Terms.cs b/src/Lucene.Net.Core/Index/Terms.cs
deleted file mode 100644
index 215a505..0000000
--- a/src/Lucene.Net.Core/Index/Terms.cs
+++ /dev/null
@@ -1,175 +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.
-     */
-
-    using BytesRef = Lucene.Net.Util.BytesRef;
-    using CompiledAutomaton = Lucene.Net.Util.Automaton.CompiledAutomaton;
-
-    /// <summary>
-    /// Access to the terms in a specific field.  See <seealso cref="Fields"/>.
-    /// @lucene.experimental
-    /// </summary>
-#if FEATURE_SERIALIZABLE
-    [Serializable]
-#endif
-    public abstract class Terms
-    {
-        /// <summary>
-        /// Sole constructor. (For invocation by subclass
-        ///  constructors, typically implicit.)
-        /// </summary>
-        protected Terms()
-        {
-        }
-
-        /// <summary>
-        /// Returns an iterator that will step through all
-        ///  terms. this method will not return null.  If you have
-        ///  a previous TermsEnum, for example from a different
-        ///  field, you can pass it for possible reuse if the
-        ///  implementation can do so.
-        /// </summary>
-        public abstract TermsEnum GetIterator(TermsEnum reuse);
-
-        /// <summary>
-        /// Returns a TermsEnum that iterates over all terms that
-        ///  are accepted by the provided {@link
-        ///  CompiledAutomaton}.  If the <code>startTerm</code> is
-        ///  provided then the returned enum will only accept terms
-        ///  > <code>startTerm</code>, but you still must call
-        ///  next() first to get to the first term.  Note that the
-        ///  provided <code>startTerm</code> must be accepted by
-        ///  the automaton.
-        ///
-        /// <p><b>NOTE</b>: the returned TermsEnum cannot
-        /// seek</p>.
-        /// </summary>
-        public virtual TermsEnum Intersect(CompiledAutomaton compiled, BytesRef startTerm)
-        {
-            // TODO: eventually we could support seekCeil/Exact on
-            // the returned enum, instead of only being able to seek
-            // at the start
-            if (compiled.Type != CompiledAutomaton.AUTOMATON_TYPE.NORMAL)
-            {
-                throw new System.ArgumentException("please use CompiledAutomaton.getTermsEnum instead");
-            }
-            if (startTerm == null)
-            {
-                return new AutomatonTermsEnum(GetIterator(null), compiled);
-            }
-            else
-            {
-                return new AutomatonTermsEnumAnonymousInnerClassHelper(this, GetIterator(null), compiled, startTerm);
-            }
-        }
-
-        private class AutomatonTermsEnumAnonymousInnerClassHelper : AutomatonTermsEnum
-        {
-            private readonly Terms outerInstance;
-
-            private BytesRef startTerm;
-
-            public AutomatonTermsEnumAnonymousInnerClassHelper(Terms outerInstance, Lucene.Net.Index.TermsEnum iterator, CompiledAutomaton compiled, BytesRef startTerm)
-                : base(iterator, compiled)
-            {
-                this.outerInstance = outerInstance;
-                this.startTerm = startTerm;
-            }
-
-            protected override BytesRef NextSeekTerm(BytesRef term)
-            {
-                if (term == null)
-                {
-                    term = startTerm;
-                }
-                return base.NextSeekTerm(term);
-            }
-        }
-
-        /// <summary>
-        /// Return the BytesRef Comparer used to sort terms
-        ///  provided by the iterator.  this method may return null
-        ///  if there are no terms.  this method may be invoked
-        ///  many times; it's best to cache a single instance &
-        ///  reuse it.
-        /// </summary>
-        public abstract IComparer<BytesRef> Comparer { get; }
-
-        /// <summary>
-        /// Returns the number of terms for this field, or -1 if this
-        /// measure isn't stored by the codec. Note that, just like
-        /// other term measures, this measure does not take deleted
-        /// documents into account.
-        /// NOTE: This was size() in Lucene.
-        /// </summary>
-        public abstract long Count { get; }
-
-        /// <summary>
-        /// Returns the sum of <seealso cref="TermsEnum#totalTermFreq"/> for
-        ///  all terms in this field, or -1 if this measure isn't
-        ///  stored by the codec (or if this fields omits term freq
-        ///  and positions).  Note that, just like other term
-        ///  measures, this measure does not take deleted documents
-        ///  into account.
-        /// </summary>
-        public abstract long SumTotalTermFreq { get; }
-
-        /// <summary>
-        /// Returns the sum of <seealso cref="TermsEnum#docFreq()"/> for
-        ///  all terms in this field, or -1 if this measure isn't
-        ///  stored by the codec.  Note that, just like other term
-        ///  measures, this measure does not take deleted documents
-        ///  into account.
-        /// </summary>
-        public abstract long SumDocFreq { get; }
-
-        /// <summary>
-        /// Returns the number of documents that have at least one
-        ///  term for this field, or -1 if this measure isn't
-        ///  stored by the codec.  Note that, just like other term
-        ///  measures, this measure does not take deleted documents
-        ///  into account.
-        /// </summary>
-        public abstract int DocCount { get; }
-
-        /// <summary>
-        /// Returns true if documents in this field store
-        ///  per-document term frequency (<seealso cref="DocsEnum#freq"/>).
-        /// </summary>
-        public abstract bool HasFreqs { get; }
-
-        /// <summary>
-        /// Returns true if documents in this field store offsets. </summary>
-        public abstract bool HasOffsets { get; }
-
-        /// <summary>
-        /// Returns true if documents in this field store positions. </summary>
-        public abstract bool HasPositions { get; }
-
-        /// <summary>
-        /// Returns true if documents in this field store payloads. </summary>
-        public abstract bool HasPayloads { get; }
-
-        /// <summary>
-        /// Zero-length array of <seealso cref="Terms"/>. </summary>
-        public static readonly Terms[] EMPTY_ARRAY = new Terms[0];
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5dc68d0/src/Lucene.Net.Core/Index/TermsEnum.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/TermsEnum.cs b/src/Lucene.Net.Core/Index/TermsEnum.cs
deleted file mode 100644
index 41733c5..0000000
--- a/src/Lucene.Net.Core/Index/TermsEnum.cs
+++ /dev/null
@@ -1,360 +0,0 @@
-using Lucene.Net.Util;
-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 AttributeSource = Lucene.Net.Util.AttributeSource;
-    using IBits = Lucene.Net.Util.IBits;
-    using BytesRef = Lucene.Net.Util.BytesRef;
-
-    /// <summary>
-    /// Iterator to seek (<see cref="SeekCeil(BytesRef)"/>, 
-    /// <see cref="SeekExact(BytesRef)"/>) or step through 
-    /// (<see cref="Next"/> terms to obtain frequency information 
-    /// (<see cref="DocFreq"/>), <see cref="DocsEnum"/> or 
-    /// <see cref="DocsAndPositionsEnum"/> for the current term 
-    /// (<see cref="Docs"/>).
-    ///
-    /// <para/>Term enumerations are always ordered by
-    /// <see cref="Comparer"/>.  Each term in the enumeration is
-    /// greater than the one before it.
-    ///
-    /// <para/>The <see cref="TermsEnum"/> is unpositioned when you first obtain it
-    /// and you must first successfully call <see cref="Next"/> or one
-    /// of the <c>Seek</c> methods.
-    ///
-    /// @lucene.experimental
-    /// </summary>
-#if FEATURE_SERIALIZABLE
-    [Serializable]
-#endif
-    public abstract class TermsEnum : IBytesRefIterator
-    {
-        public abstract IComparer<BytesRef> Comparer { get; } // LUCENENET specific - must supply implementation for the interface
-
-        public abstract BytesRef Next(); // LUCENENET specific - must supply implementation for the interface
-
-        private AttributeSource atts = null;
-
-        /// <summary>
-        /// Sole constructor. (For invocation by subclass
-        /// constructors, typically implicit.)
-        /// </summary>
-        protected TermsEnum()
-        {
-        }
-
-        /// <summary>
-        /// Returns the related attributes. </summary>
-        public virtual AttributeSource Attributes
-        {
-            get
-            {
-                if (atts == null)
-                {
-                    atts = new AttributeSource();
-                }
-                return atts;
-            }
-        }
-
-        /// <summary>
-        /// Represents returned result from <see cref="SeekCeil(BytesRef)"/>. </summary>
-        public enum SeekStatus
-        {
-            /// <summary>
-            /// The term was not found, and the end of iteration was hit. </summary>
-            END,
-
-            /// <summary>
-            /// The precise term was found. </summary>
-            FOUND,
-
-            /// <summary>
-            /// A different term was found after the requested term </summary>
-            NOT_FOUND
-        }
-
-        /// <summary>
-        /// Attempts to seek to the exact term, returning
-        /// true if the term is found.  If this returns false, the
-        /// enum is unpositioned.  For some codecs, <see cref="SeekExact"/> may
-        /// be substantially faster than <see cref="SeekCeil"/>.
-        /// </summary>
-        public virtual bool SeekExact(BytesRef text)
-        {
-            return SeekCeil(text) == SeekStatus.FOUND;
-        }
-
-        /// <summary>
-        /// Seeks to the specified term, if it exists, or to the
-        /// next (ceiling) term.  Returns <see cref="SeekStatus"/> to
-        /// indicate whether exact term was found, a different
-        /// term was found, or EOF was hit.  The target term may
-        /// be before or after the current term.  If this returns
-        /// <see cref="SeekStatus.END"/>, the enum is unpositioned.
-        /// </summary>
-        public abstract SeekStatus SeekCeil(BytesRef text);
-
-        /// <summary>
-        /// Seeks to the specified term by ordinal (position) as
-        /// previously returned by <see cref="Ord"/>. The target <paramref name="ord"/>
-        /// may be before or after the current ord, and must be
-        /// within bounds.
-        /// </summary>
-        public abstract void SeekExact(long ord);
-
-        /// <summary>
-        /// Expert: Seeks a specific position by <see cref="TermState"/> previously obtained
-        /// from <see cref="GetTermState()"/>. Callers should maintain the <see cref="TermState"/> to
-        /// use this method. Low-level implementations may position the <see cref="TermsEnum"/>
-        /// without re-seeking the term dictionary.
-        /// <para/>
-        /// Seeking by <see cref="TermState"/> should only be used iff the state was obtained
-        /// from the same <see cref="TermsEnum"/> instance.
-        /// <para/>
-        /// NOTE: Using this method with an incompatible <see cref="TermState"/> might leave
-        /// this <see cref="TermsEnum"/> in undefined state. On a segment level
-        /// <see cref="TermState"/> instances are compatible only iff the source and the
-        /// target <see cref="TermsEnum"/> operate on the same field. If operating on segment
-        /// level, TermState instances must not be used across segments.
-        /// <para/>
-        /// NOTE: A seek by <see cref="TermState"/> might not restore the
-        /// <see cref="AttributeSource"/>'s state. <see cref="AttributeSource"/> states must be
-        /// maintained separately if this method is used. </summary>
-        /// <param name="term"> the term the <see cref="TermState"/> corresponds to </param>
-        /// <param name="state"> the <see cref="TermState"/> </param>
-        public virtual void SeekExact(BytesRef term, TermState state)
-        {
-            if (!SeekExact(term))
-            {
-                throw new System.ArgumentException("term=" + term + " does not exist");
-            }
-        }
-
-        /// <summary>
-        /// Returns current term. Do not call this when the enum
-        /// is unpositioned.
-        /// </summary>
-        public abstract BytesRef Term { get; }
-
-        /// <summary>
-        /// Returns ordinal position for current term.  this is an
-        /// optional method (the codec may throw <see cref="NotSupportedException"/>.
-        /// Do not call this when the enum is unpositioned.
-        /// </summary>
-        public abstract long Ord { get; } // LUCENENET NOTE: Although this isn't a great candidate for a property, did so to make API consistent
-
-        /// <summary>
-        /// Returns the number of documents containing the current
-        /// term.  Do not call this when the enum is unpositioned.
-        /// </summary>
-        /// <seealso cref="SeekStatus.END"/>
-        public abstract int DocFreq { get; } // LUCENENET NOTE: Although this isn't a great candidate for a property, did so to make API consistent
-
-        /// <summary>
-        /// Returns the total number of occurrences of this term
-        ///  across all documents (the sum of the freq() for each
-        ///  doc that has this term).  this will be -1 if the
-        ///  codec doesn't support this measure.  Note that, like
-        ///  other term measures, this measure does not take
-        ///  deleted documents into account.
-        /// </summary>
-        public abstract long TotalTermFreq { get; } // LUCENENET NOTE: Although this isn't a great candidate for a property, did so to make API consistent
-
-        /// <summary>
-        /// Get <see cref="DocsEnum"/> for the current term. Do not
-        /// call this when the enum is unpositioned. This method
-        /// will not return null.
-        /// </summary>
-        /// <param name="liveDocs"> unset bits are documents that should not
-        /// be returned </param>
-        /// <param name="reuse"> pass a prior <see cref="DocsEnum"/> for possible reuse  </param>
-        public DocsEnum Docs(IBits liveDocs, DocsEnum reuse)
-        {
-            return Docs(liveDocs, reuse, DocsFlags.FREQS);
-        }
-
-        /// <summary>
-        /// Get <see cref="DocsEnum"/> for the current term, with
-        /// control over whether freqs are required. Do not
-        /// call this when the enum is unpositioned. This method
-        /// will not return null.
-        /// </summary>
-        /// <param name="liveDocs"> unset bits are documents that should not
-        /// be returned </param>
-        /// <param name="reuse"> pass a prior DocsEnum for possible reuse </param>
-        /// <param name="flags"> specifies which optional per-document values
-        ///        you require; <see cref="DocsFlags"/></param>
-        /// <seealso cref="Docs(IBits, DocsEnum)"/>
-        public abstract DocsEnum Docs(IBits liveDocs, DocsEnum reuse, DocsFlags flags);
-
-        /// <summary>
-        /// Get <seealso cref="DocsAndPositionsEnum"/> for the current term.
-        ///  Do not call this when the enum is unpositioned.  this
-        ///  method will return null if positions were not
-        ///  indexed.
-        /// </summary>
-        ///  <param name="liveDocs"> unset bits are documents that should not
-        ///  be returned </param>
-        ///  <param name="reuse"> pass a prior DocsAndPositionsEnum for possible reuse </param>
-        ///  <seealso cref= #docsAndPositions(Bits, DocsAndPositionsEnum, int)  </seealso>
-        public DocsAndPositionsEnum DocsAndPositions(IBits liveDocs, DocsAndPositionsEnum reuse)
-        {
-            return DocsAndPositions(liveDocs, reuse, DocsAndPositionsFlags.OFFSETS | DocsAndPositionsFlags.PAYLOADS);
-        }
-
-        /// <summary>
-        /// Get <see cref="DocsAndPositionsEnum"/> for the current term,
-        /// with control over whether offsets and payloads are
-        /// required.  Some codecs may be able to optimize their
-        /// implementation when offsets and/or payloads are not required.
-        /// Do not call this when the enum is unpositioned. This
-        /// will return null if positions were not indexed.
-        /// </summary>
-        /// <param name="liveDocs"> unset bits are documents that should not
-        /// be returned </param>
-        /// <param name="reuse"> pass a prior DocsAndPositionsEnum for possible reuse </param>
-        /// <param name="flags"> specifies which optional per-position values you
-        ///         require; see <see cref="DocsAndPositionsFlags"/>. </param>
-        public abstract DocsAndPositionsEnum DocsAndPositions(IBits liveDocs, DocsAndPositionsEnum reuse, DocsAndPositionsFlags flags);
-
-        /// <summary>
-        /// Expert: Returns the TermsEnums internal state to position the <see cref="TermsEnum"/>
-        /// without re-seeking the term dictionary.
-        /// <para/>
-        /// NOTE: A seek by <see cref="GetTermState"/> might not capture the
-        /// <see cref="AttributeSource"/>'s state. Callers must maintain the
-        /// <see cref="AttributeSource"/> states separately
-        /// </summary>
-        /// <seealso cref="TermState"/>
-        /// <seealso cref="SeekExact(BytesRef, TermState)"/>
-        public virtual TermState GetTermState() // LUCENENET NOTE: Renamed from TermState()
-        {
-            return new TermStateAnonymousInnerClassHelper(this);
-        }
-
-        private class TermStateAnonymousInnerClassHelper : TermState
-        {
-            private readonly TermsEnum outerInstance;
-
-            public TermStateAnonymousInnerClassHelper(TermsEnum outerInstance)
-            {
-                this.outerInstance = outerInstance;
-            }
-
-            public override void CopyFrom(TermState other)
-            {
-                throw new System.NotSupportedException();
-            }
-        }
-
-        /// <summary>
-        /// An empty <see cref="TermsEnum"/> for quickly returning an empty instance e.g.
-        /// in <see cref="Lucene.Net.Search.MultiTermQuery"/>
-        /// <para/><em>Please note:</em> this enum should be unmodifiable,
-        /// but it is currently possible to add Attributes to it.
-        /// this should not be a problem, as the enum is always empty and
-        /// the existence of unused Attributes does not matter.
-        /// </summary>
-        public static readonly TermsEnum EMPTY = new TermsEnumAnonymousInnerClassHelper();
-
-        private class TermsEnumAnonymousInnerClassHelper : TermsEnum
-        {
-            public TermsEnumAnonymousInnerClassHelper()
-            {
-            }
-
-            public override SeekStatus SeekCeil(BytesRef term)
-            {
-                return SeekStatus.END;
-            }
-
-            public override void SeekExact(long ord)
-            {
-            }
-
-            public override BytesRef Term
-            {
-                get { throw new InvalidOperationException("this method should never be called"); }
-            }
-
-            public override IComparer<BytesRef> Comparer
-            {
-                get
-                {
-                    return null;
-                }
-            }
-
-            public override int DocFreq
-            {
-                get { throw new InvalidOperationException("this method should never be called"); }
-            }
-
-            public override long TotalTermFreq
-            {
-                get { throw new InvalidOperationException("this method should never be called"); }
-            }
-
-            public override long Ord
-            {
-                get { throw new InvalidOperationException("this method should never be called"); }
-            }
-
-            public override DocsEnum Docs(IBits liveDocs, DocsEnum reuse, DocsFlags flags)
-            {
-                throw new InvalidOperationException("this method should never be called");
-            }
-
-            public override DocsAndPositionsEnum DocsAndPositions(IBits liveDocs, DocsAndPositionsEnum reuse, DocsAndPositionsFlags flags)
-            {
-                throw new InvalidOperationException("this method should never be called");
-            }
-
-            public override BytesRef Next()
-            {
-                return null;
-            }
-
-            public override AttributeSource Attributes // make it synchronized here, to prevent double lazy init
-            {
-                get
-                {
-                    lock (this)
-                    {
-                        return base.Attributes;
-                    }
-                }
-            }
-
-            public override TermState GetTermState()
-            {
-                throw new InvalidOperationException("this method should never be called");
-            }
-
-            public override void SeekExact(BytesRef term, TermState state)
-            {
-                throw new InvalidOperationException("this method should never be called");
-            }
-        }
-    }
-}
\ No newline at end of file


Mime
View raw message