lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [5/7] .NETification
Date Tue, 16 Sep 2014 20:20:53 GMT
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Index/ParallelCompositeReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/ParallelCompositeReader.cs b/src/Lucene.Net.Core/Index/ParallelCompositeReader.cs
index c52292a..2db3861 100644
--- a/src/Lucene.Net.Core/Index/ParallelCompositeReader.cs
+++ b/src/Lucene.Net.Core/Index/ParallelCompositeReader.cs
@@ -107,13 +107,13 @@ namespace Lucene.Net.Index
                 IList<IndexReader> firstSubReaders = readers[0].GetSequentialSubReaders();
 
                 // check compatibility:
-                int maxDoc = readers[0].MaxDoc(), noSubs = firstSubReaders.Count;
+                int maxDoc = readers[0].MaxDoc, noSubs = firstSubReaders.Count;
                 int[] childMaxDoc = new int[noSubs];
                 bool[] childAtomic = new bool[noSubs];
                 for (int i = 0; i < noSubs; i++)
                 {
                     IndexReader r = firstSubReaders[i];
-                    childMaxDoc[i] = r.MaxDoc();
+                    childMaxDoc[i] = r.MaxDoc;
                     childAtomic[i] = r is AtomicReader;
                 }
                 Validate(readers, maxDoc, childMaxDoc, childAtomic);
@@ -191,9 +191,9 @@ namespace Lucene.Net.Index
             {
                 CompositeReader reader = readers[i];
                 IList<IndexReader> subs = reader.GetSequentialSubReaders();
-                if (reader.MaxDoc() != maxDoc)
+                if (reader.MaxDoc != maxDoc)
                 {
-                    throw new System.ArgumentException("All readers must have same maxDoc: " + maxDoc + "!=" + reader.MaxDoc());
+                    throw new System.ArgumentException("All readers must have same maxDoc: " + maxDoc + "!=" + reader.MaxDoc);
                 }
                 int noSubs = subs.Count;
                 if (noSubs != childMaxDoc.Length)
@@ -203,7 +203,7 @@ namespace Lucene.Net.Index
                 for (int subIDX = 0; subIDX < noSubs; subIDX++)
                 {
                     IndexReader r = subs[subIDX];
-                    if (r.MaxDoc() != childMaxDoc[subIDX])
+                    if (r.MaxDoc != childMaxDoc[subIDX])
                     {
                         throw new System.ArgumentException("All readers must have same corresponding subReader maxDoc");
                     }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Index/ReadersAndUpdates.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/ReadersAndUpdates.cs b/src/Lucene.Net.Core/Index/ReadersAndUpdates.cs
index d1026af..a779eab 100644
--- a/src/Lucene.Net.Core/Index/ReadersAndUpdates.cs
+++ b/src/Lucene.Net.Core/Index/ReadersAndUpdates.cs
@@ -671,7 +671,7 @@ namespace Lucene.Net.Index
 
         private IEnumerable<long> GetLongEnumerable(SegmentReader reader, string field, NumericDocValuesFieldUpdates fieldUpdates)
         {
-            int maxDoc = reader.MaxDoc();
+            int maxDoc = reader.MaxDoc;
             Bits DocsWithField = reader.GetDocsWithField(field);
             NumericDocValues currentValues = reader.GetNumericDocValues(field);
             NumericDocValuesFieldUpdates.Iterator iter = (NumericDocValuesFieldUpdates.Iterator)fieldUpdates.GetIterator();
@@ -704,8 +704,8 @@ namespace Lucene.Net.Index
         {
             BinaryDocValues currentValues = reader.GetBinaryDocValues(field);
             Bits DocsWithField = reader.GetDocsWithField(field);
-            int maxDoc = reader.MaxDoc();
-            BinaryDocValuesFieldUpdates.Iterator iter = (BinaryDocValuesFieldUpdates.Iterator)fieldUpdates.GetIterator();
+            int maxDoc = reader.MaxDoc;
+            var iter = (BinaryDocValuesFieldUpdates.Iterator)fieldUpdates.GetIterator();
             BytesRef scratch = new BytesRef();
             int updateDoc = iter.NextDoc();
 
@@ -750,7 +750,7 @@ namespace Lucene.Net.Index
 			  this.FieldUpdates = fieldUpdates;
 			  currentValues = reader.GetNumericDocValues(field);
 			  docsWithField = reader.GetDocsWithField(field);
-			  maxDoc = reader.MaxDoc();
+			  maxDoc = reader.MaxDoc;
 			  updatesIter = fieldUpdates.Iterator();
 		  }
 
@@ -834,7 +834,7 @@ namespace Lucene.Net.Index
 			  this.DvFieldUpdates = dvFieldUpdates;
 			  currentValues = reader.GetBinaryDocValues(field);
 			  docsWithField = reader.GetDocsWithField(field);
-			  maxDoc = reader.MaxDoc();
+			  maxDoc = reader.MaxDoc;
 			  updatesIter = dvFieldUpdates.Iterator();
 		  }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Index/SegmentMerger.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/SegmentMerger.cs b/src/Lucene.Net.Core/Index/SegmentMerger.cs
index f8893bf..bb7e444 100644
--- a/src/Lucene.Net.Core/Index/SegmentMerger.cs
+++ b/src/Lucene.Net.Core/Index/SegmentMerger.cs
@@ -197,7 +197,7 @@ namespace Lucene.Net.Index
                                 if (values == null)
                                 {
                                     values = DocValues.EMPTY_NUMERIC;
-                                    bits = new Lucene.Net.Util.Bits_MatchNoBits(reader.MaxDoc());
+                                    bits = new Lucene.Net.Util.Bits_MatchNoBits(reader.MaxDoc);
                                 }
                                 toMerge.Add(values);
                                 //docsWithField.Add(bits);
@@ -215,7 +215,7 @@ namespace Lucene.Net.Index
                                 if (values == null)
                                 {
                                     values = DocValues.EMPTY_BINARY;
-                                    bits = new Lucene.Net.Util.Bits_MatchNoBits(reader.MaxDoc());
+                                    bits = new Lucene.Net.Util.Bits_MatchNoBits(reader.MaxDoc);
                                 }
                                 toMerge.Add(values);
                                 //docsWithField.Add(bits);
@@ -291,7 +291,7 @@ namespace Lucene.Net.Index
                                 norms = DocValues.EMPTY_NUMERIC;
                             }
                             toMerge.Add(norms);
-                            //docsWithField.Add(new Lucene.Net.Util.Bits_MatchAllBits(reader.MaxDoc()));
+                            //docsWithField.Add(new Lucene.Net.Util.Bits_MatchAllBits(reader.MaxDoc));
                         }
                         consumer.MergeNumericField(field, MergeState, toMerge/*, docsWithField*/);
                     }
@@ -430,7 +430,7 @@ namespace Lucene.Net.Index
                 MergeState.DocBase[i] = docBase;
                 MergeState.DocMap docMap = MergeState.DocMap.Build(reader);
                 MergeState.DocMaps[i] = docMap;
-                docBase += docMap.NumDocs();
+                docBase += docMap.NumDocs;
 
                 i++;
             }
@@ -448,8 +448,8 @@ namespace Lucene.Net.Index
             for (int readerIndex = 0; readerIndex < MergeState.Readers.Count; readerIndex++)
             {
                 AtomicReader reader = MergeState.Readers[readerIndex];
-                Fields f = reader.Fields();
-                int maxDoc = reader.MaxDoc();
+                Fields f = reader.Fields;
+                int maxDoc = reader.MaxDoc;
                 if (f != null)
                 {
                     slices.Add(new ReaderSlice(docBase, maxDoc, readerIndex));

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Index/SegmentReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/SegmentReader.cs b/src/Lucene.Net.Core/Index/SegmentReader.cs
index bf9aef7..7b417b4 100644
--- a/src/Lucene.Net.Core/Index/SegmentReader.cs
+++ b/src/Lucene.Net.Core/Index/SegmentReader.cs
@@ -53,7 +53,7 @@ namespace Lucene.Net.Index
         // Normally set to si.docCount - si.delDocCount, unless we
         // were created as an NRT reader from IW, in which case IW
         // tells us the docCount:
-        private readonly int NumDocs_Renamed;
+        private readonly int numDocs;
 
         internal readonly SegmentCoreReaders Core;
         internal readonly SegmentDocValues SegDocValues;
@@ -125,7 +125,7 @@ namespace Lucene.Net.Index
                     Debug.Assert(si.DelCount == 0);
                     LiveDocs_Renamed = null;
                 }
-                NumDocs_Renamed = si.Info.DocCount - si.DelCount;
+                numDocs = si.Info.DocCount - si.DelCount;
 
                 if (FieldInfos_Renamed.HasDocValues())
                 {
@@ -168,7 +168,7 @@ namespace Lucene.Net.Index
         {
             this.Si = si;
             this.LiveDocs_Renamed = liveDocs;
-            this.NumDocs_Renamed = numDocs;
+            this.numDocs = numDocs;
             this.Core = sr.Core;
             Core.IncRef();
             this.SegDocValues = sr.SegDocValues;
@@ -351,22 +351,31 @@ namespace Lucene.Net.Index
             FieldsReader.VisitDocument(docID, visitor);
         }
 
-        public override Fields Fields()
+        public override Fields Fields
         {
-            EnsureOpen();
-            return Core.Fields;
+            get
+            {
+                EnsureOpen();
+                return Core.Fields;
+            }
         }
 
-        public override int NumDocs()
+        public override int NumDocs
         {
-            // Don't call ensureOpen() here (it could affect performance)
-            return NumDocs_Renamed;
+            get
+            {
+                // Don't call ensureOpen() here (it could affect performance)
+                return numDocs;
+            }
         }
 
-        public override int MaxDoc()
+        public override int MaxDoc
         {
-            // Don't call ensureOpen() here (it could affect performance)
-            return Si.Info.DocCount;
+            get
+            {
+                // Don't call ensureOpen() here (it could affect performance)
+                return Si.Info.DocCount;
+            }
         }
 
         /// <summary>
@@ -396,9 +405,9 @@ namespace Lucene.Net.Index
 
         private void CheckBounds(int docID)
         {
-            if (docID < 0 || docID >= MaxDoc())
+            if (docID < 0 || docID >= MaxDoc)
             {
-                throw new System.IndexOutOfRangeException("docID must be >= 0 and < maxDoc=" + MaxDoc() + " (got docID=" + docID + ")");
+                throw new System.IndexOutOfRangeException("docID must be >= 0 and < maxDoc=" + MaxDoc + " (got docID=" + docID + ")");
             }
         }
 
@@ -406,7 +415,7 @@ namespace Lucene.Net.Index
         {
             // SegmentInfo.toString takes dir and number of
             // *pending* deletions; so we reverse compute that here:
-            return Si.ToString(Si.Info.Dir, Si.Info.DocCount - NumDocs_Renamed - Si.DelCount);
+            return Si.ToString(Si.Info.Dir, Si.Info.DocCount - numDocs - Si.DelCount);
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Index/SlowCompositeReaderWrapper.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/SlowCompositeReaderWrapper.cs b/src/Lucene.Net.Core/Index/SlowCompositeReaderWrapper.cs
index 9a6920f..cab9e74 100644
--- a/src/Lucene.Net.Core/Index/SlowCompositeReaderWrapper.cs
+++ b/src/Lucene.Net.Core/Index/SlowCompositeReaderWrapper.cs
@@ -81,10 +81,13 @@ namespace Lucene.Net.Index
             return "SlowCompositeReaderWrapper(" + @in + ")";
         }
 
-        public override Fields Fields()
+        public override Fields Fields
         {
-            EnsureOpen();
-            return fields;
+            get
+            {
+                EnsureOpen();
+                return fields;
+            }
         }
 
         public override NumericDocValues GetNumericDocValues(string field)
@@ -132,17 +135,17 @@ namespace Lucene.Net.Index
             {
                 return null;
             }
-            int size = @in.Leaves().Count;
+            int size = @in.Leaves.Count;
             SortedDocValues[] values = new SortedDocValues[size];
             int[] starts = new int[size + 1];
             for (int i = 0; i < size; i++)
             {
-                AtomicReaderContext context = @in.Leaves()[i];
+                AtomicReaderContext context = @in.Leaves[i];
                 SortedDocValues v = context.AtomicReader.GetSortedDocValues(field) ?? DocValues.EMPTY_SORTED;
                 values[i] = v;
                 starts[i] = context.DocBase;
             }
-            starts[size] = MaxDoc();
+            starts[size] = MaxDoc;
             return new MultiSortedDocValues(values, starts, map);
         }
 
@@ -174,17 +177,17 @@ namespace Lucene.Net.Index
                 return null;
             }
             Debug.Assert(map != null);
