lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [49/50] [abbrv] lucenenet git commit: Lucene.Net.Core.Index.IndexWriter refactor: Changed Reader > GetReader()
Date Wed, 15 Mar 2017 23:50:31 GMT
Lucene.Net.Core.Index.IndexWriter refactor: Changed Reader > GetReader()


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

Branch: refs/heads/api-work
Commit: 85b18d2151c726651c6a72d2baaab2d604f953b4
Parents: d5f4734
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Thu Mar 16 06:35:16 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Thu Mar 16 06:35:16 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Index/IndexWriter.cs        |  7 +--
 .../Index/BaseDocValuesFormatTestCase.cs        |  4 +-
 .../Index/BaseMergePolicyTestCase.cs            |  2 +-
 .../Index/BaseStoredFieldsFormatTestCase.cs     |  2 +-
 .../Index/TestIndexSplitter.cs                  |  2 +-
 src/Lucene.Net.Tests/Index/TestCodecs.cs        |  2 +-
 .../Index/TestDirectoryReader.cs                | 12 ++--
 .../Index/TestDocValuesIndexing.cs              |  6 +-
 .../Index/TestDocValuesWithThreads.cs           |  2 +-
 src/Lucene.Net.Tests/Index/TestFlex.cs          |  4 +-
 .../Index/TestForceMergeForever.cs              |  2 +-
 src/Lucene.Net.Tests/Index/TestIndexWriter.cs   | 14 ++---
 .../Index/TestIndexWriterDelete.cs              |  4 +-
 .../Index/TestIndexWriterReader.cs              | 66 ++++++++++----------
 .../Index/TestIndexWriterUnicode.cs             |  2 +-
 src/Lucene.Net.Tests/Index/TestMultiFields.cs   |  6 +-
 .../Index/TestNRTReaderWithThreads.cs           |  4 +-
 src/Lucene.Net.Tests/Index/TestNRTThreads.cs    |  6 +-
 .../Index/TestPerSegmentDeletes.cs              |  4 +-
 .../Index/TestStressIndexing2.cs                |  2 +-
 20 files changed, 75 insertions(+), 78 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/85b18d21/src/Lucene.Net.Core/Index/IndexWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/IndexWriter.cs b/src/Lucene.Net.Core/Index/IndexWriter.cs
index 9593de8..e8370d6 100644
--- a/src/Lucene.Net.Core/Index/IndexWriter.cs
+++ b/src/Lucene.Net.Core/Index/IndexWriter.cs
@@ -277,12 +277,9 @@ namespace Lucene.Net.Index
         // to allow users to query an IndexWriter settings.
         private readonly LiveIndexWriterConfig config;
 
-        internal virtual DirectoryReader Reader // LUCENENET TODO API: Change to GetReader()
+        internal virtual DirectoryReader GetReader()
         {
-            get
-            {
-                return GetReader(true);
-            }
+            return GetReader(true);
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/85b18d21/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs b/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs
index 4fddb25..9c29f39 100644
--- a/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs
@@ -3034,7 +3034,7 @@ namespace Lucene.Net.Index
             DirectoryReader r;
             try
             {
-                r = w.Reader;
+                r = w.GetReader();
             }
             catch (System.ArgumentException iae)
             {
@@ -3136,7 +3136,7 @@ namespace Lucene.Net.Index
                 w.AddDocument(doc);
             }
 
-            DirectoryReader r = w.Reader;
+            DirectoryReader r = w.GetReader();
             w.Dispose();
 
             AtomicReader ar = SlowCompositeReaderWrapper.Wrap(r);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/85b18d21/src/Lucene.Net.TestFramework/Index/BaseMergePolicyTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/BaseMergePolicyTestCase.cs b/src/Lucene.Net.TestFramework/Index/BaseMergePolicyTestCase.cs
index 5da390d..b0f9fd1 100644
--- a/src/Lucene.Net.TestFramework/Index/BaseMergePolicyTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/BaseMergePolicyTestCase.cs
@@ -54,7 +54,7 @@ namespace Lucene.Net.Index
                 {
                     writer.AddDocument(new Document());
                 }
-                writer.Reader.Dispose();
+                writer.GetReader().Dispose();
             }
             for (int i = 5; i >= 0; --i)
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/85b18d21/src/Lucene.Net.TestFramework/Index/BaseStoredFieldsFormatTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/BaseStoredFieldsFormatTestCase.cs b/src/Lucene.Net.TestFramework/Index/BaseStoredFieldsFormatTestCase.cs
index 7e84095..7e8912b 100644
--- a/src/Lucene.Net.TestFramework/Index/BaseStoredFieldsFormatTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/BaseStoredFieldsFormatTestCase.cs
@@ -206,7 +206,7 @@ namespace Lucene.Net.Index
             doc.Add(NewField("aaa", "a b c", customType));
             doc.Add(NewField("zzz", "1 2 3", customType));
             w.AddDocument(doc);