-            int size = @in.Leaves().Count;
-            SortedSetDocValues[] values = new SortedSetDocValues[size];
+            int size = @in.Leaves.Count;
+            var values = new SortedSetDocValues[size];
             int[] starts = new int[size + 1];
             for (int i = 0; i < size; i++)
             {
-                AtomicReaderContext context = @in.Leaves()[i];
+                AtomicReaderContext context = @in.Leaves[i];
                 SortedSetDocValues v = context.AtomicReader.GetSortedSetDocValues(field) ?? DocValues.EMPTY_SORTED_SET;
                 values[i] = v;
                 starts[i] = context.DocBase;
             }
-            starts[size] = MaxDoc();
+            starts[size] = MaxDoc;
             return new MultiSortedSetDocValues(values, starts, map);
         }
 
@@ -204,16 +207,22 @@ namespace Lucene.Net.Index
             return @in.GetTermVectors(docID);
         }
 
-        public override int NumDocs()
+        public override int NumDocs
         {
-            // Don't call ensureOpen() here (it could affect performance)
-            return @in.NumDocs();
+            get
+            {
+                // Don't call ensureOpen() here (it could affect performance)
+                return @in.NumDocs;
+            }
         }
 
-        public override int MaxDoc()
+        public override int MaxDoc
         {
-            // Don't call ensureOpen() here (it could affect performance)
-            return @in.MaxDoc();
+            get
+            {
+                // Don't call ensureOpen() here (it could affect performance)
+                return @in.MaxDoc;
+            }
         }
 
         public override void Document(int docID, StoredFieldVisitor visitor)