-            IndexReader r = w.Reader;
+            IndexReader r = w.GetReader();
             Document doc2 = r.Document(0);
             IEnumerator<IIndexableField> it = doc2.Fields.GetEnumerator();
             Assert.IsTrue(it.MoveNext());

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/85b18d21/src/Lucene.Net.Tests.Misc/Index/TestIndexSplitter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Misc/Index/TestIndexSplitter.cs b/src/Lucene.Net.Tests.Misc/Index/TestIndexSplitter.cs
index eb70c94..073e875 100644
--- a/src/Lucene.Net.Tests.Misc/Index/TestIndexSplitter.cs
+++ b/src/Lucene.Net.Tests.Misc/Index/TestIndexSplitter.cs
@@ -67,7 +67,7 @@ namespace Lucene.Net.Index
                 iw.AddDocument(doc);
             }
             iw.Commit();
-            DirectoryReader iwReader = iw.Reader;
+            DirectoryReader iwReader = iw.GetReader();
             assertEquals(3, iwReader.Leaves.Count);
             iwReader.Dispose();
             iw.Dispose();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/85b18d21/src/Lucene.Net.Tests/Index/TestCodecs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestCodecs.cs b/src/Lucene.Net.Tests/Index/TestCodecs.cs
index fc4c1fe..fcc4093 100644
--- a/src/Lucene.Net.Tests/Index/TestCodecs.cs
+++ b/src/Lucene.Net.Tests/Index/TestCodecs.cs
@@ -543,7 +543,7 @@ namespace Lucene.Net.Index
 
         private ScoreDoc[] Search(IndexWriter writer, Query q, int n)
         {
-            IndexReader reader = writer.Reader;
+            IndexReader reader = writer.GetReader();
             IndexSearcher searcher = NewSearcher(reader);
             try
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/85b18d21/src/Lucene.Net.Tests/Index/TestDirectoryReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestDirectoryReader.cs b/src/Lucene.Net.Tests/Index/TestDirectoryReader.cs
index 14fea69..d1fe526 100644
--- a/src/Lucene.Net.Tests/Index/TestDirectoryReader.cs
+++ b/src/Lucene.Net.Tests/Index/TestDirectoryReader.cs
@@ -992,7 +992,7 @@ namespace Lucene.Net.Index
             Document d = new Document();
             d.Add(NewTextField("f", "a a b", Field.Store.NO));
             writer.AddDocument(d);
-            DirectoryReader r = writer.Reader;
+            DirectoryReader r = writer.GetReader();
             writer.Dispose();
             try
             {
@@ -1020,7 +1020,7 @@ namespace Lucene.Net.Index
             d = new Document();
             d.Add(NewTextField("f", "b", Field.Store.NO));
             writer.AddDocument(d);
-            DirectoryReader r = writer.Reader;
+            DirectoryReader r = writer.GetReader();
             writer.Dispose();
             try
             {
@@ -1046,7 +1046,7 @@ namespace Lucene.Net.Index
             d = new Document();
             d.Add(NewTextField("f", "a", Field.Store.NO));
             writer.AddDocument(d);
-            DirectoryReader r = writer.Reader;
+            DirectoryReader r = writer.GetReader();
             writer.Dispose();
             try
             {
@@ -1072,7 +1072,7 @@ namespace Lucene.Net.Index
             d = new Document();
             d.Add(NewTextField("f", "a a b", Field.Store.NO));
             writer.AddDocument(d);
-            DirectoryReader r = writer.Reader;
+            DirectoryReader r = writer.GetReader();
             writer.Dispose();
             try
             {
@@ -1098,7 +1098,7 @@ namespace Lucene.Net.Index
             writer.Commit();
             writer.AddDocument(new Document());
             writer.Commit();
-            DirectoryReader reader = writer.Reader;
+            DirectoryReader reader = writer.GetReader();
             int[] closeCount = new int[1];
             IndexReader.IReaderClosedListener listener = new ReaderClosedListenerAnonymousInnerClassHelper(this,
reader, closeCount);
 
@@ -1145,7 +1145,7 @@ namespace Lucene.Net.Index
             Directory dir = NewDirectory();
             IndexWriter writer = new IndexWriter(dir, NewIndexWriterConfig(TEST_VERSION_CURRENT,
new MockAnalyzer(Random())));
             writer.AddDocument(new Document());
-            DirectoryReader r = writer.Reader;
+            DirectoryReader r = writer.GetReader();
             writer.Dispose();
             r.Document(0);
             try

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/85b18d21/src/Lucene.Net.Tests/Index/TestDocValuesIndexing.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestDocValuesIndexing.cs b/src/Lucene.Net.Tests/Index/TestDocValuesIndexing.cs
index 5ee1a7a..3b91a0f 100644
--- a/src/Lucene.Net.Tests/Index/TestDocValuesIndexing.cs
+++ b/src/Lucene.Net.Tests/Index/TestDocValuesIndexing.cs
@@ -211,7 +211,7 @@ namespace Lucene.Net.Index
             bytes[0] = 1;
             w.AddDocument(doc);
             w.ForceMerge(1);
-            DirectoryReader r = w.Reader;
+            DirectoryReader r = w.GetReader();
             BinaryDocValues s = FieldCache.DEFAULT.GetTerms(GetOnlySegmentReader(r), "field",
false);
 
             BytesRef bytes1 = new BytesRef();
@@ -243,7 +243,7 @@ namespace Lucene.Net.Index
                 doc.Add(new TextField("docId", "" + i, Field.Store.YES));
                 writer.AddDocument(doc);
             }
-            DirectoryReader r = writer.Reader;
+            DirectoryReader r = writer.GetReader();
             AtomicReader slow = SlowCompositeReaderWrapper.Wrap(r);
             FieldInfos fi = slow.FieldInfos;
             FieldInfo dvInfo = fi.FieldInfo("dv");
@@ -933,7 +933,7 @@ namespace Lucene.Net.Index
             doc.Add(new NumericDocValuesField("dv", 0L));
             writer.AddDocument(doc);
 
-            DirectoryReader r = writer.Reader;
+            DirectoryReader r = writer.GetReader();
             writer.Dispose();
 
             AtomicReader subR = (AtomicReader)r.Leaves[0].Reader;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/85b18d21/src/Lucene.Net.Tests/Index/TestDocValuesWithThreads.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestDocValuesWithThreads.cs b/src/Lucene.Net.Tests/Index/TestDocValuesWithThreads.cs
index d7c971f..dbd6601 100644
--- a/src/Lucene.Net.Tests/Index/TestDocValuesWithThreads.cs
+++ b/src/Lucene.Net.Tests/Index/TestDocValuesWithThreads.cs
@@ -69,7 +69,7 @@ namespace Lucene.Net.Index
             }
 
             w.ForceMerge(1);
-            IndexReader r = w.Reader;
+            IndexReader r = w.GetReader();
             w.Dispose();
 
             Assert.AreEqual(1, r.Leaves.Count);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/85b18d21/src/Lucene.Net.Tests/Index/TestFlex.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestFlex.cs b/src/Lucene.Net.Tests/Index/TestFlex.cs
index f4141fb..5ec8de1 100644
--- a/src/Lucene.Net.Tests/Index/TestFlex.cs
+++ b/src/Lucene.Net.Tests/Index/TestFlex.cs
@@ -58,7 +58,7 @@ namespace Lucene.Net.Index
                     w.ForceMerge(1);
                 }
 
-                IndexReader r = w.Reader;
+                IndexReader r = w.GetReader();
 
                 TermsEnum terms = MultiFields.GetTerms(r, "field3").GetIterator(null);
                 Assert.AreEqual(TermsEnum.SeekStatus.END, terms.SeekCeil(new BytesRef("abc")));
@@ -78,7 +78,7 @@ namespace Lucene.Net.Index
             doc.Add(NewTextField("f", "a b c", Field.Store.NO));
             w.AddDocument(doc);
             w.ForceMerge(1);
-            DirectoryReader r = w.Reader;
+            DirectoryReader r = w.GetReader();
             TermsEnum terms = GetOnlySegmentReader(r).Fields.GetTerms("f").GetIterator(null);
             Assert.IsTrue(terms.Next() != null);
             try

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/85b18d21/src/Lucene.Net.Tests/Index/TestForceMergeForever.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestForceMergeForever.cs b/src/Lucene.Net.Tests/Index/TestForceMergeForever.cs
index 12145b1..742e032 100644
--- a/src/Lucene.Net.Tests/Index/TestForceMergeForever.cs
+++ b/src/Lucene.Net.Tests/Index/TestForceMergeForever.cs
@@ -131,7 +131,7 @@ namespace Lucene.Net.Index
                     {
                         w.UpdateDocument(new Term("docid", "" + Random().Next(NumStartDocs)),
Docs.NextDoc());
                         // Force deletes to apply
-                        w.Reader.Dispose();
+                        w.GetReader().Dispose();
                     }
                 }
                 catch (Exception t)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/85b18d21/src/Lucene.Net.Tests/Index/TestIndexWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriter.cs b/src/Lucene.Net.Tests/Index/TestIndexWriter.cs
index 06a8861..d78e16d 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriter.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriter.cs
@@ -1581,7 +1581,7 @@ namespace Lucene.Net.Index
             d.Add(f);
             w.AddDocument(d);
 
-            AtomicReader r = GetOnlySegmentReader(w.Reader);
+            AtomicReader r = GetOnlySegmentReader(w.GetReader());
             TermsEnum t = r.Fields.GetTerms("field").GetIterator(null);
             int count = 0;
             while (t.Next() != null)
@@ -1618,7 +1618,7 @@ namespace Lucene.Net.Index
                 if (iter == 0)
                 {
                     // use NRT
-                    r = w.Reader;
+                    r = w.GetReader();
                 }
                 else
                 {
@@ -2083,18 +2083,18 @@ namespace Lucene.Net.Index
             Document doc = new Document();
             doc.Add(NewStringField("id", "0", Field.Store.YES));
             w.AddDocument(doc);
-            DirectoryReader r = w.Reader;
+            DirectoryReader r = w.GetReader();
             long version = r.Version;
             r.Dispose();
 
             w.AddDocument(doc);
-            r = w.Reader;
+            r = w.GetReader();
             long version2 = r.Version;
             r.Dispose();
             Debug.Assert(version2 > version);
 
             w.DeleteDocuments(new Term("id", "0"));
-            r = w.Reader;
+            r = w.GetReader();
             w.Dispose();
             long version3 = r.Version;
             r.Dispose();
@@ -2573,7 +2573,7 @@ namespace Lucene.Net.Index
                     }
                 }
             }