@@ -265,7 +274,7 @@ namespace Lucene.Net.Index
         public override void CheckIntegrity()
         {
             EnsureOpen();
-            foreach (AtomicReaderContext ctx in @in.Leaves())
+            foreach (AtomicReaderContext ctx in @in.Leaves)
             {
                 ctx.AtomicReader.CheckIntegrity();
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Index/StandardDirectoryReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/StandardDirectoryReader.cs b/src/Lucene.Net.Core/Index/StandardDirectoryReader.cs
index 586a8cd..c256d7b 100644
--- a/src/Lucene.Net.Core/Index/StandardDirectoryReader.cs
+++ b/src/Lucene.Net.Core/Index/StandardDirectoryReader.cs
@@ -124,7 +124,7 @@ namespace Lucene.Net.Index
                     try
                     {
                         SegmentReader reader = rld.GetReadOnlyClone(IOContext.READ);
-                        if (reader.NumDocs() > 0 || writer.KeepFullyDeletedSegments)
+                        if (reader.NumDocs > 0 || writer.KeepFullyDeletedSegments)
                         {
                             // Steal the ref:
                             readers.Add(reader);
@@ -240,7 +240,7 @@ namespace Lucene.Net.Index
                             if (newReaders[i].SegmentInfo.DelGen == infos.Info(i).DelGen)
                             {
                                 // only DV updates
-                                newReaders[i] = new SegmentReader(infos.Info(i), newReaders[i], newReaders[i].LiveDocs, newReaders[i].NumDocs());
+                                newReaders[i] = new SegmentReader(infos.Info(i), newReaders[i], newReaders[i].LiveDocs, newReaders[i].NumDocs);
                             }
                             else
                             {
@@ -592,7 +592,7 @@ namespace Lucene.Net.Index
 
             public override void Delete()
             {
-                throw new System.NotSupportedException("this IndexCommit does not support deletions");
+                throw new NotSupportedException("this IndexCommit does not support deletions");
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/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
index 7ce0ba3..bb4b275 100644
--- a/src/Lucene.Net.Core/Index/TermContext.cs
+++ b/src/Lucene.Net.Core/Index/TermContext.cs
@@ -58,13 +58,13 @@ namespace Lucene.Net.Index
             TopReaderContext = context;
             docFreq = 0;
             int len;
-            if (context.Leaves() == null)
+            if (context.Leaves == null)
             {
                 len = 1;
             }
             else
             {
-                len = context.Leaves().Count;
+                len = context.Leaves.Count;
             }
             States = new TermState[len];
         }
@@ -94,10 +94,10 @@ namespace Lucene.Net.Index
             BytesRef bytes = term.Bytes();
             TermContext perReaderTermState = new TermContext(context);
             //if (DEBUG) System.out.println("prts.build term=" + term);
-            foreach (AtomicReaderContext ctx in context.Leaves())
+            foreach (AtomicReaderContext ctx in context.Leaves)
             {
                 //if (DEBUG) System.out.println("  r=" + leaves[i].reader);
-                Fields fields = ctx.AtomicReader.Fields();
+                Fields fields = ctx.AtomicReader.Fields;
                 if (fields != null)
                 {
                     Terms terms = fields.Terms(field);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Search/BooleanQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/BooleanQuery.cs b/src/Lucene.Net.Core/Search/BooleanQuery.cs
index d3e2aa7..155d56f 100644
--- a/src/Lucene.Net.Core/Search/BooleanQuery.cs
+++ b/src/Lucene.Net.Core/Search/BooleanQuery.cs
@@ -310,7 +310,7 @@ namespace Lucene.Net.Search
                     Weight w = wIter.Current;
                     cIter.MoveNext();
                     BooleanClause c = cIter.Current;
-                    if (w.Scorer(context, ((AtomicReader)context.Reader()).LiveDocs) == null)
+                    if (w.Scorer(context, context.AtomicReader.LiveDocs) == null)
                     {
                         if (c.Required)
                         {
@@ -481,7 +481,7 @@ namespace Lucene.Net.Search
                 // simple disjunction
                 if (required.Count == 0 && prohibited.Count == 0 && OuterInstance.MinNrShouldMatch <= 1 && optional.Count > 1)
                 {
-                    float[] coord = new float[optional.Count + 1];
+                    var coord = new float[optional.Count + 1];
                     for (int i = 0; i < coord.Length; i++)
                     {
                         coord[i] = DisableCoord ? 1.0f : Coord(i, maxCoord);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Search/CachingWrapperFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/CachingWrapperFilter.cs b/src/Lucene.Net.Core/Search/CachingWrapperFilter.cs
index 14bf937..2f2acca 100644
--- a/src/Lucene.Net.Core/Search/CachingWrapperFilter.cs
+++ b/src/Lucene.Net.Core/Search/CachingWrapperFilter.cs
@@ -101,7 +101,7 @@ namespace Lucene.Net.Search
         /// </summary>
         protected internal virtual DocIdSet CacheImpl(DocIdSetIterator iterator, AtomicReader reader)
         {
-            WAH8DocIdSet.Builder builder = new WAH8DocIdSet.Builder();
+            var builder = new WAH8DocIdSet.Builder();
             builder.Add(iterator);
             return builder.Build();
         }
@@ -111,7 +111,7 @@ namespace Lucene.Net.Search
 
         public override DocIdSet GetDocIdSet(AtomicReaderContext context, Bits acceptDocs)
         {
-            AtomicReader reader = (AtomicReader)context.Reader();
+            var reader = context.AtomicReader;
             object key = reader.CoreCacheKey;
 
             DocIdSet docIdSet = Cache[key];
@@ -137,11 +137,11 @@ namespace Lucene.Net.Search
 
         public override bool Equals(object o)
         {
-            if (o == null || !this.GetType().Equals(o.GetType()))
+            var other = o as CachingWrapperFilter;
+            if (other == null)
             {
                 return false;
             }
-            CachingWrapperFilter other = (CachingWrapperFilter)o;
             return this.Filter_Renamed.Equals(other.Filter_Renamed);
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Search/CollectionStatistics.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/CollectionStatistics.cs b/src/Lucene.Net.Core/Search/CollectionStatistics.cs
index 5c7218b..51d421c 100644
--- a/src/Lucene.Net.Core/Search/CollectionStatistics.cs
+++ b/src/Lucene.Net.Core/Search/CollectionStatistics.cs
@@ -58,9 +58,9 @@ namespace Lucene.Net.Search
         /// returns the total number of documents, regardless of
         /// whether they all contain values for this field. </summary>
         /// <seealso cref= IndexReader#maxDoc()  </seealso>
-        public long MaxDoc()
+        public long MaxDoc
         {
-            return MaxDoc_Renamed;
+            get { return MaxDoc_Renamed; }
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Search/ConstantScoreAutoRewrite.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/ConstantScoreAutoRewrite.cs b/src/Lucene.Net.Core/Search/ConstantScoreAutoRewrite.cs
index 360698f..4693447 100644
--- a/src/Lucene.Net.Core/Search/ConstantScoreAutoRewrite.cs
+++ b/src/Lucene.Net.Core/Search/ConstantScoreAutoRewrite.cs
@@ -100,7 +100,7 @@ namespace Lucene.Net.Search
             // exhaust the enum before hitting either of the
             // cutoffs, we use ConstantBooleanQueryRewrite; else,
             // ConstantFilterRewrite:
-            int docCountCutoff = (int)((DocCountPercent_Renamed / 100.0) * reader.MaxDoc());
+            int docCountCutoff = (int)((DocCountPercent_Renamed / 100.0) * reader.MaxDoc);
             int termCountLimit = Math.Min(BooleanQuery.MaxClauseCount, TermCountCutoff_Renamed);
 
             CutOffTermCollector col = new CutOffTermCollector(docCountCutoff, termCountLimit);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Search/ConstantScoreQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/ConstantScoreQuery.cs b/src/Lucene.Net.Core/Search/ConstantScoreQuery.cs
index a2c226e..13dc876 100644
--- a/src/Lucene.Net.Core/Search/ConstantScoreQuery.cs
+++ b/src/Lucene.Net.Core/Search/ConstantScoreQuery.cs
@@ -231,7 +231,7 @@ namespace Lucene.Net.Search
 
             public override Explanation Explain(AtomicReaderContext context, int doc)
             {
-                Scorer cs = Scorer(context, ((AtomicReader)context.Reader()).LiveDocs);
+                Scorer cs = Scorer(context, (context.AtomicReader).LiveDocs);
                 bool exists = (cs != null && cs.Advance(doc) == doc);
 
                 ComplexExplanation result = new ComplexExplanation();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Search/DocTermOrdsRangeFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/DocTermOrdsRangeFilter.cs b/src/Lucene.Net.Core/Search/DocTermOrdsRangeFilter.cs
index 4b0e073..8da560c 100644
--- a/src/Lucene.Net.Core/Search/DocTermOrdsRangeFilter.cs
+++ b/src/Lucene.Net.Core/Search/DocTermOrdsRangeFilter.cs
@@ -87,7 +87,7 @@ namespace Lucene.Net.Search
 
             public override DocIdSet GetDocIdSet(AtomicReaderContext context, Bits acceptDocs)
             {
-                SortedSetDocValues docTermOrds = FieldCache_Fields.DEFAULT.GetDocTermOrds(((AtomicReader)context.Reader()), Field);
+                SortedSetDocValues docTermOrds = FieldCache_Fields.DEFAULT.GetDocTermOrds(context.AtomicReader, Field);
                 long lowerPoint = LowerVal == null ? -1 : docTermOrds.LookupTerm(LowerVal);
                 long upperPoint = UpperVal == null ? -1 : docTermOrds.LookupTerm(UpperVal);
 
@@ -138,16 +138,16 @@ namespace Lucene.Net.Search
 
                 Debug.Assert(inclusiveLowerPoint >= 0 && inclusiveUpperPoint >= 0);
 
-                return new FieldCacheDocIdSetAnonymousInnerClassHelper(this, context.Reader().MaxDoc(), acceptDocs, docTermOrds, inclusiveLowerPoint, inclusiveUpperPoint);
+                return new FieldCacheDocIdSetAnonymousInnerClassHelper(this, context.AtomicReader.MaxDoc, acceptDocs, docTermOrds, inclusiveLowerPoint, inclusiveUpperPoint);
             }
 
             private class FieldCacheDocIdSetAnonymousInnerClassHelper : FieldCacheDocIdSet
             {
                 private readonly DocTermOrdsRangeFilterAnonymousInnerClassHelper OuterInstance;
 
-                private SortedSetDocValues DocTermOrds;
-                private long InclusiveLowerPoint;
-                private long InclusiveUpperPoint;
+                private readonly SortedSetDocValues DocTermOrds;
+                private readonly long InclusiveLowerPoint;
+                private readonly long InclusiveUpperPoint;
 
                 public FieldCacheDocIdSetAnonymousInnerClassHelper(DocTermOrdsRangeFilterAnonymousInnerClassHelper outerInstance, int maxDoc, Bits acceptDocs, SortedSetDocValues docTermOrds, long inclusiveLowerPoint, long inclusiveUpperPoint)
                     : base(maxDoc, acceptDocs)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Search/DocTermOrdsRewriteMethod.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/DocTermOrdsRewriteMethod.cs b/src/Lucene.Net.Core/Search/DocTermOrdsRewriteMethod.cs
index cc8d0c4..28fae0f 100644
--- a/src/Lucene.Net.Core/Search/DocTermOrdsRewriteMethod.cs
+++ b/src/Lucene.Net.Core/Search/DocTermOrdsRewriteMethod.cs
@@ -102,7 +102,7 @@ namespace Lucene.Net.Search
             /// </summary>
             public override DocIdSet GetDocIdSet(AtomicReaderContext context, Bits acceptDocs)
             {
-                SortedSetDocValues docTermOrds = FieldCache_Fields.DEFAULT.GetDocTermOrds(((AtomicReader)context.Reader()), Query.field);
+                SortedSetDocValues docTermOrds = FieldCache_Fields.DEFAULT.GetDocTermOrds((context.AtomicReader), Query.field);
                 // Cannot use FixedBitSet because we require long index (ord):
                 LongBitSet termSet = new LongBitSet(docTermOrds.ValueCount);
                 TermsEnum termsEnum = Query.GetTermsEnum(new TermsAnonymousInnerClassHelper(this, docTermOrds));
@@ -121,7 +121,7 @@ namespace Lucene.Net.Search
                     return null;
                 }
 
-                return new FieldCacheDocIdSetAnonymousInnerClassHelper(this, context.Reader().MaxDoc(), acceptDocs, docTermOrds, termSet);
+                return new FieldCacheDocIdSetAnonymousInnerClassHelper(this, context.Reader.MaxDoc, acceptDocs, docTermOrds, termSet);
             }
 
             private class TermsAnonymousInnerClassHelper : Terms

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Search/FieldCacheImpl.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/FieldCacheImpl.cs b/src/Lucene.Net.Core/Search/FieldCacheImpl.cs
index 668ab40..c191344 100644
--- a/src/Lucene.Net.Core/Search/FieldCacheImpl.cs
+++ b/src/Lucene.Net.Core/Search/FieldCacheImpl.cs
@@ -384,7 +384,7 @@ namespace Lucene.Net.Search
 
             public virtual void DoUninvert(AtomicReader reader, string field, bool setDocsWithField)
             {
-                int maxDoc = reader.MaxDoc();
+                int maxDoc = reader.MaxDoc;
                 Terms terms = reader.Terms(field);
                 if (terms != null)
                 {
@@ -445,7 +445,7 @@ namespace Lucene.Net.Search
         // null Bits means no docs matched
         internal virtual void SetDocsWithField(AtomicReader reader, string field, Bits docsWithField)
         {
-            int maxDoc = reader.MaxDoc();
+            int maxDoc = reader.MaxDoc;
             Bits bits;
             if (docsWithField == null)
             {
@@ -548,7 +548,7 @@ namespace Lucene.Net.Search
 
             protected internal override object CreateValue(AtomicReader reader, CacheKey key, bool setDocsWithField)
             {
-                int maxDoc = reader.MaxDoc();
+                int maxDoc = reader.MaxDoc;
                 sbyte[] values;
                 FieldCache_Fields.IByteParser parser = (FieldCache_Fields.IByteParser)key.Custom;
                 if (parser == null)
@@ -683,7 +683,7 @@ namespace Lucene.Net.Search
 
             protected internal override object CreateValue(AtomicReader reader, CacheKey key, bool setDocsWithField)
             {
-                int maxDoc = reader.MaxDoc();
+                int maxDoc = reader.MaxDoc;
                 short[] values;
                 FieldCache_Fields.IShortParser parser = (FieldCache_Fields.IShortParser)key.Custom;
                 if (parser == null)
@@ -877,7 +877,7 @@ namespace Lucene.Net.Search
                 GrowableWriterAndMinValue values = valuesRef.Get();
                 if (values == null)
                 {
-                    return new IntsFromArray(new PackedInts.NullReader(reader.MaxDoc()), 0);
+                    return new IntsFromArray(new PackedInts.NullReader(reader.MaxDoc), 0);
                 }
                 return new IntsFromArray(values.Writer.Mutable, (int)values.MinValue);
             }
@@ -923,7 +923,7 @@ namespace Lucene.Net.Search
                             minValue = 0;
                             startBitsPerValue = PackedInts.BitsRequired(currentValue);
                         }
-                        values = new GrowableWriter(startBitsPerValue, Reader.MaxDoc(), PackedInts.FAST);
+                        values = new GrowableWriter(startBitsPerValue, Reader.MaxDoc, PackedInts.FAST);
                         if (minValue != 0)
                         {
                             values.Fill(0, values.Size(), (-minValue) & 0xFFFFFFFFL); // default value must be 0
@@ -950,7 +950,7 @@ namespace Lucene.Net.Search
             if (fieldInfo == null)
             {
                 // field does not exist or has no value
-                return new Lucene.Net.Util.Bits_MatchNoBits(reader.MaxDoc());
+                return new Lucene.Net.Util.Bits_MatchNoBits(reader.MaxDoc);
             }
             else if (fieldInfo.HasDocValues())
             {
@@ -958,7 +958,7 @@ namespace Lucene.Net.Search
             }
             else if (!fieldInfo.Indexed)
             {
-                return new Lucene.Net.Util.Bits_MatchNoBits(reader.MaxDoc());
+                return new Lucene.Net.Util.Bits_MatchNoBits(reader.MaxDoc);
             }
             return (Bits)Caches[typeof(DocsWithFieldCache)].Get(reader, new CacheKey(field, null), false);
         }
@@ -973,7 +973,7 @@ namespace Lucene.Net.Search
             protected internal override object CreateValue(AtomicReader reader, CacheKey key, bool setDocsWithField) // ignored
             {
                 string field = key.Field;
-                int maxDoc = reader.MaxDoc();
+                int maxDoc = reader.MaxDoc;
 
                 // Visit all docs that have terms for this field
                 FixedBitSet res = null;
@@ -1137,7 +1137,7 @@ namespace Lucene.Net.Search
                 float[] values = valuesRef.Get();
                 if (values == null)
                 {
-                    values = new float[reader.MaxDoc()];
+                    values = new float[reader.MaxDoc];
                 }
                 return new FloatsFromArray(values);
             }
@@ -1170,7 +1170,7 @@ namespace Lucene.Net.Search
                         // (which will hit a System.FormatException
                         // when we first try the DEFAULT_INT_PARSER),
                         // we don't double-alloc:
-                        values = new float[Reader.MaxDoc()];
+                        values = new float[Reader.MaxDoc];
                         ValuesRef.Set(values);
                     }
                 }
@@ -1295,7 +1295,7 @@ namespace Lucene.Net.Search
                 GrowableWriterAndMinValue values = valuesRef.Get();
                 if (values == null)
                 {
-                    return new LongsFromArray(new PackedInts.NullReader(reader.MaxDoc()), 0L);
+                    return new LongsFromArray(new PackedInts.NullReader(reader.MaxDoc), 0L);
                 }
                 return new LongsFromArray(values.Writer.Mutable, values.MinValue);
             }
@@ -1341,7 +1341,7 @@ namespace Lucene.Net.Search
                             minValue = 0;
                             startBitsPerValue = PackedInts.BitsRequired(currentValue);
                         }
-                        values = new GrowableWriter(startBitsPerValue, Reader.MaxDoc(), PackedInts.FAST);
+                        values = new GrowableWriter(startBitsPerValue, Reader.MaxDoc, PackedInts.FAST);
                         if (minValue != 0)
                         {
                             values.Fill(0, values.Size(), -minValue); // default value must be 0
@@ -1468,7 +1468,7 @@ namespace Lucene.Net.Search
                 double[] values = valuesRef.Get();
                 if (values == null)
                 {
-                    values = new double[reader.MaxDoc()];
+                    values = new double[reader.MaxDoc];
                 }
                 return new DoublesFromArray(values);
             }
@@ -1501,7 +1501,7 @@ namespace Lucene.Net.Search
                         // (which will hit a System.FormatException
                         // when we first try the DEFAULT_INT_PARSER),
                         // we don't double-alloc:
-                        values = new double[Reader.MaxDoc()];
+                        values = new double[Reader.MaxDoc];
                         ValuesRef.Set(values);
                     }
                 }
@@ -1603,7 +1603,7 @@ namespace Lucene.Net.Search
 
             protected internal override object CreateValue(AtomicReader reader, CacheKey key, bool setDocsWithField) // ignored
             {
-                int maxDoc = reader.MaxDoc();
+                int maxDoc = reader.MaxDoc;
 
                 Terms terms = reader.Terms(key.Field);
 
@@ -1777,7 +1777,7 @@ namespace Lucene.Net.Search
                 // was already cached for this field and then return
                 // that instead, to avoid insanity
 
-                int maxDoc = reader.MaxDoc();
+                int maxDoc = reader.MaxDoc;
                 Terms terms = reader.Terms(key.Field);
 
                 float acceptableOverheadRatio = (float)((float?)key.Custom);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Search/FieldCacheRangeFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/FieldCacheRangeFilter.cs b/src/Lucene.Net.Core/Search/FieldCacheRangeFilter.cs
index b14bca8..7ee7f77 100644
--- a/src/Lucene.Net.Core/Search/FieldCacheRangeFilter.cs
+++ b/src/Lucene.Net.Core/Search/FieldCacheRangeFilter.cs
@@ -96,7 +96,7 @@ namespace Lucene.Net.Search
 
             public override DocIdSet GetDocIdSet(AtomicReaderContext context, Bits acceptDocs)
             {
-                SortedDocValues fcsi = FieldCache_Fields.DEFAULT.GetTermsIndex((AtomicReader)context.Reader(), field);
+                SortedDocValues fcsi = FieldCache_Fields.DEFAULT.GetTermsIndex(context.AtomicReader, field);
                 int lowerPoint = lowerVal == null ? -1 : fcsi.LookupTerm(new BytesRef(lowerVal));
                 int upperPoint = upperVal == null ? -1 : fcsi.LookupTerm(new BytesRef(upperVal));
 
@@ -147,7 +147,7 @@ namespace Lucene.Net.Search
 
                 Debug.Assert(inclusiveLowerPoint > 0 && inclusiveUpperPoint > 0);
 
-                return new AnonymousClassFieldCacheDocIdSet(fcsi, inclusiveLowerPoint, inclusiveUpperPoint, context.Reader().MaxDoc(), acceptDocs);
+                return new AnonymousClassFieldCacheDocIdSet(fcsi, inclusiveLowerPoint, inclusiveUpperPoint, context.Reader.MaxDoc, acceptDocs);
             }
         }
 
@@ -182,7 +182,7 @@ namespace Lucene.Net.Search
 
             public override DocIdSet GetDocIdSet(AtomicReaderContext context, Bits acceptDocs)
             {
-                SortedDocValues fcsi = FieldCache_Fields.DEFAULT.GetTermsIndex((AtomicReader)context.Reader(), field);
+                SortedDocValues fcsi = FieldCache_Fields.DEFAULT.GetTermsIndex(context.AtomicReader, field);
                 int lowerPoint = lowerVal == null ? -1 : fcsi.LookupTerm(lowerVal);
                 int upperPoint = upperVal == null ? -1 : fcsi.LookupTerm(upperVal);
 
@@ -232,7 +232,7 @@ namespace Lucene.Net.Search
                 }
 
                 //assert inclusiveLowerPoint >= 0 && inclusiveUpperPoint >= 0;
-                return new AnonymousClassFieldCacheDocIdSet(fcsi, inclusiveLowerPoint, inclusiveUpperPoint, context.Reader().MaxDoc(), acceptDocs);
+                return new AnonymousClassFieldCacheDocIdSet(fcsi, inclusiveLowerPoint, inclusiveUpperPoint, context.AtomicReader.MaxDoc, acceptDocs);
             }
         }
 
@@ -294,10 +294,10 @@ namespace Lucene.Net.Search
                 if (inclusiveLowerPoint > inclusiveUpperPoint)
                     return null;
 
-                FieldCache_Fields.Bytes values = FieldCache_Fields.DEFAULT.GetBytes((AtomicReader)context.Reader(), field, (FieldCache_Fields.IByteParser)parser, false);
+                var values = FieldCache_Fields.DEFAULT.GetBytes(context.AtomicReader, field, (FieldCache_Fields.IByteParser)parser, false);
 
                 // we only request the usage of termDocs, if the range contains 0
-                return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint, context.Reader().MaxDoc(), acceptDocs);
+                return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint, context.AtomicReader.MaxDoc, acceptDocs);
             }
         }
 
@@ -360,10 +360,10 @@ namespace Lucene.Net.Search
                 if (inclusiveLowerPoint > inclusiveUpperPoint)
                     return null;
 
-                FieldCache_Fields.Shorts values = FieldCache_Fields.DEFAULT.GetShorts((AtomicReader)context.Reader(), field, (FieldCache_Fields.IShortParser)parser, false);
+                FieldCache_Fields.Shorts values = FieldCache_Fields.DEFAULT.GetShorts(context.AtomicReader, field, (FieldCache_Fields.IShortParser)parser, false);
 
                 // we only request the usage of termDocs, if the range contains 0
-                return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint, context.Reader().MaxDoc(), acceptDocs);
+                return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint, context.Reader.MaxDoc, acceptDocs);
             }
         }
 
@@ -426,9 +426,9 @@ namespace Lucene.Net.Search
                 if (inclusiveLowerPoint > inclusiveUpperPoint)
                     return null;
 
-                FieldCache_Fields.Ints values = FieldCache_Fields.DEFAULT.GetInts((AtomicReader)context.Reader(), field, (FieldCache_Fields.IIntParser)parser, false);
+                FieldCache_Fields.Ints values = FieldCache_Fields.DEFAULT.GetInts(context.AtomicReader, field, (FieldCache_Fields.IIntParser)parser, false);
                 // we only request the usage of termDocs, if the range contains 0
-                return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint, context.Reader().MaxDoc(), acceptDocs);
+                return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint, context.Reader.MaxDoc, acceptDocs);
             }
         }
 