-            DirectoryReader reader = w.Reader;
+            DirectoryReader reader = w.GetReader();
             Assert.AreEqual(docCount, reader.NumDocs);
             IList<AtomicReaderContext> leaves = reader.Leaves;
             foreach (AtomicReaderContext atomicReaderContext in leaves)
@@ -2831,7 +2831,7 @@ namespace Lucene.Net.Index
             // match field a's "foo":
             w.DeleteDocuments(new Term("a", "xxx"));
             w.DeleteDocuments(new Term("b", "foo"));
-            IndexReader r = w.Reader;
+            IndexReader r = w.GetReader();
             w.Dispose();
 
             // Make sure document was not (incorrectly) deleted:

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/85b18d21/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs
index 8f4083e..7c834d2 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterDelete.cs
@@ -481,7 +481,7 @@ namespace Lucene.Net.Index
             }
             modifier.Commit();
 
-            IndexReader reader = modifier.Reader;
+            IndexReader reader = modifier.GetReader();
             Assert.AreEqual(7, reader.NumDocs);
             reader.Dispose();
 
@@ -491,7 +491,7 @@ namespace Lucene.Net.Index
             // Delete all
             modifier.DeleteAll();
 
-            reader = modifier.Reader;
+            reader = modifier.GetReader();
             Assert.AreEqual(0, reader.NumDocs);
             reader.Dispose();
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/85b18d21/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs
index 423d874..2f0bf53 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterReader.cs
@@ -80,7 +80,7 @@ namespace Lucene.Net.Index
             IndexWriter writer = new IndexWriter(dir1, iwc);
             for (int i = 0; i < 97; i++)
             {
-                DirectoryReader reader = writer.Reader;
+                DirectoryReader reader = writer.GetReader();
                 if (i == 0)
                 {
                     writer.AddDocument(DocHelper.CreateDocument(i, "x", 1 + Random().Next(5)));
@@ -111,7 +111,7 @@ namespace Lucene.Net.Index
                 reader.Dispose();
             }
             writer.ForceMerge(1); // make sure all merging is done etc.
-            DirectoryReader dirReader = writer.Reader;
+            DirectoryReader dirReader = writer.GetReader();
             writer.Commit(); // no changes that are not visible to the reader
             Assert.IsTrue(dirReader.IsCurrent);
             writer.Dispose();
@@ -159,7 +159,7 @@ namespace Lucene.Net.Index
             // writer.Flush(false, true, true);
 
             // get a reader
-            DirectoryReader r1 = writer.Reader;
+            DirectoryReader r1 = writer.GetReader();
             Assert.IsTrue(r1.IsCurrent);
 
             string id10 = r1.Document(10).GetField("id").GetStringValue();
@@ -170,7 +170,7 @@ namespace Lucene.Net.Index
             writer.UpdateDocument(new Term("id", id10), newDoc);
             Assert.IsFalse(r1.IsCurrent);
 
-            DirectoryReader r2 = writer.Reader;
+            DirectoryReader r2 = writer.GetReader();
             Assert.IsTrue(r2.IsCurrent);
             Assert.AreEqual(0, Count(new Term("id", id10), r2));
             if (VERBOSE)
@@ -224,7 +224,7 @@ namespace Lucene.Net.Index
             writer = new IndexWriter(dir, iwc);
             doc = new Document();
             doc.Add(NewTextField("field", "a b c", Field.Store.NO));
-            DirectoryReader nrtReader = writer.Reader;
+            DirectoryReader nrtReader = writer.GetReader();
             Assert.IsTrue(nrtReader.IsCurrent);
             writer.AddDocument(doc);
             Assert.IsFalse(nrtReader.IsCurrent); // should see the changes
@@ -233,7 +233,7 @@ namespace Lucene.Net.Index
             nrtReader.Dispose();
 
             DirectoryReader dirReader = DirectoryReader.Open(dir);
-            nrtReader = writer.Reader;
+            nrtReader = writer.GetReader();
 
             Assert.IsTrue(dirReader.IsCurrent);
             Assert.IsTrue(nrtReader.IsCurrent); // nothing was committed yet so we are still
current
@@ -283,13 +283,13 @@ namespace Lucene.Net.Index
             CreateIndexNoClose(!doFullMerge, "index2", writer2);
             writer2.Dispose();
 
-            DirectoryReader r0 = writer.Reader;
+            DirectoryReader r0 = writer.GetReader();
             Assert.IsTrue(r0.IsCurrent);
             writer.AddIndexes(dir2);
             Assert.IsFalse(r0.IsCurrent);
             r0.Dispose();
 
-            DirectoryReader r1 = writer.Reader;
+            DirectoryReader r1 = writer.GetReader();
             Assert.IsTrue(r1.IsCurrent);
 
             writer.Commit();
@@ -357,7 +357,7 @@ namespace Lucene.Net.Index
             writer.AddIndexes(dir2);
             writer.AddIndexes(dir2);
 
-            IndexReader r1 = writer.Reader;
+            IndexReader r1 = writer.GetReader();
             Assert.AreEqual(500, r1.MaxDoc);
 
             r1.Dispose();
@@ -380,13 +380,13 @@ namespace Lucene.Net.Index
             CreateIndexNoClose(!doFullMerge, "index1", writer);
             writer.Flush(false, true);
             // get a reader
-            IndexReader r1 = writer.Reader;
+            IndexReader r1 = writer.GetReader();
 
             string id10 = r1.Document(10).GetField("id").GetStringValue();
 
             // deleted IW docs should not show up in the next getReader
             writer.DeleteDocuments(new Term("id", id10));
-            IndexReader r2 = writer.Reader;
+            IndexReader r2 = writer.GetReader();
             Assert.AreEqual(1, Count(new Term("id", id10), r1));
             Assert.AreEqual(0, Count(new Term("id", id10), r2));
 
@@ -395,13 +395,13 @@ namespace Lucene.Net.Index
 
             writer.DeleteDocuments(new Term("id", id50));
 
-            IndexReader r3 = writer.Reader;
+            IndexReader r3 = writer.GetReader();
             Assert.AreEqual(0, Count(new Term("id", id10), r3));
             Assert.AreEqual(0, Count(new Term("id", id50), r3));
 
             string id75 = r1.Document(75).GetField("id").GetStringValue();
             writer.DeleteDocuments(new TermQuery(new Term("id", id75)));
-            IndexReader r4 = writer.Reader;
+            IndexReader r4 = writer.GetReader();
             Assert.AreEqual(1, Count(new Term("id", id75), r3));
             Assert.AreEqual(0, Count(new Term("id", id75), r4));
 
@@ -413,7 +413,7 @@ namespace Lucene.Net.Index
 
             // reopen the writer to verify the delete made it to the directory
             writer = new IndexWriter(dir1, NewIndexWriterConfig(TEST_VERSION_CURRENT, new
MockAnalyzer(Random())));
-            IndexReader w2r1 = writer.Reader;
+            IndexReader w2r1 = writer.GetReader();
             Assert.AreEqual(0, Count(new Term("id", id10), w2r1));
             w2r1.Dispose();
             writer.Dispose();
@@ -652,15 +652,15 @@ namespace Lucene.Net.Index
         {
             Directory dir1 = GetAssertNoDeletesDirectory(NewDirectory());
             IndexWriter writer = new IndexWriter(dir1, NewIndexWriterConfig(TEST_VERSION_CURRENT,
new MockAnalyzer(Random())));
-            IndexReader r1 = writer.Reader;
+            IndexReader r1 = writer.GetReader();
             Assert.AreEqual(0, r1.MaxDoc);
             CreateIndexNoClose(false, "index1", writer);
             writer.Flush(!doFullMerge, true);
 
-            IndexReader iwr1 = writer.Reader;
+            IndexReader iwr1 = writer.GetReader();
             Assert.AreEqual(100, iwr1.MaxDoc);
 
-            IndexReader r2 = writer.Reader;
+            IndexReader r2 = writer.GetReader();
             Assert.AreEqual(r2.MaxDoc, 100);
             // add 100 documents
             for (int x = 10000; x < 10000 + 100; x++)
@@ -670,11 +670,11 @@ namespace Lucene.Net.Index
             }
             writer.Flush(false, true);
             // verify the reader was reopened internally
-            IndexReader iwr2 = writer.Reader;
+            IndexReader iwr2 = writer.GetReader();
             Assert.IsTrue(iwr2 != r1);
             Assert.AreEqual(200, iwr2.MaxDoc);
             // should have flushed out a segment
-            IndexReader r3 = writer.Reader;
+            IndexReader r3 = writer.GetReader();
             Assert.IsTrue(r2 != r3);
             Assert.AreEqual(200, r3.MaxDoc);
 
@@ -689,7 +689,7 @@ namespace Lucene.Net.Index
 
             // test whether the changes made it to the directory
             writer = new IndexWriter(dir1, NewIndexWriterConfig(TEST_VERSION_CURRENT, new
MockAnalyzer(Random())));
-            IndexReader w2r1 = writer.Reader;
+            IndexReader w2r1 = writer.GetReader();
             // insure the deletes were actually flushed to the directory
             Assert.AreEqual(200, w2r1.MaxDoc);
             w2r1.Dispose();
@@ -760,7 +760,7 @@ namespace Lucene.Net.Index
             CreateIndexNoClose(false, "test", writer);
 
             // get a reader to put writer into near real-time mode
-            IndexReader r1 = writer.Reader;
+            IndexReader r1 = writer.GetReader();
 
             ((LogMergePolicy)writer.Config.MergePolicy).MergeFactor = 2;
 
@@ -798,7 +798,7 @@ namespace Lucene.Net.Index
             CreateIndexNoClose(false, "test", writer);
 
             // get a reader to put writer into near real-time mode
-            DirectoryReader r1 = writer.Reader;
+            DirectoryReader r1 = writer.GetReader();
             TestUtil.CheckIndex(dir1);
             writer.Commit();
             TestUtil.CheckIndex(dir1);
@@ -832,7 +832,7 @@ namespace Lucene.Net.Index
             // create the index
             CreateIndexNoClose(false, "test", writer);
 
-            DirectoryReader r = writer.Reader;
+            DirectoryReader r = writer.GetReader();
             writer.Dispose();
 
             TestUtil.CheckIndex(dir1);
@@ -874,7 +874,7 @@ namespace Lucene.Net.Index
                 dirs[i] = new MockDirectoryWrapper(Random(), new RAMDirectory(dir1, NewIOContext(Random())));
             }
 
-            DirectoryReader r = writer.Reader;
+            DirectoryReader r = writer.GetReader();
 
             const float SECONDS = 0.5f;
 
@@ -989,7 +989,7 @@ namespace Lucene.Net.Index
             CreateIndexNoClose(false, "test", writer);
             writer.Commit();
 
-            DirectoryReader r = writer.Reader;
+            DirectoryReader r = writer.GetReader();
 
             const float SECONDS = 0.5f;
 
@@ -1102,7 +1102,7 @@ namespace Lucene.Net.Index
             w.AddDocument(doc);
             w.DeleteDocuments(new Term("id", "0"));
 
-            IndexReader r = w.Reader;
+            IndexReader r = w.GetReader();
             w.ForceMergeDeletes();
             w.Dispose();
             r.Dispose();
@@ -1126,17 +1126,17 @@ namespace Lucene.Net.Index
             w.AddDocument(doc);
             id.SetStringValue("1");
             w.AddDocument(doc);
-            IndexReader r = w.Reader;
+            IndexReader r = w.GetReader();
             Assert.AreEqual(2, r.NumDocs);
             r.Dispose();
 
             w.DeleteDocuments(new Term("id", "0"));
-            r = w.Reader;
+            r = w.GetReader();
             Assert.AreEqual(1, r.NumDocs);
             r.Dispose();
 
             w.DeleteDocuments(new Term("id", "1"));