@@ -491,9 +491,9 @@ namespace Lucene.Net.Search
                 if (inclusiveLowerPoint > inclusiveUpperPoint)
                     return null;
 
-                FieldCache_Fields.Longs values = FieldCache_Fields.DEFAULT.GetLongs((AtomicReader)context.Reader(), field, (FieldCache_Fields.ILongParser)parser, false);
+                FieldCache_Fields.Longs values = FieldCache_Fields.DEFAULT.GetLongs(context.AtomicReader, field, (FieldCache_Fields.ILongParser)parser, false);
                 // we only request the usage of termDocs, if the range contains 0
-                return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint, context.Reader().MaxDoc(), acceptDocs);
+                return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint, context.Reader.MaxDoc, acceptDocs);
             }
         }
 
@@ -560,10 +560,10 @@ namespace Lucene.Net.Search
                 if (inclusiveLowerPoint > inclusiveUpperPoint)
                     return null;
 
-                FieldCache_Fields.Floats values = FieldCache_Fields.DEFAULT.GetFloats((AtomicReader)context.Reader(), field, (FieldCache_Fields.IFloatParser)parser, false);
+                FieldCache_Fields.Floats values = FieldCache_Fields.DEFAULT.GetFloats(context.AtomicReader, field, (FieldCache_Fields.IFloatParser)parser, false);
 
                 // we only request the usage of termDocs, if the range contains 0
-                return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint, context.Reader().MaxDoc(), acceptDocs);
+                return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint, context.Reader.MaxDoc, acceptDocs);
             }
         }
 
@@ -630,10 +630,10 @@ namespace Lucene.Net.Search
                 if (inclusiveLowerPoint > inclusiveUpperPoint)
                     return null;
 
-                FieldCache_Fields.Doubles values = FieldCache_Fields.DEFAULT.GetDoubles((AtomicReader)context.Reader(), field, (FieldCache_Fields.IDoubleParser)parser, false);
+                FieldCache_Fields.Doubles values = FieldCache_Fields.DEFAULT.GetDoubles(context.AtomicReader, field, (FieldCache_Fields.IDoubleParser)parser, false);
 
                 // we only request the usage of termDocs, if the range contains 0
-                return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint, context.Reader().MaxDoc(), acceptDocs);
+                return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint, context.Reader.MaxDoc, acceptDocs);
             }
         }
 
@@ -838,7 +838,7 @@ namespace Lucene.Net.Search
 
 		  public override DocIdSet GetDocIdSet(AtomicReaderContext context, Bits acceptDocs)
 		  {
-			SortedDocValues fcsi = FieldCache_Fields.DEFAULT.GetTermsIndex(((AtomicReader)context.Reader()), Field);
+			SortedDocValues fcsi = FieldCache_Fields.DEFAULT.GetTermsIndex((context.AtomicReader), Field);
 			int lowerPoint = LowerVal == null ? - 1 : fcsi.LookupTerm(new BytesRef(LowerVal));
 			int upperPoint = UpperVal == null ? - 1 : fcsi.LookupTerm(new BytesRef(UpperVal));
 
@@ -889,7 +889,7 @@ namespace Lucene.Net.Search
 
 			Debug.Assert(inclusiveLowerPoint >= 0 && inclusiveUpperPoint >= 0);
 
-			return new FieldCacheDocIdSetAnonymousInnerClassHelper(this, context.Reader().MaxDoc(), acceptDocs, fcsi, inclusiveLowerPoint, inclusiveUpperPoint);
+			return new FieldCacheDocIdSetAnonymousInnerClassHelper(this, context.Reader.MaxDoc, acceptDocs, fcsi, inclusiveLowerPoint, inclusiveUpperPoint);
 		  }
 
 		  private class FieldCacheDocIdSetAnonymousInnerClassHelper : FieldCacheDocIdSet
@@ -946,7 +946,7 @@ namespace Lucene.Net.Search
 
 		  public override DocIdSet GetDocIdSet(AtomicReaderContext context, Bits acceptDocs)
 		  {
-			SortedDocValues fcsi = FieldCache_Fields.DEFAULT.GetTermsIndex(((AtomicReader)context.Reader()), Field);
+			SortedDocValues fcsi = FieldCache_Fields.DEFAULT.GetTermsIndex((context.AtomicReader), Field);
 			int lowerPoint = LowerVal == null ? - 1 : fcsi.LookupTerm(LowerVal);
 			int upperPoint = UpperVal == null ? - 1 : fcsi.LookupTerm(UpperVal);
 
@@ -997,7 +997,7 @@ namespace Lucene.Net.Search
 
 			Debug.Assert(inclusiveLowerPoint >= 0 && inclusiveUpperPoint >= 0);
 
-			return new FieldCacheDocIdSetAnonymousInnerClassHelper2(this, context.Reader().MaxDoc(), acceptDocs, fcsi, inclusiveLowerPoint, inclusiveUpperPoint);
+			return new FieldCacheDocIdSetAnonymousInnerClassHelper2(this, context.Reader.MaxDoc, acceptDocs, fcsi, inclusiveLowerPoint, inclusiveUpperPoint);
 		  }
 
 		  private class FieldCacheDocIdSetAnonymousInnerClassHelper2 : FieldCacheDocIdSet
@@ -1101,8 +1101,8 @@ namespace Lucene.Net.Search
 			  return null;
 			}
 
-            FieldCache_Fields.Bytes values = FieldCache_Fields.DEFAULT.GetBytes(((AtomicReader)context.Reader()), Field, (FieldCache_Fields.IByteParser)Parser, false);
-			return new FieldCacheDocIdSetAnonymousInnerClassHelper3(this, context.Reader().MaxDoc(), acceptDocs, inclusiveLowerPoint, inclusiveUpperPoint, values);
+            FieldCache_Fields.Bytes values = FieldCache_Fields.DEFAULT.GetBytes((context.AtomicReader), Field, (FieldCache_Fields.IByteParser)Parser, false);
+			return new FieldCacheDocIdSetAnonymousInnerClassHelper3(this, context.Reader.MaxDoc, acceptDocs, inclusiveLowerPoint, inclusiveUpperPoint, values);
 		  }
 
 		  private class FieldCacheDocIdSetAnonymousInnerClassHelper3 : FieldCacheDocIdSet
@@ -1207,8 +1207,8 @@ namespace Lucene.Net.Search
 			  return null;
 			}
 
-            FieldCache_Fields.Shorts values = FieldCache_Fields.DEFAULT.GetShorts(((AtomicReader)context.Reader()), Field, (FieldCache_Fields.IShortParser)Parser, false);
-			return new FieldCacheDocIdSetAnonymousInnerClassHelper4(this, context.Reader().MaxDoc(), acceptDocs, inclusiveLowerPoint, inclusiveUpperPoint, values);
+            FieldCache_Fields.Shorts values = FieldCache_Fields.DEFAULT.GetShorts((context.AtomicReader), Field, (FieldCache_Fields.IShortParser)Parser, false);
+			return new FieldCacheDocIdSetAnonymousInnerClassHelper4(this, context.Reader.MaxDoc, acceptDocs, inclusiveLowerPoint, inclusiveUpperPoint, values);
 		  }
 
 		  private class FieldCacheDocIdSetAnonymousInnerClassHelper4 : FieldCacheDocIdSet
@@ -1311,8 +1311,8 @@ namespace Lucene.Net.Search
 			  return null;
 			}
 
-            FieldCache_Fields.Ints values = FieldCache_Fields.DEFAULT.GetInts(((AtomicReader)context.Reader()), Field, (FieldCache_Fields.IIntParser)Parser, false);
-			return new FieldCacheDocIdSetAnonymousInnerClassHelper5(this, context.Reader().MaxDoc(), acceptDocs, inclusiveLowerPoint, inclusiveUpperPoint, values);
+            FieldCache_Fields.Ints values = FieldCache_Fields.DEFAULT.GetInts((context.AtomicReader), Field, (FieldCache_Fields.IIntParser)Parser, false);
+			return new FieldCacheDocIdSetAnonymousInnerClassHelper5(this, context.Reader.MaxDoc, acceptDocs, inclusiveLowerPoint, inclusiveUpperPoint, values);
 		  }
 
 		  private class FieldCacheDocIdSetAnonymousInnerClassHelper5 : FieldCacheDocIdSet
@@ -1415,8 +1415,8 @@ namespace Lucene.Net.Search
 			  return null;
 			}
 
-            FieldCache_Fields.Longs values = FieldCache_Fields.DEFAULT.GetLongs(((AtomicReader)context.Reader()), Field, (FieldCache_Fields.ILongParser)Parser, false);
-			return new FieldCacheDocIdSetAnonymousInnerClassHelper6(this, context.Reader().MaxDoc(), acceptDocs, inclusiveLowerPoint, inclusiveUpperPoint, values);
+            FieldCache_Fields.Longs values = FieldCache_Fields.DEFAULT.GetLongs((context.AtomicReader), Field, (FieldCache_Fields.ILongParser)Parser, false);
+			return new FieldCacheDocIdSetAnonymousInnerClassHelper6(this, context.Reader.MaxDoc, acceptDocs, inclusiveLowerPoint, inclusiveUpperPoint, values);
 		  }
 
 		  private class FieldCacheDocIdSetAnonymousInnerClassHelper6 : FieldCacheDocIdSet
@@ -1523,8 +1523,8 @@ namespace Lucene.Net.Search
 			  return null;
 			}
 
-            FieldCache_Fields.Floats values = FieldCache_Fields.DEFAULT.GetFloats(((AtomicReader)context.Reader()), Field, (FieldCache_Fields.IFloatParser)Parser, false);
-			return new FieldCacheDocIdSetAnonymousInnerClassHelper7(this, context.Reader().MaxDoc(), acceptDocs, inclusiveLowerPoint, inclusiveUpperPoint, values);
+            FieldCache_Fields.Floats values = FieldCache_Fields.DEFAULT.GetFloats((context.AtomicReader), Field, (FieldCache_Fields.IFloatParser)Parser, false);
+			return new FieldCacheDocIdSetAnonymousInnerClassHelper7(this, context.Reader.MaxDoc, acceptDocs, inclusiveLowerPoint, inclusiveUpperPoint, values);
 		  }
 
 		  private class FieldCacheDocIdSetAnonymousInnerClassHelper7 : FieldCacheDocIdSet
@@ -1631,9 +1631,9 @@ namespace Lucene.Net.Search
 			  return null;
 			}
 
-            FieldCache_Fields.Doubles values = FieldCache_Fields.DEFAULT.GetDoubles(((AtomicReader)context.Reader()), Field, (FieldCache_Fields.IDoubleParser)Parser, false);
+            FieldCache_Fields.Doubles values = FieldCache_Fields.DEFAULT.GetDoubles((context.AtomicReader), Field, (FieldCache_Fields.IDoubleParser)Parser, false);
 			// ignore deleted docs if range doesn't contain 0
-			return new FieldCacheDocIdSetAnonymousInnerClassHelper8(this, context.Reader().MaxDoc(), acceptDocs, inclusiveLowerPoint, inclusiveUpperPoint, values);
+			return new FieldCacheDocIdSetAnonymousInnerClassHelper8(this, context.Reader.MaxDoc, acceptDocs, inclusiveLowerPoint, inclusiveUpperPoint, values);
 		  }
 
 		  private class FieldCacheDocIdSetAnonymousInnerClassHelper8 : FieldCacheDocIdSet

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Search/FieldCacheRewriteMethod.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/FieldCacheRewriteMethod.cs b/src/Lucene.Net.Core/Search/FieldCacheRewriteMethod.cs
index ccf7547..2b7848d 100644
--- a/src/Lucene.Net.Core/Search/FieldCacheRewriteMethod.cs
+++ b/src/Lucene.Net.Core/Search/FieldCacheRewriteMethod.cs
@@ -102,7 +102,7 @@ namespace Lucene.Net.Search
             /// </summary>
             public override DocIdSet GetDocIdSet(AtomicReaderContext context, Bits acceptDocs)
             {
-                SortedDocValues fcsi = FieldCache_Fields.DEFAULT.GetTermsIndex(((AtomicReader)context.Reader()), Query.field);
+                SortedDocValues fcsi = FieldCache_Fields.DEFAULT.GetTermsIndex((context.AtomicReader), Query.field);
                 // Cannot use FixedBitSet because we require long index (ord):
                 LongBitSet termSet = new LongBitSet(fcsi.ValueCount);
                 TermsEnum termsEnum = Query.GetTermsEnum(new TermsAnonymousInnerClassHelper(this, fcsi));
@@ -125,7 +125,7 @@ namespace Lucene.Net.Search
                     return null;
                 }
 
-                return new FieldCacheDocIdSetAnonymousInnerClassHelper(this, context.Reader().MaxDoc(), acceptDocs, fcsi, termSet);
+                return new FieldCacheDocIdSetAnonymousInnerClassHelper(this, context.Reader.MaxDoc, acceptDocs, fcsi, termSet);
             }
 
             private class TermsAnonymousInnerClassHelper : Terms

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Search/FieldCacheTermsFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/FieldCacheTermsFilter.cs b/src/Lucene.Net.Core/Search/FieldCacheTermsFilter.cs
index 9f252f2..c9c7a00 100644
--- a/src/Lucene.Net.Core/Search/FieldCacheTermsFilter.cs
+++ b/src/Lucene.Net.Core/Search/FieldCacheTermsFilter.cs
@@ -128,7 +128,7 @@ namespace Lucene.Net.Search
 
         public override DocIdSet GetDocIdSet(AtomicReaderContext context, Bits acceptDocs)
         {
-            SortedDocValues fcsi = FieldCache.GetTermsIndex(((AtomicReader)context.Reader()), Field);
+            SortedDocValues fcsi = FieldCache.GetTermsIndex((context.AtomicReader), Field);
             FixedBitSet bits = new FixedBitSet(fcsi.ValueCount);
             for (int i = 0; i < Terms.Length; i++)
             {
@@ -138,7 +138,7 @@ namespace Lucene.Net.Search
                     bits.Set(ord);
                 }
             }