-            r = w.Reader;
+            r = w.GetReader();
             Assert.AreEqual(0, r.NumDocs);
             r.Dispose();
 
@@ -1150,7 +1150,7 @@ namespace Lucene.Net.Index
             // Ensures that getReader works on an empty index, which hasn't been committed
yet.
             Directory dir = NewDirectory();
             IndexWriter w = new IndexWriter(dir, NewIndexWriterConfig(TEST_VERSION_CURRENT,
new MockAnalyzer(Random())));
-            IndexReader r = w.Reader;
+            IndexReader r = w.GetReader();
             Assert.AreEqual(0, r.NumDocs);
             r.Dispose();
             w.Dispose();
@@ -1292,7 +1292,7 @@ namespace Lucene.Net.Index
             Directory d = GetAssertNoDeletesDirectory(NewDirectory());
             IndexWriter w = new IndexWriter(d, NewIndexWriterConfig(TEST_VERSION_CURRENT,
new MockAnalyzer(Random())));
 
-            DirectoryReader r = w.Reader; // start pooling readers
+            DirectoryReader r = w.GetReader(); // start pooling readers
 
             DirectoryReader r2 = DirectoryReader.OpenIfChanged(r);
             Assert.IsNull(r2);
@@ -1337,7 +1337,7 @@ namespace Lucene.Net.Index
 
             // create a segment and open an NRT reader
             writer.AddDocument(new Document());