-            return new FieldCacheDocIdSetAnonymousInnerClassHelper(this, context.Reader().MaxDoc(), acceptDocs, fcsi, bits);
+            return new FieldCacheDocIdSetAnonymousInnerClassHelper(this, context.Reader.MaxDoc, acceptDocs, fcsi, bits);
         }
 
         private class FieldCacheDocIdSetAnonymousInnerClassHelper : FieldCacheDocIdSet

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Search/FieldComparator.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/FieldComparator.cs b/src/Lucene.Net.Core/Search/FieldComparator.cs
index dc040b4..3ebadff 100644
--- a/src/Lucene.Net.Core/Search/FieldComparator.cs
+++ b/src/Lucene.Net.Core/Search/FieldComparator.cs
@@ -338,7 +338,7 @@ namespace Lucene.Net.Search
             {
                 if (MissingValue != null)
                 {
-                    DocsWithField = FieldCache_Fields.DEFAULT.GetDocsWithField(((AtomicReader)context.Reader()), Field);
+                    DocsWithField = FieldCache_Fields.DEFAULT.GetDocsWithField((context.AtomicReader), Field);
                     // optimization to remove unneeded checks on the bit interface:
                     if (DocsWithField is Lucene.Net.Util.Bits_MatchAllBits)
                     {
@@ -408,7 +408,7 @@ namespace Lucene.Net.Search
             {
                 // NOTE: must do this before calling super otherwise
                 // we compute the docsWithField Bits twice!
-                CurrentReaderValues = FieldCache_Fields.DEFAULT.GetBytes(((AtomicReader)context.Reader()), Field, Parser, MissingValue != null);
+                CurrentReaderValues = FieldCache_Fields.DEFAULT.GetBytes((context.AtomicReader), Field, Parser, MissingValue != null);
                 return base.SetNextReader(context);
             }
 
@@ -501,7 +501,7 @@ namespace Lucene.Net.Search
             {
                 // NOTE: must do this before calling super otherwise
                 // we compute the docsWithField Bits twice!
-                CurrentReaderValues = FieldCache_Fields.DEFAULT.GetDoubles(((AtomicReader)context.Reader()), Field, Parser, MissingValue != null);
+                CurrentReaderValues = FieldCache_Fields.DEFAULT.GetDoubles((context.AtomicReader), Field, Parser, MissingValue != null);
                 return base.SetNextReader(context);
             }
 
@@ -594,7 +594,7 @@ namespace Lucene.Net.Search
             {
                 // NOTE: must do this before calling super otherwise
                 // we compute the docsWithField Bits twice!
-                CurrentReaderValues = FieldCache_Fields.DEFAULT.GetFloats(((AtomicReader)context.Reader()), Field, Parser, MissingValue != null);
+                CurrentReaderValues = FieldCache_Fields.DEFAULT.GetFloats((context.AtomicReader), Field, Parser, MissingValue != null);
                 return base.SetNextReader(context);
             }
 
@@ -689,7 +689,7 @@ namespace Lucene.Net.Search
             {
                 // NOTE: must do this before calling super otherwise
                 // we compute the docsWithField Bits twice!
-                CurrentReaderValues = FieldCache_Fields.DEFAULT.GetShorts(((AtomicReader)context.Reader()), Field, Parser, MissingValue != null);
+                CurrentReaderValues = FieldCache_Fields.DEFAULT.GetShorts((context.AtomicReader), Field, Parser, MissingValue != null);
                 return base.SetNextReader(context);
             }
 
@@ -780,7 +780,7 @@ namespace Lucene.Net.Search
             {
                 // NOTE: must do this before calling super otherwise
                 // we compute the docsWithField Bits twice!
-                CurrentReaderValues = FieldCache_Fields.DEFAULT.GetInts(((AtomicReader)context.Reader()), Field, Parser, MissingValue != null);
+                CurrentReaderValues = FieldCache_Fields.DEFAULT.GetInts((context.AtomicReader), Field, Parser, MissingValue != null);
                 return base.SetNextReader(context);
             }
 
@@ -874,7 +874,7 @@ namespace Lucene.Net.Search
             {
                 // NOTE: must do this before calling super otherwise
                 // we compute the docsWithField Bits twice!
-                CurrentReaderValues = FieldCache_Fields.DEFAULT.GetLongs(((AtomicReader)context.Reader()), Field, Parser, MissingValue != null);
+                CurrentReaderValues = FieldCache_Fields.DEFAULT.GetLongs((context.AtomicReader), Field, Parser, MissingValue != null);
                 return base.SetNextReader(context);
             }
 
@@ -1259,7 +1259,7 @@ namespace Lucene.Net.Search
             /// Retrieves the SortedDocValues for the field in this segment </summary>
             protected internal virtual SortedDocValues GetSortedDocValues(AtomicReaderContext context, string field)
             {
-                return FieldCache_Fields.DEFAULT.GetTermsIndex(((AtomicReader)context.Reader()), field);
+                return FieldCache_Fields.DEFAULT.GetTermsIndex((context.AtomicReader), field);
             }
 
             public override FieldComparator SetNextReader(AtomicReaderContext context)
@@ -1473,8 +1473,8 @@ namespace Lucene.Net.Search
 
             public override FieldComparator SetNextReader(AtomicReaderContext context)
             {
-                DocTerms = FieldCache_Fields.DEFAULT.GetTerms(((AtomicReader)context.Reader()), Field, true);
-                DocsWithField = FieldCache_Fields.DEFAULT.GetDocsWithField(((AtomicReader)context.Reader()), Field);
+                DocTerms = FieldCache_Fields.DEFAULT.GetTerms((context.AtomicReader), Field, true);
+                DocsWithField = FieldCache_Fields.DEFAULT.GetDocsWithField((context.AtomicReader), Field);
                 return this;
             }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Search/FieldValueFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/FieldValueFilter.cs b/src/Lucene.Net.Core/Search/FieldValueFilter.cs
index ba53495..9b78022 100644
--- a/src/Lucene.Net.Core/Search/FieldValueFilter.cs
+++ b/src/Lucene.Net.Core/Search/FieldValueFilter.cs
@@ -77,14 +77,14 @@ namespace Lucene.Net.Search
 
         public override DocIdSet GetDocIdSet(AtomicReaderContext context, Bits acceptDocs)
         {
-            Bits docsWithField = FieldCache_Fields.DEFAULT.GetDocsWithField(((AtomicReader)context.Reader()), Field_Renamed);
+            Bits docsWithField = FieldCache_Fields.DEFAULT.GetDocsWithField(((AtomicReader)context.Reader), Field_Renamed);
             if (Negate_Renamed)
             {
                 if (docsWithField is Bits_MatchAllBits)
                 {
                     return null;
                 }
-                return new FieldCacheDocIdSetAnonymousInnerClassHelper(this, context.Reader().MaxDoc(), acceptDocs, docsWithField);
+                return new FieldCacheDocIdSetAnonymousInnerClassHelper(this, context.AtomicReader.MaxDoc, acceptDocs, docsWithField);
             }
             else
             {
@@ -98,7 +98,7 @@ namespace Lucene.Net.Search
                     // :-)
                     return BitsFilteredDocIdSet.Wrap((DocIdSet)docsWithField, acceptDocs);
                 }
-                return new FieldCacheDocIdSetAnonymousInnerClassHelper2(this, context.Reader().MaxDoc(), acceptDocs, docsWithField);
+                return new FieldCacheDocIdSetAnonymousInnerClassHelper2(this, context.AtomicReader.MaxDoc, acceptDocs, docsWithField);
             }
         }
 
@@ -125,7 +125,7 @@ namespace Lucene.Net.Search
         {
             private readonly FieldValueFilter OuterInstance;
 
-            private Bits DocsWithField;
+            private readonly Bits DocsWithField;
 
             public FieldCacheDocIdSetAnonymousInnerClassHelper2(FieldValueFilter outerInstance, int maxDoc, Bits acceptDocs, Bits docsWithField)
                 : base(maxDoc, acceptDocs)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Search/FilteredQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/FilteredQuery.cs b/src/Lucene.Net.Core/Search/FilteredQuery.cs
index 4a59d7d..a995456 100644
--- a/src/Lucene.Net.Core/Search/FilteredQuery.cs
+++ b/src/Lucene.Net.Core/Search/FilteredQuery.cs
@@ -121,7 +121,7 @@ namespace Lucene.Net.Search
             {
                 Explanation inner = Weight.Explain(ir, i);
                 Filter f = OuterInstance.Filter_Renamed;
-                DocIdSet docIdSet = f.GetDocIdSet(ir, ((AtomicReader)ir.Reader()).LiveDocs);
+                DocIdSet docIdSet = f.GetDocIdSet(ir, ir.AtomicReader.LiveDocs);
                 DocIdSetIterator docIdSetIterator = docIdSet == null ? DocIdSetIterator.Empty() : docIdSet.GetIterator();
                 if (docIdSetIterator == null)
                 {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Search/IndexSearcher.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/IndexSearcher.cs b/src/Lucene.Net.Core/Search/IndexSearcher.cs
index 2740a8a..973202b 100644
--- a/src/Lucene.Net.Core/Search/IndexSearcher.cs
+++ b/src/Lucene.Net.Core/Search/IndexSearcher.cs
@@ -149,11 +149,11 @@ namespace Lucene.Net.Search
         /// @lucene.experimental </seealso>
         public IndexSearcher(IndexReaderContext context, TaskScheduler executor)
         {
-            Debug.Assert(context.IsTopLevel, "IndexSearcher's ReaderContext must be topLevel for reader" + context.Reader());
-            Reader = context.Reader();
+            Debug.Assert(context.IsTopLevel, "IndexSearcher's ReaderContext must be topLevel for reader" + context.Reader);
+            Reader = context.Reader;
             this.Executor = executor;
             this.ReaderContext = context;
-            LeafContexts = context.Leaves();
+            LeafContexts = context.Leaves;
             this.LeafSlices = executor == null ? null : Slices(LeafContexts);
         }
 
@@ -458,7 +458,7 @@ namespace Lucene.Net.Search
         ///         <seealso cref="BooleanQuery#getMaxClauseCount()"/> clauses. </exception>
         protected internal virtual TopDocs Search(Weight weight, ScoreDoc after, int nDocs)
         {
-            int limit = Reader.MaxDoc();
+            int limit = Reader.MaxDoc;
             if (limit == 0)
             {
                 limit = 1;
@@ -495,7 +495,7 @@ namespace Lucene.Net.Search
                     }
                 }
 
-                ScoreDoc[] scoreDocs = new ScoreDoc[hq.Size()];
+                var scoreDocs = new ScoreDoc[hq.Size()];
                 for (int i = hq.Size() - 1; i >= 0; i--) // put docs in array
                 {
                     scoreDocs[i] = hq.Pop();
@@ -516,7 +516,7 @@ namespace Lucene.Net.Search
         protected internal virtual TopDocs Search(IList<AtomicReaderContext> leaves, Weight weight, ScoreDoc after, int nDocs)
         {
             // single thread
-            int limit = Reader.MaxDoc();
+            int limit = Reader.MaxDoc;
             if (limit == 0)
             {
                 limit = 1;
@@ -556,7 +556,7 @@ namespace Lucene.Net.Search
                 throw new System.NullReferenceException("Sort must not be null");
             }
 
-            int limit = Reader.MaxDoc();
+            int limit = Reader.MaxDoc;
             if (limit == 0)
             {
                 limit = 1;
@@ -603,7 +603,7 @@ namespace Lucene.Net.Search
         protected internal virtual TopFieldDocs Search(IList<AtomicReaderContext> leaves, Weight weight, FieldDoc after, int nDocs, Sort sort, bool fillFields, bool doDocScores, bool doMaxScore)
         {
             // single thread
-            int limit = Reader.MaxDoc();
+            int limit = Reader.MaxDoc;
             if (limit == 0)
             {
                 limit = 1;
@@ -650,7 +650,7 @@ namespace Lucene.Net.Search
                     // continue with the following leaf
                     continue;
                 }
-                BulkScorer scorer = weight.BulkScorer(ctx, !collector.AcceptsDocsOutOfOrder(), ((AtomicReader)ctx.Reader()).LiveDocs);
+                BulkScorer scorer = weight.BulkScorer(ctx, !collector.AcceptsDocsOutOfOrder(), ctx.AtomicReader.LiveDocs);
                 if (scorer != null)
                 {
                     try
@@ -1031,7 +1031,7 @@ namespace Lucene.Net.Search
                 sumTotalTermFreq = terms.SumTotalTermFreq;
                 sumDocFreq = terms.SumDocFreq;
             }
-            return new CollectionStatistics(field, Reader.MaxDoc(), docCount, sumTotalTermFreq, sumDocFreq);
+            return new CollectionStatistics(field, Reader.MaxDoc, docCount, sumTotalTermFreq, sumDocFreq);
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Search/MatchAllDocsQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/MatchAllDocsQuery.cs b/src/Lucene.Net.Core/Search/MatchAllDocsQuery.cs
index 405bfef..ae6d15c 100644
--- a/src/Lucene.Net.Core/Search/MatchAllDocsQuery.cs
+++ b/src/Lucene.Net.Core/Search/MatchAllDocsQuery.cs
@@ -49,7 +49,7 @@ namespace Lucene.Net.Search
                 this.OuterInstance = outerInstance;
                 this.LiveDocs = liveDocs;
                 this.Score_Renamed = score;
-                MaxDoc = reader.MaxDoc();
+                MaxDoc = reader.MaxDoc;
             }
 
             public override int DocID()
@@ -135,7 +135,7 @@ namespace Lucene.Net.Search
 
             public override Scorer Scorer(AtomicReaderContext context, Bits acceptDocs)
             {
-                return new MatchAllScorer(OuterInstance, context.Reader(), acceptDocs, this, QueryWeight);
+                return new MatchAllScorer(OuterInstance, context.Reader, acceptDocs, this, QueryWeight);
             }
 
             public override Explanation Explain(AtomicReaderContext context, int doc)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Search/MultiPhraseQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/MultiPhraseQuery.cs b/src/Lucene.Net.Core/Search/MultiPhraseQuery.cs
index ec4c8bc..9946385 100644
--- a/src/Lucene.Net.Core/Search/MultiPhraseQuery.cs
+++ b/src/Lucene.Net.Core/Search/MultiPhraseQuery.cs
@@ -223,7 +223,7 @@ namespace Lucene.Net.Search
             public override Scorer Scorer(AtomicReaderContext context, Bits acceptDocs)
             {
                 Debug.Assert(OuterInstance.termArrays.Count > 0);
-                AtomicReader reader = ((AtomicReader)context.Reader());
+                AtomicReader reader = (context.AtomicReader);
                 Bits liveDocs = acceptDocs;
 
                 PhraseQuery.PostingsAndFreq[] postingsFreqs = new PhraseQuery.PostingsAndFreq[OuterInstance.termArrays.Count];
@@ -321,7 +321,7 @@ namespace Lucene.Net.Search
 
             public override Explanation Explain(AtomicReaderContext context, int doc)
             {
-                Scorer scorer = Scorer(context, ((AtomicReader)context.Reader()).LiveDocs);
+                Scorer scorer = Scorer(context, (context.AtomicReader).LiveDocs);
                 if (scorer != null)
                 {
                     int newDoc = scorer.Advance(doc);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Search/MultiTermQueryWrapperFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/MultiTermQueryWrapperFilter.cs b/src/Lucene.Net.Core/Search/MultiTermQueryWrapperFilter.cs
index f97818c..9b3de74 100644
--- a/src/Lucene.Net.Core/Search/MultiTermQueryWrapperFilter.cs
+++ b/src/Lucene.Net.Core/Search/MultiTermQueryWrapperFilter.cs
@@ -99,8 +99,8 @@ namespace Lucene.Net.Search
         /// </summary>
         public override DocIdSet GetDocIdSet(AtomicReaderContext context, Bits acceptDocs)
         {
-            AtomicReader reader = ((AtomicReader)context.Reader());
-            Fields fields = reader.Fields();
+            AtomicReader reader = (context.AtomicReader);
+            Fields fields = reader.Fields;
             if (fields == null)
             {
                 // reader has no fields
@@ -119,7 +119,7 @@ namespace Lucene.Net.Search
             if (termsEnum.Next() != null)
             {
                 // fill into a FixedBitSet
-                FixedBitSet bitSet = new FixedBitSet(context.Reader().MaxDoc());
+                FixedBitSet bitSet = new FixedBitSet(context.AtomicReader.MaxDoc);
                 DocsEnum docsEnum = null;
                 do
                 {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Search/Payloads/PayloadNearQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/Payloads/PayloadNearQuery.cs b/src/Lucene.Net.Core/Search/Payloads/PayloadNearQuery.cs
index cf6043f..081a19d 100644
--- a/src/Lucene.Net.Core/Search/Payloads/PayloadNearQuery.cs
+++ b/src/Lucene.Net.Core/Search/Payloads/PayloadNearQuery.cs
@@ -176,7 +176,7 @@ namespace Lucene.Net.Search.Payloads
 
             public override Explanation Explain(AtomicReaderContext context, int doc)
             {
-                PayloadNearSpanScorer scorer = (PayloadNearSpanScorer)Scorer(context, ((AtomicReader)context.Reader()).LiveDocs);
+                PayloadNearSpanScorer scorer = (PayloadNearSpanScorer)Scorer(context, (context.AtomicReader).LiveDocs);
                 if (scorer != null)
                 {
                     int newDoc = scorer.Advance(doc);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Search/Payloads/PayloadSpanUtil.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/Payloads/PayloadSpanUtil.cs b/src/Lucene.Net.Core/Search/Payloads/PayloadSpanUtil.cs
index 7a66964..3772a1d 100644
--- a/src/Lucene.Net.Core/Search/Payloads/PayloadSpanUtil.cs
+++ b/src/Lucene.Net.Core/Search/Payloads/PayloadSpanUtil.cs
@@ -192,9 +192,9 @@ namespace Lucene.Net.Search.Payloads
             {
                 termContexts[term] = TermContext.Build(Context, term);
             }
-            foreach (AtomicReaderContext atomicReaderContext in Context.Leaves())
+            foreach (AtomicReaderContext atomicReaderContext in Context.Leaves)
             {
-                Spans spans = query.GetSpans(atomicReaderContext, ((AtomicReader)atomicReaderContext.Reader()).LiveDocs, termContexts);
+                Spans spans = query.GetSpans(atomicReaderContext, atomicReaderContext.AtomicReader.LiveDocs, termContexts);
                 while (spans.Next() == true)
                 {
                     if (spans.PayloadAvailable)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Search/Payloads/PayloadTermQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/Payloads/PayloadTermQuery.cs b/src/Lucene.Net.Core/Search/Payloads/PayloadTermQuery.cs
index 9a66351..8dd443f 100644
--- a/src/Lucene.Net.Core/Search/Payloads/PayloadTermQuery.cs
+++ b/src/Lucene.Net.Core/Search/Payloads/PayloadTermQuery.cs
@@ -185,7 +185,7 @@ namespace Lucene.Net.Search.Payloads
 
             public override Explanation Explain(AtomicReaderContext context, int doc)
             {
-                PayloadTermSpanScorer scorer = (PayloadTermSpanScorer)Scorer(context, ((AtomicReader)context.Reader()).LiveDocs);
+                PayloadTermSpanScorer scorer = (PayloadTermSpanScorer)Scorer(context, (context.AtomicReader).LiveDocs);
                 if (scorer != null)
                 {
                     int newDoc = scorer.Advance(doc);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Search/PhraseQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/PhraseQuery.cs b/src/Lucene.Net.Core/Search/PhraseQuery.cs
index 17083e0..b41f253 100644
--- a/src/Lucene.Net.Core/Search/PhraseQuery.cs
+++ b/src/Lucene.Net.Core/Search/PhraseQuery.cs
@@ -343,7 +343,7 @@ namespace Lucene.Net.Search
             public override Scorer Scorer(AtomicReaderContext context, Bits acceptDocs)
             {
                 Debug.Assert(OuterInstance.Terms_Renamed.Count > 0);
-                AtomicReader reader = ((AtomicReader)context.Reader());
+                AtomicReader reader = context.AtomicReader;
                 Bits liveDocs = acceptDocs;
                 PostingsAndFreq[] postingsFreqs = new PostingsAndFreq[OuterInstance.Terms_Renamed.Count];
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Search/QueryRescorer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/QueryRescorer.cs b/src/Lucene.Net.Core/Search/QueryRescorer.cs
index 2f97c30..b9a568e 100644
--- a/src/Lucene.Net.Core/Search/QueryRescorer.cs
+++ b/src/Lucene.Net.Core/Search/QueryRescorer.cs
@@ -56,7 +56,7 @@ namespace Lucene.Net.Search
             ScoreDoc[] hits = (ScoreDoc[])firstPassTopDocs.ScoreDocs.Clone();
             Array.Sort(hits, new ComparatorAnonymousInnerClassHelper(this));
 
-            IList<AtomicReaderContext> leaves = searcher.IndexReader.Leaves();
+            IList<AtomicReaderContext> leaves = searcher.IndexReader.Leaves;
 
             Weight weight = searcher.CreateNormalizedWeight(Query);
 
@@ -76,7 +76,7 @@ namespace Lucene.Net.Search
                 {
                     readerUpto++;
                     readerContext = leaves[readerUpto];
-                    endDoc = readerContext.DocBase + readerContext.Reader().MaxDoc();
+                    endDoc = readerContext.DocBase + readerContext.Reader.MaxDoc;
                 }
 
                 if (readerContext != null)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Search/Similarities/BM25Similarity.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/Similarities/BM25Similarity.cs b/src/Lucene.Net.Core/Search/Similarities/BM25Similarity.cs
index 3812dcf..962a984 100644
--- a/src/Lucene.Net.Core/Search/Similarities/BM25Similarity.cs
+++ b/src/Lucene.Net.Core/Search/Similarities/BM25Similarity.cs
@@ -98,7 +98,7 @@ namespace Lucene.Net.Search.Similarities
             }
             else
             {
-                return (float)(sumTotalTermFreq / (double)collectionStats.MaxDoc());
+                return (float)(sumTotalTermFreq / (double)collectionStats.MaxDoc);
             }
         }
 
@@ -188,7 +188,7 @@ namespace Lucene.Net.Search.Similarities
         public virtual Explanation IdfExplain(CollectionStatistics collectionStats, TermStatistics termStats)
         {
             long df = termStats.DocFreq();
-            long max = collectionStats.MaxDoc();
+            long max = collectionStats.MaxDoc;
             float idf = Idf(df, max);
             return new Explanation(idf, "idf(docFreq=" + df + ", maxDocs=" + max + ")");
         }
@@ -207,7 +207,7 @@ namespace Lucene.Net.Search.Similarities
         ///         for each term. </returns>
         public virtual Explanation IdfExplain(CollectionStatistics collectionStats, TermStatistics[] termStats)
         {
-            long max = collectionStats.MaxDoc();
+            long max = collectionStats.MaxDoc;
             float idf = 0.0f;
             Explanation exp = new Explanation();
             exp.Description = "idf(), sum of:";
@@ -240,7 +240,7 @@ namespace Lucene.Net.Search.Similarities
         public override sealed SimScorer DoSimScorer(SimWeight stats, AtomicReaderContext context)
         {
             BM25Stats bm25stats = (BM25Stats)stats;
-            return new BM25DocScorer(this, bm25stats, ((AtomicReader)context.Reader()).GetNormValues(bm25stats.Field));
+            return new BM25DocScorer(this, bm25stats, context.AtomicReader.GetNormValues(bm25stats.Field));
         }
 
         private class BM25DocScorer : SimScorer

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Search/Similarities/SimilarityBase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/Similarities/SimilarityBase.cs b/src/Lucene.Net.Core/Search/Similarities/SimilarityBase.cs
index 3d9a270..cba8439 100644
--- a/src/Lucene.Net.Core/Search/Similarities/SimilarityBase.cs
+++ b/src/Lucene.Net.Core/Search/Similarities/SimilarityBase.cs
@@ -107,7 +107,7 @@ namespace Lucene.Net.Search.Similarities
         {
             // #positions(field) must be >= #positions(term)
             Debug.Assert(collectionStats.SumTotalTermFreq() == -1 || collectionStats.SumTotalTermFreq() >= termStats.TotalTermFreq());
-            long numberOfDocuments = collectionStats.MaxDoc();
+            long numberOfDocuments = collectionStats.MaxDoc;
 
             long docFreq = termStats.DocFreq();
             long totalTermFreq = termStats.TotalTermFreq();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Search/Similarities/TFIDFSimilarity.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/Similarities/TFIDFSimilarity.cs b/src/Lucene.Net.Core/Search/Similarities/TFIDFSimilarity.cs
index 782e80f..230ffbc 100644
--- a/src/Lucene.Net.Core/Search/Similarities/TFIDFSimilarity.cs
+++ b/src/Lucene.Net.Core/Search/Similarities/TFIDFSimilarity.cs
@@ -574,7 +574,7 @@ namespace Lucene.Net.Search.Similarities
         public virtual Explanation IdfExplain(CollectionStatistics collectionStats, TermStatistics termStats)
         {
             long df = termStats.DocFreq();
-            long max = collectionStats.MaxDoc();
+            long max = collectionStats.MaxDoc;
             float idf = Idf(df, max);
             return new Explanation(idf, "idf(docFreq=" + df + ", maxDocs=" + max + ")");
         }
@@ -593,7 +593,7 @@ namespace Lucene.Net.Search.Similarities
         ///         for each term. </returns>
         public virtual Explanation IdfExplain(CollectionStatistics collectionStats, TermStatistics[] termStats)
         {
-            long max = collectionStats.MaxDoc();
+            long max = collectionStats.MaxDoc;
             float idf = 0.0f;
             Explanation exp = new Explanation();
             exp.Description = "idf(), sum of:";

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Search/SortRescorer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/SortRescorer.cs b/src/Lucene.Net.Core/Search/SortRescorer.cs
index 303e65e..59c25e6 100644
--- a/src/Lucene.Net.Core/Search/SortRescorer.cs
+++ b/src/Lucene.Net.Core/Search/SortRescorer.cs
@@ -46,7 +46,7 @@ namespace Lucene.Net.Search
             ScoreDoc[] hits = (ScoreDoc[])firstPassTopDocs.ScoreDocs.Clone();
             Array.Sort(hits, new ComparatorAnonymousInnerClassHelper(this));
 
-            IList<AtomicReaderContext> leaves = searcher.IndexReader.Leaves();
+            IList<AtomicReaderContext> leaves = searcher.IndexReader.Leaves;
 
             TopFieldCollector collector = TopFieldCollector.Create(sort, topN, true, true, true, false);
 
@@ -67,7 +67,7 @@ namespace Lucene.Net.Search
                 {
                     readerUpto++;
                     readerContext = leaves[readerUpto];
-                    endDoc = readerContext.DocBase + readerContext.Reader().MaxDoc();
+                    endDoc = readerContext.DocBase + readerContext.Reader.MaxDoc;
                 }
 
                 if (readerContext != null)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Search/Spans/SpanTermQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/Spans/SpanTermQuery.cs b/src/Lucene.Net.Core/Search/Spans/SpanTermQuery.cs
index 69f70be..e6e7567 100644
--- a/src/Lucene.Net.Core/Search/Spans/SpanTermQuery.cs
+++ b/src/Lucene.Net.Core/Search/Spans/SpanTermQuery.cs
@@ -130,7 +130,7 @@ namespace Lucene.Net.Search.Spans
             {
                 // this happens with span-not query, as it doesn't include the NOT side in extractTerms()
                 // so we seek to the term now in this segment..., this sucks because its ugly mostly!
-                Fields fields = context.AtomicReader.Fields();
+                Fields fields = context.AtomicReader.Fields;
                 if (fields != null)
                 {
                     Terms terms = fields.Terms(term.Field());

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Search/TermCollectingRewrite.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/TermCollectingRewrite.cs b/src/Lucene.Net.Core/Search/TermCollectingRewrite.cs
index c2cf294..b25de4d 100644
--- a/src/Lucene.Net.Core/Search/TermCollectingRewrite.cs
+++ b/src/Lucene.Net.Core/Search/TermCollectingRewrite.cs
@@ -51,9 +51,9 @@ namespace Lucene.Net.Search
         {
             IndexReaderContext topReaderContext = reader.Context;
             IComparer<BytesRef> lastTermComp = null;
-            foreach (AtomicReaderContext context in topReaderContext.Leaves())
+            foreach (AtomicReaderContext context in topReaderContext.Leaves)
             {
-                Fields fields = context.AtomicReader.Fields();
+                Fields fields = context.AtomicReader.Fields;
                 if (fields == null)
                 {
                     // reader has no fields

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.Core/Util/FieldCacheSanityChecker.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/FieldCacheSanityChecker.cs b/src/Lucene.Net.Core/Util/FieldCacheSanityChecker.cs
index 362a546..81b746a 100644
--- a/src/Lucene.Net.Core/Util/FieldCacheSanityChecker.cs
+++ b/src/Lucene.Net.Core/Util/FieldCacheSanityChecker.cs
@@ -296,12 +296,12 @@ namespace Lucene.Net.Util
                 {
                     try
                     {
-                        IList<IndexReaderContext> childs = reader.Context.Children();
+                        IList<IndexReaderContext> childs = reader.Context.Children;
                         if (childs != null) // it is composite reader
                         {
                             foreach (IndexReaderContext ctx in childs)
                             {
-                                all.Add(ctx.Reader().CoreCacheKey);
+                                all.Add(ctx.Reader.CoreCacheKey);
                             }
                         }
                     }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.TestFramework/Codecs/asserting/AssertingPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/asserting/AssertingPostingsFormat.cs b/src/Lucene.Net.TestFramework/Codecs/asserting/AssertingPostingsFormat.cs
index 9b1c404..c05a914 100644
--- a/src/Lucene.Net.TestFramework/Codecs/asserting/AssertingPostingsFormat.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/asserting/AssertingPostingsFormat.cs
@@ -85,9 +85,9 @@ namespace Lucene.Net.Codecs.asserting
                 return terms == null ? null : new AssertingAtomicReader.AssertingTerms(terms);
             }
 
-            public override int Size()
+            public override int Size
             {
-                return @in.Size();
+                get { return @in.Size; }
             }
 
             public override long UniqueTermCount

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.TestFramework/Codecs/ramonly/RAMOnlyPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Codecs/ramonly/RAMOnlyPostingsFormat.cs b/src/Lucene.Net.TestFramework/Codecs/ramonly/RAMOnlyPostingsFormat.cs
index 009ed6b..455e8dc 100644
--- a/src/Lucene.Net.TestFramework/Codecs/ramonly/RAMOnlyPostingsFormat.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/ramonly/RAMOnlyPostingsFormat.cs
@@ -111,9 +111,9 @@ namespace Lucene.Net.Codecs.ramonly
                 return FieldToTerms[field];
             }
 
-            public override int Size()
+            public override int Size
             {
-                return FieldToTerms.Count;
+                get { return FieldToTerms.Count; }
             }
 
             public override IEnumerator<string> GetEnumerator()

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e2f44e8e/src/Lucene.Net.TestFramework/Index/AllDeletedFilterReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/AllDeletedFilterReader.cs b/src/Lucene.Net.TestFramework/Index/AllDeletedFilterReader.cs
index 877d8a3..a14432c 100644
--- a/src/Lucene.Net.TestFramework/Index/AllDeletedFilterReader.cs
+++ b/src/Lucene.Net.TestFramework/Index/AllDeletedFilterReader.cs
@@ -31,8 +31,8 @@ namespace Lucene.Net.Index
         public AllDeletedFilterReader(AtomicReader @in)
             : base(@in)
         {
-            LiveDocs_Renamed = new Bits_MatchNoBits(@in.MaxDoc());
-            Debug.Assert(MaxDoc() == 0 || HasDeletions());
+            LiveDocs_Renamed = new Bits_MatchNoBits(@in.MaxDoc);
+            Debug.Assert(MaxDoc == 0 || HasDeletions);
         }
 
         public override Bits LiveDocs
@@ -43,9 +43,9 @@ namespace Lucene.Net.Index
             }
         }
 
-        public override int NumDocs()
+        public override int NumDocs
         {
-            return 0;
+            get { return 0; }
         }
     }
 }
\ No newline at end of file


Mime
View raw message