-            writer.Reader.Dispose();
+            writer.GetReader().Dispose();
 
             // add a new document so a new NRT reader is required
             writer.AddDocument(new Document());
@@ -1350,7 +1350,7 @@ namespace Lucene.Net.Index
                 shouldFail.Set(true);
                 try
                 {
-                    writer.Reader.Dispose();
+                    writer.GetReader().Dispose();
                 }
 #pragma warning disable 168
                 catch (FakeIOException e)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/85b18d21/src/Lucene.Net.Tests/Index/TestIndexWriterUnicode.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestIndexWriterUnicode.cs b/src/Lucene.Net.Tests/Index/TestIndexWriterUnicode.cs
index e9fdbf4..5064421 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexWriterUnicode.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexWriterUnicode.cs
@@ -277,7 +277,7 @@ namespace Lucene.Net.Index
             doc = new Document();
             doc.Add(NewTextField("field", "a", Field.Store.NO));
             w.AddDocument(doc);
-            IndexReader r = w.Reader;
+            IndexReader r = w.GetReader();
             Assert.AreEqual(1, r.DocFreq(new Term("field", "a\uffffb")));
             r.Dispose();
             w.Dispose();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/85b18d21/src/Lucene.Net.Tests/Index/TestMultiFields.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestMultiFields.cs b/src/Lucene.Net.Tests/Index/TestMultiFields.cs
index ec07d75..4198419 100644
--- a/src/Lucene.Net.Tests/Index/TestMultiFields.cs
+++ b/src/Lucene.Net.Tests/Index/TestMultiFields.cs
@@ -132,7 +132,7 @@ namespace Lucene.Net.Index
                     }
                 }
 
-                IndexReader reader = w.Reader;
+                IndexReader reader = w.GetReader();
                 w.Dispose();
                 if (VERBOSE)
                 {
@@ -196,7 +196,7 @@ namespace Lucene.Net.Index
             w.AddDocument(d);
             w.Commit();
             w.AddDocument(d);
-            IndexReader r = w.Reader;
+            IndexReader r = w.GetReader();
             w.Dispose();
             DocsEnum d1 = TestUtil.Docs(Random(), r, "f", new BytesRef("j"), null, null,
DocsFlags.NONE);
             DocsEnum d2 = TestUtil.Docs(Random(), r, "f", new BytesRef("j"), null, null,
DocsFlags.NONE);
@@ -216,7 +216,7 @@ namespace Lucene.Net.Index
             w.AddDocument(d);
             w.Commit();
             w.AddDocument(d);
-            IndexReader r = w.Reader;
+            IndexReader r = w.GetReader();
             w.Dispose();
             DocsEnum de = MultiFields.GetTermDocsEnum(r, null, "f", new BytesRef("j"));
             Assert.AreEqual(0, de.NextDoc());

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/85b18d21/src/Lucene.Net.Tests/Index/TestNRTReaderWithThreads.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestNRTReaderWithThreads.cs b/src/Lucene.Net.Tests/Index/TestNRTReaderWithThreads.cs
index 9c9abcc..da44078 100644
--- a/src/Lucene.Net.Tests/Index/TestNRTReaderWithThreads.cs
+++ b/src/Lucene.Net.Tests/Index/TestNRTReaderWithThreads.cs
@@ -49,7 +49,7 @@ namespace Lucene.Net.Index
                 wrapper.AssertNoDeleteOpenFile = true;
             }
             var writer = new IndexWriter(mainDir, NewIndexWriterConfig(TEST_VERSION_CURRENT,
new MockAnalyzer(Random())).SetMaxBufferedDocs(10).SetMergePolicy(NewLogMergePolicy(false,
2)));
-            IndexReader reader = writer.Reader; // start pooling readers
+            IndexReader reader = writer.GetReader(); // start pooling readers
             reader.Dispose();
             var indexThreads = new RunThread[4];
             for (int x = 0; x < indexThreads.Length; x++)
@@ -124,7 +124,7 @@ namespace Lucene.Net.Index
                         {
                             // we may or may not delete because the term may not exist,
                             // however we're opening and closing the reader rapidly
-                            IndexReader reader = Writer.Reader;
+                            IndexReader reader = Writer.GetReader();
                             int id = r.Next(OuterInstance.Seq.Get());
                             Term term = new Term("id", Convert.ToString(id));
                             int count = TestIndexWriterReader.Count(term, reader);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/85b18d21/src/Lucene.Net.Tests/Index/TestNRTThreads.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestNRTThreads.cs b/src/Lucene.Net.Tests/Index/TestNRTThreads.cs
index f6815cb..081a1ed 100644
--- a/src/Lucene.Net.Tests/Index/TestNRTThreads.cs
+++ b/src/Lucene.Net.Tests/Index/TestNRTThreads.cs
@@ -129,7 +129,7 @@ namespace Lucene.Net.Index
             // Force writer to do reader pooling, always, so that
             // all merged segments, even for merges before
             // doSearching is called, are warmed:
-            Writer.Reader.Dispose();
+            Writer.GetReader().Dispose();
         }
 
         private IndexSearcher FixedSearcher;
@@ -160,7 +160,7 @@ namespace Lucene.Net.Index
                 {
                     if (Random().NextBoolean())
                     {
-                        r2 = Writer.Reader;
+                        r2 = Writer.GetReader();
                     }
                     else
                     {
@@ -170,7 +170,7 @@ namespace Lucene.Net.Index
                 }
                 else
                 {
-                    r2 = Writer.Reader;
+                    r2 = Writer.GetReader();
                 }
                 return NewSearcher(r2);
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/85b18d21/src/Lucene.Net.Tests/Index/TestPerSegmentDeletes.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestPerSegmentDeletes.cs b/src/Lucene.Net.Tests/Index/TestPerSegmentDeletes.cs
index 1901abe..f928cb3 100644
--- a/src/Lucene.Net.Tests/Index/TestPerSegmentDeletes.cs
+++ b/src/Lucene.Net.Tests/Index/TestPerSegmentDeletes.cs
@@ -83,7 +83,7 @@ namespace Lucene.Net.Index
 
             // get reader flushes pending deletes
             // so there should not be anymore
-            IndexReader r1 = writer.Reader;
+            IndexReader r1 = writer.GetReader();
             Assert.IsFalse(writer.bufferedUpdatesStream.Any());
             r1.Dispose();
 
@@ -102,7 +102,7 @@ namespace Lucene.Net.Index
 
             // id:2 shouldn't exist anymore because
             // it's been applied in the merge and now it's gone
-            IndexReader r2 = writer.Reader;
+            IndexReader r2 = writer.GetReader();
             int[] id2docs = ToDocsArray(new Term("id", "2"), null, r2);
             Assert.IsTrue(id2docs == null);
             r2.Dispose();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/85b18d21/src/Lucene.Net.Tests/Index/TestStressIndexing2.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestStressIndexing2.cs b/src/Lucene.Net.Tests/Index/TestStressIndexing2.cs
index 43caffd..4ec2f82 100644
--- a/src/Lucene.Net.Tests/Index/TestStressIndexing2.cs
+++ b/src/Lucene.Net.Tests/Index/TestStressIndexing2.cs
@@ -74,7 +74,7 @@ namespace Lucene.Net.Index
 
             // TODO: verify equals using IW.getReader
             DocsAndWriter dw = IndexRandomIWReader(5, 3, 100, dir);
-            DirectoryReader reader = dw.Writer.Reader;
+            DirectoryReader reader = dw.Writer.GetReader();
             dw.Writer.Commit();
             VerifyEquals(Random(), reader, dir, "id");
             reader.Dispose();


Mime
View raw message