lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ccurr...@apache.org
Subject [Lucene.Net] svn commit: r1201357 [3/4] - in /incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk: src/core/ src/core/Search/ src/core/Search/Spans/ src/core/Support/ src/core/Util/ test/core/ test/core/Document/ test/core/Index/ test/core/Search/ test/core/Search...
Date Sat, 12 Nov 2011 23:51:44 GMT
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Index/TestIndexReaderReopen.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Index/TestIndexReaderReopen.cs?rev=1201357&r1=1201356&r2=1201357&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Index/TestIndexReaderReopen.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Index/TestIndexReaderReopen.cs Sat Nov 12 23:51:42 2011
@@ -43,318 +43,21 @@ namespace Lucene.Net.Index
     [TestFixture]
 	public class TestIndexReaderReopen:LuceneTestCase
 	{
-		private class AnonymousClassTestReopen:TestReopen
-		{
-			public AnonymousClassTestReopen(Lucene.Net.Store.Directory dir1, TestIndexReaderReopen enclosingInstance)
-			{
-				InitBlock(dir1, enclosingInstance);
-			}
-			private void  InitBlock(Lucene.Net.Store.Directory dir1, TestIndexReaderReopen enclosingInstance)
-			{
-				this.dir1 = dir1;
-				this.enclosingInstance = enclosingInstance;
-			}
-			private Lucene.Net.Store.Directory dir1;
-			private TestIndexReaderReopen enclosingInstance;
-			public TestIndexReaderReopen Enclosing_Instance
-			{
-				get
-				{
-					return enclosingInstance;
-				}
-				
-			}
-			
-			protected internal override void  ModifyIndex(int i)
-			{
-				TestIndexReaderReopen.ModifyIndex(i, dir1);
-			}
-			
-			protected internal override IndexReader OpenReader()
-			{
-				return IndexReader.Open(dir1);
-			}
-		}
-		private class AnonymousClassTestReopen1:TestReopen
-		{
-			public AnonymousClassTestReopen1(Lucene.Net.Store.Directory dir2, TestIndexReaderReopen enclosingInstance)
-			{
-				InitBlock(dir2, enclosingInstance);
-			}
-			private void  InitBlock(Lucene.Net.Store.Directory dir2, TestIndexReaderReopen enclosingInstance)
-			{
-				this.dir2 = dir2;
-				this.enclosingInstance = enclosingInstance;
-			}
-			private Lucene.Net.Store.Directory dir2;
-			private TestIndexReaderReopen enclosingInstance;
-			public TestIndexReaderReopen Enclosing_Instance
-			{
-				get
-				{
-					return enclosingInstance;
-				}
-				
-			}
-			
-			protected internal override void  ModifyIndex(int i)
-			{
-				TestIndexReaderReopen.ModifyIndex(i, dir2);
-			}
-			
-			protected internal override IndexReader OpenReader()
-			{
-				return IndexReader.Open(dir2);
-			}
-		}
-		private class AnonymousClassTestReopen2:TestReopen
-		{
-			public AnonymousClassTestReopen2(Lucene.Net.Store.Directory dir1, Lucene.Net.Store.Directory dir2, TestIndexReaderReopen enclosingInstance)
-			{
-				InitBlock(dir1, dir2, enclosingInstance);
-			}
-			private void  InitBlock(Lucene.Net.Store.Directory dir1, Lucene.Net.Store.Directory dir2, TestIndexReaderReopen enclosingInstance)
-			{
-				this.dir1 = dir1;
-				this.dir2 = dir2;
-				this.enclosingInstance = enclosingInstance;
-			}
-			private Lucene.Net.Store.Directory dir1;
-			private Lucene.Net.Store.Directory dir2;
-			private TestIndexReaderReopen enclosingInstance;
-			public TestIndexReaderReopen Enclosing_Instance
-			{
-				get
-				{
-					return enclosingInstance;
-				}
-				
-			}
-			
-			protected internal override void  ModifyIndex(int i)
-			{
-				TestIndexReaderReopen.ModifyIndex(i, dir1);
-				TestIndexReaderReopen.ModifyIndex(i, dir2);
-			}
-			
-			protected internal override IndexReader OpenReader()
-			{
-				ParallelReader pr = new ParallelReader();
-				pr.Add(IndexReader.Open(dir1));
-				pr.Add(IndexReader.Open(dir2));
-				return pr;
-			}
-		}
-		private class AnonymousClassTestReopen3:TestReopen
-		{
-			public AnonymousClassTestReopen3(Lucene.Net.Store.Directory dir3, Lucene.Net.Store.Directory dir4, TestIndexReaderReopen enclosingInstance)
-			{
-				InitBlock(dir3, dir4, enclosingInstance);
-			}
-			private void  InitBlock(Lucene.Net.Store.Directory dir3, Lucene.Net.Store.Directory dir4, TestIndexReaderReopen enclosingInstance)
-			{
-				this.dir3 = dir3;
-				this.dir4 = dir4;
-				this.enclosingInstance = enclosingInstance;
-			}
-			private Lucene.Net.Store.Directory dir3;
-			private Lucene.Net.Store.Directory dir4;
-			private TestIndexReaderReopen enclosingInstance;
-			public TestIndexReaderReopen Enclosing_Instance
-			{
-				get
-				{
-					return enclosingInstance;
-				}
-				
-			}
-			
-			protected internal override void  ModifyIndex(int i)
-			{
-				TestIndexReaderReopen.ModifyIndex(i, dir3);
-				TestIndexReaderReopen.ModifyIndex(i, dir4);
-			}
-			
-			protected internal override IndexReader OpenReader()
-			{
-				ParallelReader pr = new ParallelReader();
-				pr.Add(IndexReader.Open(dir3));
-				pr.Add(IndexReader.Open(dir4));
-				// Does not implement reopen, so
-				// hits exception:
-				pr.Add(new FilterIndexReader(IndexReader.Open(dir3)));
-				return pr;
-			}
-		}
-		private class AnonymousClassTestReopen4:TestReopen
-		{
-			public AnonymousClassTestReopen4(Lucene.Net.Store.Directory dir1, Lucene.Net.Store.Directory dir2, TestIndexReaderReopen enclosingInstance)
-			{
-				InitBlock(dir1, dir2, enclosingInstance);
-			}
-			private void  InitBlock(Lucene.Net.Store.Directory dir1, Lucene.Net.Store.Directory dir2, TestIndexReaderReopen enclosingInstance)
-			{
-				this.dir1 = dir1;
-				this.dir2 = dir2;
-				this.enclosingInstance = enclosingInstance;
-			}
-			private Lucene.Net.Store.Directory dir1;
-			private Lucene.Net.Store.Directory dir2;
-			private TestIndexReaderReopen enclosingInstance;
-			public TestIndexReaderReopen Enclosing_Instance
-			{
-				get
-				{
-					return enclosingInstance;
-				}
-				
-			}
-			
-			protected internal override void  ModifyIndex(int i)
-			{
-				TestIndexReaderReopen.ModifyIndex(i, dir1);
-				TestIndexReaderReopen.ModifyIndex(i, dir2);
-			}
-			
-			protected internal override IndexReader OpenReader()
-			{
-				return new MultiReader(new IndexReader[]{IndexReader.Open(dir1), IndexReader.Open(dir2)});
-			}
-		}
-		private class AnonymousClassTestReopen5:TestReopen
-		{
-			public AnonymousClassTestReopen5(Lucene.Net.Store.Directory dir3, Lucene.Net.Store.Directory dir4, TestIndexReaderReopen enclosingInstance)
-			{
-				InitBlock(dir3, dir4, enclosingInstance);
-			}
-			private void  InitBlock(Lucene.Net.Store.Directory dir3, Lucene.Net.Store.Directory dir4, TestIndexReaderReopen enclosingInstance)
-			{
-				this.dir3 = dir3;
-				this.dir4 = dir4;
-				this.enclosingInstance = enclosingInstance;
-			}
-			private Lucene.Net.Store.Directory dir3;
-			private Lucene.Net.Store.Directory dir4;
-			private TestIndexReaderReopen enclosingInstance;
-			public TestIndexReaderReopen Enclosing_Instance
-			{
-				get
-				{
-					return enclosingInstance;
-				}
-				
-			}
-			
-			protected internal override void  ModifyIndex(int i)
-			{
-				TestIndexReaderReopen.ModifyIndex(i, dir3);
-				TestIndexReaderReopen.ModifyIndex(i, dir4);
-			}
-			
-			protected internal override IndexReader OpenReader()
-			{
-				return new MultiReader(new IndexReader[]{IndexReader.Open(dir3), IndexReader.Open(dir4), new FilterIndexReader(IndexReader.Open(dir3))});
-			}
-		}
-		private class AnonymousClassTestReopen6:TestReopen
-		{
-			public AnonymousClassTestReopen6(Lucene.Net.Store.Directory dir1, Lucene.Net.Store.Directory dir4, Lucene.Net.Store.Directory dir5, Lucene.Net.Store.Directory dir2, Lucene.Net.Store.Directory dir3, TestIndexReaderReopen enclosingInstance)
-			{
-				InitBlock(dir1, dir4, dir5, dir2, dir3, enclosingInstance);
-			}
-			private void  InitBlock(Lucene.Net.Store.Directory dir1, Lucene.Net.Store.Directory dir4, Lucene.Net.Store.Directory dir5, Lucene.Net.Store.Directory dir2, Lucene.Net.Store.Directory dir3, TestIndexReaderReopen enclosingInstance)
-			{
-				this.dir1 = dir1;
-				this.dir4 = dir4;
-				this.dir5 = dir5;
-				this.dir2 = dir2;
-				this.dir3 = dir3;
-				this.enclosingInstance = enclosingInstance;
-			}
-			private Lucene.Net.Store.Directory dir1;
-			private Lucene.Net.Store.Directory dir4;
-			private Lucene.Net.Store.Directory dir5;
-			private Lucene.Net.Store.Directory dir2;
-			private Lucene.Net.Store.Directory dir3;
-			private TestIndexReaderReopen enclosingInstance;
-			public TestIndexReaderReopen Enclosing_Instance
-			{
-				get
-				{
-					return enclosingInstance;
-				}
-				
-			}
-			
-			protected internal override void  ModifyIndex(int i)
-			{
-				// only change norms in this index to maintain the same number of docs for each of ParallelReader's subreaders
-				if (i == 1)
-					TestIndexReaderReopen.ModifyIndex(i, dir1);
-				
-				TestIndexReaderReopen.ModifyIndex(i, dir4);
-				TestIndexReaderReopen.ModifyIndex(i, dir5);
-			}
-			
-			protected internal override IndexReader OpenReader()
-			{
-				ParallelReader pr = new ParallelReader();
-				pr.Add(IndexReader.Open(dir1));
-				pr.Add(IndexReader.Open(dir2));
-				MultiReader mr = new MultiReader(new IndexReader[]{IndexReader.Open(dir3), IndexReader.Open(dir4)});
-				return new MultiReader(new IndexReader[]{pr, mr, IndexReader.Open(dir5)});
-			}
-		}
-		private class AnonymousClassTestReopen7:TestReopen
-		{
-			public AnonymousClassTestReopen7(Lucene.Net.Store.Directory dir, int n, TestIndexReaderReopen enclosingInstance)
-			{
-				InitBlock(dir, n, enclosingInstance);
-			}
-			private void  InitBlock(Lucene.Net.Store.Directory dir, int n, TestIndexReaderReopen enclosingInstance)
-			{
-				this.dir = dir;
-				this.n = n;
-				this.enclosingInstance = enclosingInstance;
-			}
-			private Lucene.Net.Store.Directory dir;
-			private int n;
-			private TestIndexReaderReopen enclosingInstance;
-			public TestIndexReaderReopen Enclosing_Instance
-			{
-				get
-				{
-					return enclosingInstance;
-				}
-				
-			}
-			protected internal override void  ModifyIndex(int i)
-			{
-				if (i % 3 == 0)
-				{
-					IndexReader modifier = IndexReader.Open(dir);
-					modifier.SetNorm(i, "field1", 50);
-					modifier.Close();
-				}
-				else if (i % 3 == 1)
-				{
-					IndexReader modifier = IndexReader.Open(dir);
-					modifier.DeleteDocument(i % modifier.MaxDoc());
-					modifier.Close();
-				}
-				else
-				{
-					IndexWriter modifier = new IndexWriter(dir, new StandardAnalyzer(), IndexWriter.MaxFieldLength.LIMITED);
-					modifier.AddDocument(Lucene.Net.Index.TestIndexReaderReopen.CreateDocument(n + i, 6));
-					modifier.Close();
-				}
-			}
-			
-			protected internal override IndexReader OpenReader()
-			{
-				return IndexReader.Open(dir);
-			}
-		}
+        private class InjectableTestReopen : TestReopen
+        {
+            public Func<IndexReader> OpenReaderFunc { get; set; }
+            public Action<int> ModifyIndexAction { get; set; }
+            protected internal override IndexReader OpenReader()
+            {
+                return OpenReaderFunc.Invoke();
+            }
+
+            protected internal override void ModifyIndex(int i)
+            {
+                ModifyIndexAction.Invoke(i);
+            }
+        }
+
 		private class AnonymousClassReaderThreadTask:ReaderThreadTask
 		{
 			public AnonymousClassReaderThreadTask(int index, Lucene.Net.Index.IndexReader r, Lucene.Net.Index.TestIndexReaderReopen.TestReopen test, System.Collections.Hashtable readersToClose, System.Collections.IList readers, System.Random rnd, TestIndexReaderReopen enclosingInstance)
@@ -475,7 +178,7 @@ namespace Lucene.Net.Index
 			}
 		}
 		
-		private System.IO.FileInfo indexDir;
+		private System.IO.DirectoryInfo indexDir;
 		
 		[Test]
 		public virtual void  TestReopen_Renamed()
@@ -483,13 +186,21 @@ namespace Lucene.Net.Index
 			Directory dir1 = new MockRAMDirectory();
 			
 			CreateIndex(dir1, false);
-			PerformDefaultTests(new AnonymousClassTestReopen(dir1, this));
+		    PerformDefaultTests(new InjectableTestReopen
+		                            {
+		                                ModifyIndexAction = i => ModifyIndex(i, dir1),
+		                                OpenReaderFunc = () => IndexReader.Open(dir1, false)
+                                    });
 			dir1.Close();
 			
 			Directory dir2 = new MockRAMDirectory();
 			
 			CreateIndex(dir2, true);
-			PerformDefaultTests(new AnonymousClassTestReopen1(dir2, this));
+		    PerformDefaultTests(new InjectableTestReopen
+		                            {
+		                                ModifyIndexAction = i => ModifyIndex(i, dir2),
+                                        OpenReaderFunc = () => IndexReader.Open(dir2, false)
+                                     });
 			dir2.Close();
 		}
 		
@@ -501,7 +212,21 @@ namespace Lucene.Net.Index
 			Directory dir2 = new MockRAMDirectory();
 			CreateIndex(dir2, true);
 			
-			PerformDefaultTests(new AnonymousClassTestReopen2(dir1, dir2, this));
+            PerformDefaultTests(new InjectableTestReopen
+                                    {
+                                        ModifyIndexAction = i =>
+                                                                {
+                                                                    ModifyIndex(i, dir1);
+                                                                    ModifyIndex(i, dir2);
+                                                                },
+                                        OpenReaderFunc = () =>
+                                                             {
+                                                                 ParallelReader pr = new ParallelReader();
+                                                                 pr.Add(IndexReader.Open(dir1, false));
+                                                                 pr.Add(IndexReader.Open(dir2, false));
+                                                                 return pr;
+                                                             }
+                                    });
 			dir1.Close();
 			dir2.Close();
 			
@@ -510,7 +235,24 @@ namespace Lucene.Net.Index
 			Directory dir4 = new MockRAMDirectory();
 			CreateIndex(dir4, true);
 			
-			PerformTestsWithExceptionInReopen(new AnonymousClassTestReopen3(dir3, dir4, this));
+            PerformTestsWithExceptionInReopen(new InjectableTestReopen
+                                                  {
+                                                      ModifyIndexAction = i =>
+                                                                              {
+                                                                                  ModifyIndex(i, dir3);
+                                                                                  ModifyIndex(i, dir4);
+                                                                              },
+                                                      OpenReaderFunc = () =>
+                                                                           {
+                                                                               ParallelReader pr = new ParallelReader();
+                                                                               pr.Add(IndexReader.Open(dir3, false));
+                                                                               pr.Add(IndexReader.Open(dir4, false));
+                                                                               // Does not implement reopen, so
+                                                                               // hits exception:
+                                                                               pr.Add(new FilterIndexReader(IndexReader.Open(dir3, false)));
+                                                                               return pr;
+                                                                           }
+                                                  });
 			dir3.Close();
 			dir4.Close();
 		}
@@ -552,7 +294,7 @@ namespace Lucene.Net.Index
 		{
 			IndexWriter iwriter = new IndexWriter(dir, new KeywordAnalyzer(), true, MaxFieldLength.LIMITED);
 			iwriter.SetMergeScheduler(new SerialMergeScheduler());
-			IndexReader reader = IndexReader.Open(dir);
+			IndexReader reader = IndexReader.Open(dir, false);
 			try
 			{
 				int M = 3;
@@ -590,7 +332,7 @@ namespace Lucene.Net.Index
 					{
 						// recreate
 						reader.Close();
-						reader = IndexReader.Open(dir);
+						reader = IndexReader.Open(dir, false);
 					}
 				}
 			}
@@ -611,7 +353,19 @@ namespace Lucene.Net.Index
 			Directory dir2 = new MockRAMDirectory();
 			CreateIndex(dir2, true);
 			
-			PerformDefaultTests(new AnonymousClassTestReopen4(dir1, dir2, this));
+            PerformDefaultTests(new InjectableTestReopen
+                                    {
+                                        ModifyIndexAction = i =>
+                                                                {
+                                                                    ModifyIndex(i, dir1);
+                                                                    ModifyIndex(i, dir2);
+                                                                },
+                                        OpenReaderFunc = () => new MultiReader(new[]
+                                                                                   {
+                                                                                       IndexReader.Open(dir1, false),
+                                                                                       IndexReader.Open(dir2, false)
+                                                                                   })
+                                    });
 			
 			dir1.Close();
 			dir2.Close();
@@ -621,8 +375,23 @@ namespace Lucene.Net.Index
 			
 			Directory dir4 = new MockRAMDirectory();
 			CreateIndex(dir4, true);
-			
-			PerformTestsWithExceptionInReopen(new AnonymousClassTestReopen5(dir3, dir4, this));
+
+		    PerformTestsWithExceptionInReopen(new InjectableTestReopen
+		                                          {
+		                                              ModifyIndexAction = i =>
+		                                                                      {
+		                                                                          ModifyIndex(i, dir3);
+		                                                                          ModifyIndex(i, dir4);
+		                                                                      },
+		                                              OpenReaderFunc = () => new MultiReader(new[]
+		                                                                                         {
+		                                                                                             IndexReader.Open(dir3, false),
+		                                                                                             IndexReader.Open(dir4, false),
+		                                                                                             //does not implement reopen,
+		                                                                                             //so hits exception
+		                                                                                             new FilterIndexReader(IndexReader.Open(dir3, false))
+		                                                                                         })
+		                                          });
 			dir3.Close();
 			dir4.Close();
 		}
@@ -641,7 +410,29 @@ namespace Lucene.Net.Index
 			Directory dir5 = new MockRAMDirectory();
 			CreateIndex(dir5, false);
 			
-			PerformDefaultTests(new AnonymousClassTestReopen6(dir1, dir4, dir5, dir2, dir3, this));
+			//PerformDefaultTests(new AnonymousClassTestReopen6(dir1, dir4, dir5, dir2, dir3, this));
+            PerformDefaultTests(new InjectableTestReopen
+                                    {
+                                        ModifyIndexAction = i =>
+                                                                {
+                                                                    // only change norms in this index to maintain the same number of docs for each of ParallelReader's subreaders
+                                                                    if (i == 1) ModifyIndex(i, dir1);
+                                                                    ModifyIndex(i, dir4);
+                                                                    ModifyIndex(i, dir5);
+                                                                },
+                                        OpenReaderFunc = () =>
+                                                             {
+                                                                 ParallelReader pr = new ParallelReader();
+                                                                 pr.Add(IndexReader.Open(dir1, false));
+                                                                 pr.Add(IndexReader.Open(dir2, false));
+                                                                 MultiReader mr = new MultiReader(new []{IndexReader.Open(dir3, false), IndexReader.Open(dir4, false)});
+                                                                 return new MultiReader(new[]
+                                                                                             {
+                                                                                                 pr, mr,
+                                                                                                 IndexReader.Open(dir5, false)
+                                                                                             });
+                                                             }
+                                    });
 			dir1.Close();
 			dir2.Close();
 			dir3.Close();
@@ -706,7 +497,7 @@ namespace Lucene.Net.Index
 				Directory dir1 = new MockRAMDirectory();
 				CreateIndex(dir1, true);
 				
-				IndexReader reader0 = IndexReader.Open(dir1);
+				IndexReader reader0 = IndexReader.Open(dir1, false);
 				AssertRefCountEquals(1, reader0);
 				
 				Assert.IsTrue(reader0 is DirectoryReader);
@@ -717,7 +508,7 @@ namespace Lucene.Net.Index
 				}
 				
 				// delete first document, so that only one of the subReaders have to be re-opened
-				IndexReader modifier = IndexReader.Open(dir1);
+				IndexReader modifier = IndexReader.Open(dir1, false);
 				modifier.DeleteDocument(0);
 				modifier.Close();
 				
@@ -740,7 +531,7 @@ namespace Lucene.Net.Index
 				}
 				
 				// delete first document, so that only one of the subReaders have to be re-opened
-				modifier = IndexReader.Open(dir1);
+				modifier = IndexReader.Open(dir1, false);
 				modifier.DeleteDocument(1);
 				modifier.Close();
 				
@@ -836,10 +627,10 @@ namespace Lucene.Net.Index
 				Directory dir2 = new MockRAMDirectory();
 				CreateIndex(dir2, true);
 				
-				IndexReader reader1 = IndexReader.Open(dir1);
+				IndexReader reader1 = IndexReader.Open(dir1, false);
 				AssertRefCountEquals(1, reader1);
 				
-				IndexReader initReader2 = IndexReader.Open(dir2);
+				IndexReader initReader2 = IndexReader.Open(dir2, false);
 				IndexReader multiReader1 = new MultiReader(new IndexReader[]{reader1, initReader2}, (mode == 0));
 				ModifyIndex(0, dir2);
 				AssertRefCountEquals(1 + mode, reader1);
@@ -911,12 +702,12 @@ namespace Lucene.Net.Index
 				Directory dir2 = new MockRAMDirectory();
 				CreateIndex(dir2, true);
 				
-				IndexReader reader1 = IndexReader.Open(dir1);
+				IndexReader reader1 = IndexReader.Open(dir1, false);
 				AssertRefCountEquals(1, reader1);
 				
 				ParallelReader parallelReader1 = new ParallelReader(mode == 0);
 				parallelReader1.Add(reader1);
-				IndexReader initReader2 = IndexReader.Open(dir2);
+                IndexReader initReader2 = IndexReader.Open(dir2, false);
 				parallelReader1.Add(initReader2);
 				ModifyIndex(1, dir2);
 				AssertRefCountEquals(1 + mode, reader1);
@@ -985,27 +776,27 @@ namespace Lucene.Net.Index
 		{
 			Directory dir1 = new MockRAMDirectory();
 			CreateIndex(dir1, false);
-			
-			IndexReader reader1 = IndexReader.Open(dir1);
+
+            IndexReader reader1 = IndexReader.Open(dir1, false);
 			SegmentReader segmentReader1 = SegmentReader.GetOnlySegmentReader(reader1);
-			IndexReader modifier = IndexReader.Open(dir1);
+            IndexReader modifier = IndexReader.Open(dir1, false);
 			modifier.DeleteDocument(0);
 			modifier.Close();
 			
 			IndexReader reader2 = reader1.Reopen();
-			modifier = IndexReader.Open(dir1);
+            modifier = IndexReader.Open(dir1, false);
 			modifier.SetNorm(1, "field1", 50);
 			modifier.SetNorm(1, "field2", 50);
 			modifier.Close();
 			
 			IndexReader reader3 = reader2.Reopen();
 			SegmentReader segmentReader3 = SegmentReader.GetOnlySegmentReader(reader3);
-			modifier = IndexReader.Open(dir1);
+            modifier = IndexReader.Open(dir1, false);
 			modifier.DeleteDocument(2);
 			modifier.Close();
 			
 			IndexReader reader4 = reader3.Reopen();
-			modifier = IndexReader.Open(dir1);
+            modifier = IndexReader.Open(dir1, false);
 			modifier.DeleteDocument(3);
 			modifier.Close();
 			
@@ -1082,18 +873,48 @@ namespace Lucene.Net.Index
 			Directory dir = new MockRAMDirectory();
 			int n = 150;
 			
-			IndexWriter writer = new IndexWriter(dir, new StandardAnalyzer(), IndexWriter.MaxFieldLength.LIMITED);
+			IndexWriter writer = new IndexWriter(dir, new StandardAnalyzer(Util.Version.LUCENE_CURRENT), IndexWriter.MaxFieldLength.LIMITED);
 			for (int i = 0; i < n; i++)
 			{
 				writer.AddDocument(CreateDocument(i, 3));
 			}
 			writer.Optimize();
 			writer.Close();
-			
-			TestReopen test = new AnonymousClassTestReopen7(dir, n, this);
+
+		    TestReopen test = new InjectableTestReopen
+		                          {
+                                      OpenReaderFunc = () => IndexReader.Open(dir, false),
+		                              ModifyIndexAction = i =>
+		                                                      {
+		                                                          if (i%3 == 0)
+		                                                          {
+		                                                              IndexReader modifier = IndexReader.Open(dir, false);
+		                                                              modifier.SetNorm(i, "field1", 50);
+		                                                              modifier.Close();
+		                                                          }
+		                                                          else if (i%3 == 1)
+		                                                          {
+		                                                              IndexReader modifier = IndexReader.Open(dir, false);
+		                                                              modifier.DeleteDocument(i%modifier.MaxDoc());
+		                                                              modifier.Close();
+		                                                          }
+		                                                          else
+		                                                          {
+		                                                              IndexWriter modifier = new IndexWriter(dir,
+		                                                                                                     new StandardAnalyzer
+		                                                                                                         (Util.Version
+		                                                                                                              .
+		                                                                                                              LUCENE_CURRENT),
+		                                                                                                     IndexWriter.
+		                                                                                                         MaxFieldLength
+		                                                                                                         .LIMITED);
+		                                                              modifier.AddDocument(CreateDocument(n + i, 6));
+		                                                              modifier.Close();
+		                                                          }
+		                                                      }};
 			
 			System.Collections.IList readers = (System.Collections.IList) System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(new System.Collections.ArrayList()));
-			IndexReader firstReader = IndexReader.Open(dir);
+			IndexReader firstReader = IndexReader.Open(dir, false);
 			IndexReader reader = firstReader;
 			System.Random rnd = NewRandom();
 			
@@ -1293,7 +1114,7 @@ namespace Lucene.Net.Index
 				w.AddDocument(CreateDocument(i, 4));
 				if (multiSegment && (i % 10) == 0)
 				{
-					w.Flush();
+					w.Commit();
 				}
 			}
 			
@@ -1304,7 +1125,7 @@ namespace Lucene.Net.Index
 			
 			w.Close();
 			
-			IndexReader r = IndexReader.Open(dir);
+			IndexReader r = IndexReader.Open(dir, false);
 			if (multiSegment)
 			{
 				Assert.IsTrue(r.GetSequentialSubReaders().Length > 1);
@@ -1348,7 +1169,7 @@ namespace Lucene.Net.Index
 					}
 				
 				case 1:  {
-						IndexReader reader = IndexReader.Open(dir);
+						IndexReader reader = IndexReader.Open(dir, false);
 						reader.SetNorm(4, "field1", 123);
 						reader.SetNorm(44, "field2", 222);
 						reader.SetNorm(44, "field4", 22);
@@ -1374,7 +1195,7 @@ namespace Lucene.Net.Index
 					}
 				
 				case 4:  {
-						IndexReader reader = IndexReader.Open(dir);
+						IndexReader reader = IndexReader.Open(dir, false);
 						reader.SetNorm(5, "field1", 123);
 						reader.SetNorm(55, "field2", 222);
 						reader.Close();
@@ -1463,85 +1284,15 @@ namespace Lucene.Net.Index
 			System.String tempDir = System.IO.Path.GetTempPath();
 			if (tempDir == null)
 				throw new System.IO.IOException("java.io.tmpdir undefined, cannot run test");
-			indexDir = new System.IO.FileInfo(System.IO.Path.Combine(tempDir, "IndexReaderReopen"));
-		}
-		
-		// LUCENE-1453
-		[Test]
-		public virtual void  TestFSDirectoryReopen()
-		{
-			Directory dir1 = FSDirectory.GetDirectory(indexDir, null);
-			CreateIndex(dir1, false);
-			dir1.Close();
-			
-			IndexReader ir = IndexReader.Open(indexDir);
-			ModifyIndex(3, ir.Directory());
-			IndexReader newIr = ir.Reopen();
-			ModifyIndex(3, newIr.Directory());
-			IndexReader newIr2 = newIr.Reopen();
-			ModifyIndex(3, newIr2.Directory());
-			IndexReader newIr3 = newIr2.Reopen();
-			
-			ir.Close();
-			newIr.Close();
-			newIr2.Close();
-			
-			// shouldn't throw Directory AlreadyClosedException
-			ModifyIndex(3, newIr3.Directory());
-			newIr3.Close();
+			indexDir = new System.IO.DirectoryInfo(System.IO.Path.Combine(tempDir, "IndexReaderReopen"));
 		}
-		
-		// LUCENE-1453
-		[Test]
-		public virtual void  TestFSDirectoryReopen2()
-		{
-			
-			System.String tempDir = System.IO.Path.GetTempPath();
-			if (tempDir == null)
-				throw new System.IO.IOException("java.io.tmpdir undefined, cannot run test");
-			System.IO.FileInfo indexDir2 = new System.IO.FileInfo(System.IO.Path.Combine(tempDir, "IndexReaderReopen2"));
-			
-			Directory dir1 = FSDirectory.GetDirectory(indexDir2);
-			CreateIndex(dir1, false);
-			
-			IndexReader lastReader = IndexReader.Open(indexDir2);
-			
-			System.Random r = NewRandom();
-			for (int i = 0; i < 10; i++)
-			{
-				int mod = r.Next(5);
-				ModifyIndex(mod, lastReader.Directory());
-				IndexReader reader = lastReader.Reopen();
-				if (reader != lastReader)
-				{
-					lastReader.Close();
-					lastReader = reader;
-				}
-			}
-			lastReader.Close();
-			
-			// Make sure we didn't pick up too many incRef's along
-			// the way -- this close should be the final close:
-			dir1.Close();
-			
-			try
-			{
-				dir1.ListAll();
-				Assert.Fail("did not hit AlreadyClosedException");
-			}
-			catch (AlreadyClosedException ace)
-			{
-				// expected
-			}
-		}
-		
 		[Test]
 		public virtual void  TestCloseOrig()
 		{
 			Directory dir = new MockRAMDirectory();
 			CreateIndex(dir, false);
-			IndexReader r1 = IndexReader.Open(dir);
-			IndexReader r2 = IndexReader.Open(dir);
+			IndexReader r1 = IndexReader.Open(dir, false);
+            IndexReader r2 = IndexReader.Open(dir, false);
 			r2.DeleteDocument(0);
 			r2.Close();
 			
@@ -1569,8 +1320,8 @@ namespace Lucene.Net.Index
 			
 			ModifyIndex(0, dir); // Get delete bitVector on 1st segment
 			ModifyIndex(5, dir); // Add a doc (2 segments)
-			
-			IndexReader r1 = IndexReader.Open(dir); // MSR
+
+            IndexReader r1 = IndexReader.Open(dir, false); // MSR
 			
 			ModifyIndex(5, dir); // Add another doc (3 segments)
 			
@@ -1603,7 +1354,7 @@ namespace Lucene.Net.Index
 			CreateIndex(dir, false);
 			// Get delete bitVector
 			ModifyIndex(0, dir);
-			IndexReader r1 = IndexReader.Open(dir);
+            IndexReader r1 = IndexReader.Open(dir, false);
 			
 			// Add doc:
 			ModifyIndex(5, dir);
@@ -1659,8 +1410,8 @@ namespace Lucene.Net.Index
 				writer.Commit(data);
 			}
 			writer.Close();
-			
-			IndexReader r = IndexReader.Open(dir);
+
+            IndexReader r = IndexReader.Open(dir, false);
 			Assert.AreEqual(0, r.NumDocs());
 			Assert.AreEqual(4, r.MaxDoc());
                         

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Index/TestIndexWriter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Index/TestIndexWriter.cs?rev=1201357&r1=1201356&r2=1201357&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Index/TestIndexWriter.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Index/TestIndexWriter.cs Sat Nov 12 23:51:42 2011
@@ -58,8 +58,6 @@ namespace Lucene.Net.Index
 {
 	
 	/// <summary> </summary>
-	/// <version>  $Id: TestIndexWriter.java 831036 2009-10-29 17:15:12Z mikemccand $
-	/// </version>
     [TestFixture]
     public class TestIndexWriter : BaseTokenStreamTestCase
     {

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Lucene.Net.Test.csproj
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Lucene.Net.Test.csproj?rev=1201357&r1=1201356&r2=1201357&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Lucene.Net.Test.csproj (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Lucene.Net.Test.csproj Sat Nov 12 23:51:42 2011
@@ -148,7 +148,6 @@
     </Compile>
     <Compile Include="Analysis\TestASCIIFoldingFilter.cs" />
     <Compile Include="Analysis\TestCachingTokenFilter.cs" />
-    <Compile Include="Analysis\TestCharacterCache.cs" />
     <Compile Include="Analysis\TestCharArraySet.cs" />
     <Compile Include="Analysis\TestCharFilter.cs" />
     <Compile Include="Analysis\TestISOLatin1AccentFilter.cs">
@@ -175,9 +174,7 @@
       <SubType>Code</SubType>
     </Compile>
     <Compile Include="Analysis\TestTeeSinkTokenFilter.cs" />
-    <Compile Include="Analysis\TestTeeTokenFilter.cs" />
     <Compile Include="Analysis\TestToken.cs" />
-    <Compile Include="Analysis\TestTokenStreamBWComp.cs" />
     <Compile Include="AssemblyInfo.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -222,15 +219,13 @@
     <Compile Include="Index\TestFilterIndexReader.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="Index\TestIndexCommit.cs" />
     <Compile Include="Index\TestIndexFileDeleter.cs">
       <SubType>Code</SubType>
     </Compile>
     <Compile Include="Index\TestIndexInput.cs">
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="Index\TestIndexModifier.cs">
-      <SubType>Code</SubType>
-    </Compile>
     <Compile Include="Index\TestIndexReader.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -328,15 +323,12 @@
     <Compile Include="Search\Function\TestDocValues.cs" />
     <Compile Include="Search\Function\TestFieldScoreQuery.cs" />
     <Compile Include="Search\Function\TestOrdValues.cs" />
-    <Compile Include="Search\Function\TestValueSource.cs" />
     <Compile Include="Search\JustCompileSearch.cs" />
     <Compile Include="Search\MockFilter.cs" />
     <Compile Include="Search\Payloads\PayloadHelper.cs" />
-    <Compile Include="Search\Payloads\TestBoostingTermQuery.cs" />
     <Compile Include="Search\Payloads\TestPayloadNearQuery.cs" />
     <Compile Include="Search\Payloads\TestPayloadTermQuery.cs" />
     <Compile Include="Search\QueryUtils.cs" />
-    <Compile Include="Search\SampleComparable.cs" />
     <Compile Include="Search\SingleDocTestFilter.cs" />
     <Compile Include="Search\Spans\JustCompileSearchSpans.cs" />
     <Compile Include="Search\Spans\TestBasics.cs">
@@ -408,21 +400,17 @@
     <Compile Include="Search\TestQueryWrapperFilter.cs" />
     <Compile Include="Search\TestScoreCachingWrappingScorer.cs" />
     <Compile Include="Search\TestScorerPerf.cs" />
-    <Compile Include="Search\TestSearchHitsWithDeletions.cs" />
     <Compile Include="Search\TestSetNorm.cs" />
     <Compile Include="Search\TestSimilarity.cs" />
     <Compile Include="Search\TestSimpleExplanations.cs" />
     <Compile Include="Search\TestSimpleExplanationsOfNonMatches.cs" />
-    <Compile Include="Search\TestSloppyPhraseQuery.cs" />
     <Compile Include="Search\TestSort.cs" />
     <Compile Include="Search\TestSpanQueryFilter.cs" />
-    <Compile Include="Search\TestStressSort.cs" />
     <Compile Include="Search\TestTermRangeFilter.cs" />
     <Compile Include="Search\TestTermRangeQuery.cs" />
     <Compile Include="Search\TestTermScorer.cs" />
     <Compile Include="Search\TestTermVectors.cs" />
     <Compile Include="Search\TestThreadSafe.cs" />
-    <Compile Include="Search\TestTimeLimitedCollector.cs" />
     <Compile Include="Search\TestTimeLimitingCollector.cs" />
     <Compile Include="Search\TestTopDocsCollector.cs" />
     <Compile Include="Search\TestTopScoreDocCollector.cs" />
@@ -457,9 +445,6 @@
     <Compile Include="TestDemo.cs">
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="TestHitIterator.cs">
-      <SubType>Code</SubType>
-    </Compile>
     <Compile Include="TestMergeSchedulerExternal.cs" />
     <Compile Include="TestSearch.cs">
       <SubType>Code</SubType>

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/CheckHits.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/CheckHits.cs?rev=1201357&r1=1201356&r2=1201357&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/CheckHits.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/CheckHits.cs Sat Nov 12 23:51:42 2011
@@ -441,7 +441,7 @@ namespace Lucene.Net.Search
 		/// </seealso>
 		public class ExplanationAssertingSearcher:IndexSearcher
 		{
-			public ExplanationAssertingSearcher(Directory d):base(d)
+			public ExplanationAssertingSearcher(Directory d):base(d, true)
 			{
 			}
 			public ExplanationAssertingSearcher(IndexReader r):base(r)
@@ -457,25 +457,11 @@ namespace Lucene.Net.Search
 				CheckExplanations(query);
 				return base.Search(query, filter, n, sort);
 			}
-			/// <deprecated> use {@link #Search(Query, Collector)} instead. 
-			/// </deprecated>
-            [Obsolete("use Search(Query, Collector) instead. ")]
-			public override void  Search(Query query, HitCollector results)
-			{
-				Search(query, new HitCollectorWrapper(results));
-			}
 			public override void  Search(Query query, Collector results)
 			{
 				CheckExplanations(query);
 				base.Search(query, results);
 			}
-			/// <deprecated> use {@link #Search(Query, Filter, Collector)} instead. 
-			/// </deprecated>
-            [Obsolete("use Search(Query, Filter, Collector) instead. ")]
-			public override void  Search(Query query, Filter filter, HitCollector results)
-			{
-				Search(query, filter, new HitCollectorWrapper(results));
-			}
 			public override void  Search(Query query, Filter filter, Collector results)
 			{
 				CheckExplanations(query);

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Function/FunctionTestSetup.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Function/FunctionTestSetup.cs?rev=1201357&r1=1201356&r2=1201357&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Function/FunctionTestSetup.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Function/FunctionTestSetup.cs Sat Nov 12 23:51:42 2011
@@ -91,7 +91,7 @@ namespace Lucene.Net.Search.Function
 			// prepare a small index with just a few documents.  
 			base.SetUp();
 			dir = new RAMDirectory();
-			anlzr = new StandardAnalyzer();
+			anlzr = new StandardAnalyzer(Util.Version.LUCENE_CURRENT);
 			IndexWriter iw = new IndexWriter(dir, anlzr, IndexWriter.MaxFieldLength.LIMITED);
 			// add docs not exactly in natural ID order, to verify we do check the order of docs by scores
 			int remaining = N_DOCS;

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Function/TestCustomScoreQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Function/TestCustomScoreQuery.cs?rev=1201357&r1=1201356&r2=1201357&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Function/TestCustomScoreQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Function/TestCustomScoreQuery.cs Sat Nov 12 23:51:42 2011
@@ -228,7 +228,7 @@ namespace Lucene.Net.Search.Function
         [Test]
         public void TestCustomExternalQuery() 
         {
-            QueryParser qp = new QueryParser(TEXT_FIELD,anlzr); 
+            QueryParser qp = new QueryParser(Util.Version.LUCENE_CURRENT,TEXT_FIELD,anlzr); 
             String qtxt = "first aid text"; // from the doc texts in FunctionQuerySetup.
             Query q1 = qp.Parse(qtxt); 
         
@@ -252,9 +252,9 @@ namespace Lucene.Net.Search.Function
 		private void  DoTestCustomScore(System.String field, FieldScoreQuery.Type tp, double dboost)
 		{
 			float boost = (float) dboost;
-			IndexSearcher s = new IndexSearcher(dir);
+			IndexSearcher s = new IndexSearcher(dir, true);
 			FieldScoreQuery qValSrc = new FieldScoreQuery(field, tp); // a query that would score by the field
-			QueryParser qp = new QueryParser(TEXT_FIELD, anlzr);
+			QueryParser qp = new QueryParser(Util.Version.LUCENE_CURRENT, TEXT_FIELD, anlzr);
 			System.String qtxt = "first aid text"; // from the doc texts in FunctionQuerySetup.
 			
 			// regular (boolean) query.

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Function/TestFieldScoreQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Function/TestFieldScoreQuery.cs?rev=1201357&r1=1201356&r2=1201357&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Function/TestFieldScoreQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Function/TestFieldScoreQuery.cs Sat Nov 12 23:51:42 2011
@@ -88,7 +88,7 @@ namespace Lucene.Net.Search.Function
 		// Test that FieldScoreQuery returns docs in expected order.
 		private void  DoTestRank(System.String field, FieldScoreQuery.Type tp)
 		{
-			IndexSearcher s = new IndexSearcher(dir);
+			IndexSearcher s = new IndexSearcher(dir, true);
 			Query q = new FieldScoreQuery(field, tp);
 			Log("test: " + q);
 			QueryUtils.Check(q, s);
@@ -141,7 +141,7 @@ namespace Lucene.Net.Search.Function
 		// Test that FieldScoreQuery returns docs with expected score.
 		private void  DoTestExactScore(System.String field, FieldScoreQuery.Type tp)
 		{
-			IndexSearcher s = new IndexSearcher(dir);
+			IndexSearcher s = new IndexSearcher(dir, true);
 			Query q = new FieldScoreQuery(field, tp);
 			TopDocs td = s.Search(q, null, 1000);
 			Assert.AreEqual(N_DOCS, td.TotalHits, "All docs should be matched!");
@@ -199,7 +199,7 @@ namespace Lucene.Net.Search.Function
 			expectedArrayTypes[FieldScoreQuery.Type.INT] = new int[0];
 			expectedArrayTypes[FieldScoreQuery.Type.FLOAT] = new float[0];
 			
-			IndexSearcher s = new IndexSearcher(dir);
+			IndexSearcher s = new IndexSearcher(dir, true);
 			System.Object[] innerArray = new Object[s.GetIndexReader().GetSequentialSubReaders().Length];
 			
 			bool warned = false; // print warning once.
@@ -238,7 +238,7 @@ namespace Lucene.Net.Search.Function
 			}
 			
 			// verify new values are reloaded (not reused) for a new reader
-			s = new IndexSearcher(dir);
+			s = new IndexSearcher(dir, true);
 			FieldScoreQuery q2 = new FieldScoreQuery(field, tp);
 			ScoreDoc[] h2 = s.Search(q2, null, 1000).ScoreDocs;
 			Assert.AreEqual(N_DOCS, h2.Length, "All docs should be matched!");

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Function/TestOrdValues.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Function/TestOrdValues.cs?rev=1201357&r1=1201356&r2=1201357&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Function/TestOrdValues.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Function/TestOrdValues.cs Sat Nov 12 23:51:42 2011
@@ -69,15 +69,15 @@ namespace Lucene.Net.Search.Function
 		// Test that queries based on reverse/ordFieldScore scores correctly
 		private void  DoTestRank(System.String field, bool inOrder)
 		{
-			IndexSearcher s = new IndexSearcher(dir);
+			IndexSearcher s = new IndexSearcher(dir, true);
 			ValueSource vs;
 			if (inOrder)
 			{
-				vs = new MultiValueSource(new OrdFieldSource(field));
+				vs = new OrdFieldSource(field);
 			}
 			else
 			{
-				vs = new MultiValueSource(new ReverseOrdFieldSource(field));
+				vs = new ReverseOrdFieldSource(field);
 			}
 			
 			Query q = new ValueSourceQuery(vs);
@@ -122,7 +122,7 @@ namespace Lucene.Net.Search.Function
 		// Test that queries based on reverse/ordFieldScore returns docs with expected score.
 		private void  DoTestExactScore(System.String field, bool inOrder)
 		{
-			IndexSearcher s = new IndexSearcher(dir);
+			IndexSearcher s = new IndexSearcher(dir, true);
 			ValueSource vs;
 			if (inOrder)
 			{
@@ -166,7 +166,7 @@ namespace Lucene.Net.Search.Function
 		// Test that values loaded for FieldScoreQuery are cached properly and consumes the proper RAM resources.
 		private void  DoTestCaching(System.String field, bool inOrder)
 		{
-			IndexSearcher s = new IndexSearcher(dir);
+			IndexSearcher s = new IndexSearcher(dir, true);
 			System.Object innerArray = null;
 			
 			bool warned = false; // print warning once
@@ -252,7 +252,7 @@ namespace Lucene.Net.Search.Function
 			}
 			
 			// verify new values are reloaded (not reused) for a new reader
-			s = new IndexSearcher(dir);
+			s = new IndexSearcher(dir, true);
 			if (inOrder)
 			{
 				vs2 = new OrdFieldSource(field);

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/JustCompileSearch.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/JustCompileSearch.cs?rev=1201357&r1=1201356&r2=1201357&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/JustCompileSearch.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/JustCompileSearch.cs Sat Nov 12 23:51:42 2011
@@ -16,7 +16,7 @@
  */
 
 using System;
-
+using Lucene.Net.Util;
 using NUnit.Framework;
 
 using Document = Lucene.Net.Documents.Document;
@@ -25,7 +25,6 @@ using CorruptIndexException = Lucene.Net
 using IndexReader = Lucene.Net.Index.IndexReader;
 using Term = Lucene.Net.Index.Term;
 using TermPositions = Lucene.Net.Index.TermPositions;
-using PriorityQueue = Lucene.Net.Util.PriorityQueue;
 
 namespace Lucene.Net.Search
 {
@@ -188,36 +187,11 @@ namespace Lucene.Net.Search
 		
 		internal sealed class JustCompileDocIdSetIterator:DocIdSetIterator
 		{
-			
-			/// <deprecated> delete in 3.0 
-			/// </deprecated>
-            [Obsolete("delete in 3.0")]
-			public override int Doc()
-			{
-				throw new System.NotSupportedException(Lucene.Net.Search.JustCompileSearch.UNSUPPORTED_MSG);
-			}
-			
 			public override int DocID()
 			{
 				throw new System.NotSupportedException(Lucene.Net.Search.JustCompileSearch.UNSUPPORTED_MSG);
 			}
 			
-			/// <deprecated> delete in 3.0 
-			/// </deprecated>
-            [Obsolete("delete in 3.0")]
-			public override bool Next()
-			{
-				throw new System.NotSupportedException(Lucene.Net.Search.JustCompileSearch.UNSUPPORTED_MSG);
-			}
-			
-			/// <deprecated> delete in 3.0 
-			/// </deprecated>
-            [Obsolete("delete in 3.0")]
-			public override bool SkipTo(int target)
-			{
-				throw new System.NotSupportedException(Lucene.Net.Search.JustCompileSearch.UNSUPPORTED_MSG);
-			}
-			
 			public override int NextDoc()
 			{
 				throw new System.NotSupportedException(Lucene.Net.Search.JustCompileSearch.UNSUPPORTED_MSG);
@@ -298,6 +272,10 @@ namespace Lucene.Net.Search
 		{
 			// Filter is just an abstract class with no abstract methods. However it is
 			// still added here in case someone will add abstract methods in the future.
+            public override DocIdSet GetDocIdSet(IndexReader reader)
+            {
+                return null;
+            }
 		}
 		
 		internal sealed class JustCompileFilteredDocIdSet:FilteredDocIdSet
@@ -345,24 +323,15 @@ namespace Lucene.Net.Search
 			}
 		}
 		
-		[Serializable]
-		internal sealed class JustCompileMultiTermQuery:MultiTermQuery
-		{
-			
-			public /*protected internal*/ override FilteredTermEnum GetEnum(IndexReader reader)
-			{
-				throw new System.NotSupportedException(Lucene.Net.Search.JustCompileSearch.UNSUPPORTED_MSG);
-			}
-		}
-		
 		/*internal sealed class JustCompilePhraseScorer : Lucene.Net.Search.PhraseScorer    // {{Not needed for Lucene.Net}}
 		{
-			
-			internal JustCompilePhraseScorer(Weight weight, TermPositions[] tps, int[] offsets, Similarity similarity, sbyte[] norms):base(weight, tps, offsets, similarity, norms)
-			{
-			}
-			
-			protected internal override float PhraseFreq()
+
+            internal JustCompilePhraseScorer(Weight weight, TermPositions[] tps, int[] offsets, Similarity similarity, byte[] norms)
+                : base(weight, tps, offsets, similarity, norms)
+            {
+            }
+
+		    protected internal override float PhraseFreq()
 			{
 				throw new System.NotSupportedException(Lucene.Net.Search.JustCompileSearch.UNSUPPORTED_MSG);
 			}
@@ -390,45 +359,16 @@ namespace Lucene.Net.Search
 				throw new System.NotSupportedException(Lucene.Net.Search.JustCompileSearch.UNSUPPORTED_MSG);
 			}
 			
-			public override Explanation Explain(int doc)
-			{
-				throw new System.NotSupportedException(Lucene.Net.Search.JustCompileSearch.UNSUPPORTED_MSG);
-			}
-			
 			public override float Score()
 			{
 				throw new System.NotSupportedException(Lucene.Net.Search.JustCompileSearch.UNSUPPORTED_MSG);
 			}
 			
-			/// <deprecated> delete in 3.0 
-			/// </deprecated>
-            [Obsolete("delete in 3.0")]
-			public override int Doc()
-			{
-				throw new System.NotSupportedException(Lucene.Net.Search.JustCompileSearch.UNSUPPORTED_MSG);
-			}
-			
 			public override int DocID()
 			{
 				throw new System.NotSupportedException(Lucene.Net.Search.JustCompileSearch.UNSUPPORTED_MSG);
 			}
 			
-			/// <deprecated> delete in 3.0. 
-			/// </deprecated>
-            [Obsolete("delete in 3.0")]
-			public override bool Next()
-			{
-				throw new System.NotSupportedException(Lucene.Net.Search.JustCompileSearch.UNSUPPORTED_MSG);
-			}
-			
-			/// <deprecated> delete in 3.0. 
-			/// </deprecated>
-            [Obsolete("delete in 3.0")]
-			public override bool SkipTo(int target)
-			{
-				throw new System.NotSupportedException(Lucene.Net.Search.JustCompileSearch.UNSUPPORTED_MSG);
-			}
-			
 			public override int NextDoc()
 			{
 				throw new System.NotSupportedException(Lucene.Net.Search.JustCompileSearch.UNSUPPORTED_MSG);
@@ -478,17 +418,21 @@ namespace Lucene.Net.Search
 		[Serializable]
 		internal sealed class JustCompileSpanFilter:SpanFilter
 		{
-			
 			public override SpanFilterResult BitSpans(IndexReader reader)
 			{
 				throw new System.NotSupportedException(Lucene.Net.Search.JustCompileSearch.UNSUPPORTED_MSG);
 			}
+            public override DocIdSet GetDocIdSet(IndexReader reader)
+            {
+                return null;
+            }
 		}
 		
-		internal sealed class JustCompileTopDocsCollector:TopDocsCollector
+		internal sealed class JustCompileTopDocsCollector : TopDocsCollector<ScoreDoc>
 		{
-			
-			internal JustCompileTopDocsCollector(PriorityQueue pq):base(pq)
+
+            internal JustCompileTopDocsCollector(PriorityQueue<ScoreDoc> pq)
+                : base(pq)
 			{
 			}
 			
@@ -537,14 +481,6 @@ namespace Lucene.Net.Search
 				throw new System.NotSupportedException(Lucene.Net.Search.JustCompileSearch.UNSUPPORTED_MSG);
 			}
 			
-			/// <deprecated> delete in 3.0 
-			/// </deprecated>
-            [Obsolete("delete in 3.0")]
-			public Scorer Scorer(IndexReader reader)
-			{
-				throw new System.NotSupportedException(Lucene.Net.Search.JustCompileSearch.UNSUPPORTED_MSG);
-			}
-			
 			public override float SumOfSquaredWeights()
 			{
 				throw new System.NotSupportedException(Lucene.Net.Search.JustCompileSearch.UNSUPPORTED_MSG);

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Payloads/PayloadHelper.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Payloads/PayloadHelper.cs?rev=1201357&r1=1201356&r2=1201357&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Payloads/PayloadHelper.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Payloads/PayloadHelper.cs Sat Nov 12 23:51:42 2011
@@ -100,7 +100,7 @@ namespace Lucene.Net.Search.Payloads
 			{
 				InitBlock(enclosingInstance);
 				this.fieldName = fieldName;
-				payloadAtt = (PayloadAttribute) AddAttribute(typeof(PayloadAttribute));
+                payloadAtt = AddAttribute<PayloadAttribute>();
 			}
 			
 			public override bool IncrementToken()
@@ -144,7 +144,7 @@ namespace Lucene.Net.Search.Payloads
 		{
 			RAMDirectory directory = new RAMDirectory();
 			PayloadAnalyzer analyzer = new PayloadAnalyzer(this);
-			IndexWriter writer = new IndexWriter(directory, analyzer, true);
+			IndexWriter writer = new IndexWriter(directory, analyzer, true, IndexWriter.MaxFieldLength.UNLIMITED);
 			writer.SetSimilarity(similarity);
 			//writer.infoStream = System.out;
 			for (int i = 0; i < numDocs; i++)
@@ -158,7 +158,7 @@ namespace Lucene.Net.Search.Payloads
 			//writer.optimize();
 			writer.Close();
 			
-			IndexSearcher searcher = new IndexSearcher(directory);
+			IndexSearcher searcher = new IndexSearcher(directory, true);
 			searcher.SetSimilarity(similarity);
 			return searcher;
 		}

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Payloads/TestPayloadNearQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Payloads/TestPayloadNearQuery.cs?rev=1201357&r1=1201356&r2=1201357&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Payloads/TestPayloadNearQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Payloads/TestPayloadNearQuery.cs Sat Nov 12 23:51:42 2011
@@ -16,7 +16,7 @@
  */
 
 using System;
-
+using System.Collections.Generic;
 using NUnit.Framework;
 
 using Analyzer = Lucene.Net.Analysis.Analyzer;
@@ -113,7 +113,7 @@ namespace Lucene.Net.Search.Payloads
 			{
 				InitBlock(enclosingInstance);
 				this.fieldName = fieldName;
-				payAtt = (PayloadAttribute) AddAttribute(typeof(PayloadAttribute));
+                payAtt = AddAttribute<PayloadAttribute>();
 			}
 			
 			public override bool IncrementToken()
@@ -286,8 +286,6 @@ namespace Lucene.Net.Search.Payloads
 		[Serializable]
 		internal class BoostingSimilarity:DefaultSimilarity
 		{
-			
-			// TODO: Remove warning after API has been finalized
 			public override float ScorePayload(int docId, System.String fieldName, int start, int end, byte[] payload, int offset, int length)
 			{
 				//we know it is size 4 here, so ignore the offset/length
@@ -298,32 +296,51 @@ namespace Lucene.Net.Search.Payloads
 			//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 			public override float LengthNorm(System.String fieldName, int numTerms)
 			{
-				return 1;
+			    return 1.0f;
 			}
 			
 			public override float QueryNorm(float sumOfSquaredWeights)
 			{
-				return 1;
+                return 1.0f;
 			}
 			
 			public override float SloppyFreq(int distance)
 			{
-				return 1;
+                return 1.0f;
 			}
 			
 			public override float Coord(int overlap, int maxOverlap)
 			{
-				return 1;
+                return 1.0f;
 			}
 			public override float Tf(float freq)
 			{
-				return 1;
+                return 1.0f;
 			}
 			// idf used for phrase queries
-			public override float Idf(System.Collections.ICollection terms, Searcher searcher)
+			public override Explanation.IDFExplanation IdfExplain(ICollection<Term> terms, Searcher searcher)
 			{
-				return 1;
+			    return new InjectableIDFExplanation
+			               {
+			                   ExplainFunc = () => "Inexplicable",
+                               GetIdfFunc = () => 1.0f
+			               };
 			}
+
+            private class InjectableIDFExplanation : Explanation.IDFExplanation
+            {
+                public Func<float> GetIdfFunc { get; set; }
+                public Func<string> ExplainFunc { get; set; }
+                public override float GetIdf()
+                {
+                    return GetIdfFunc.Invoke();
+                }
+
+                public override string Explain()
+                {
+                    return ExplainFunc.Invoke();
+                }
+            }
 		}
 	}
 }
\ No newline at end of file

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Payloads/TestPayloadTermQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Payloads/TestPayloadTermQuery.cs?rev=1201357&r1=1201356&r2=1201357&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Payloads/TestPayloadTermQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Payloads/TestPayloadTermQuery.cs Sat Nov 12 23:51:42 2011
@@ -123,7 +123,7 @@ namespace Lucene.Net.Search.Payloads
 			{
 				InitBlock(enclosingInstance);
 				this.fieldName = fieldName;
-				payloadAtt = (PayloadAttribute) AddAttribute(typeof(PayloadAttribute));
+                payloadAtt = AddAttribute<PayloadAttribute>();
 			}
 			
 			public override bool IncrementToken()

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/QueryUtils.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/QueryUtils.cs?rev=1201357&r1=1201356&r2=1201357&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/QueryUtils.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/QueryUtils.cs Sat Nov 12 23:51:42 2011
@@ -43,6 +43,7 @@ namespace Lucene.Net.Search
 				return "My Whacky Query";
 			}
 		}
+
 		private class AnonymousClassCollector:Collector
 		{
 			public AnonymousClassCollector(int[] order, int[] opidx, int skip_op, Lucene.Net.Search.Scorer scorer, int[] sdoc, float maxDiff, Lucene.Net.Search.Query q, Lucene.Net.Search.IndexSearcher s)
@@ -311,7 +312,25 @@ namespace Lucene.Net.Search
 			
 			// we can't put deleted docs before the nested reader, because
 			// it will throw off the docIds
-			IndexReader[] readers = new IndexReader[]{edge < 0?r:IndexReader.Open(MakeEmptyIndex(0)), IndexReader.Open(MakeEmptyIndex(0)), new MultiReader(new IndexReader[]{IndexReader.Open(MakeEmptyIndex(edge < 0?4:0)), IndexReader.Open(MakeEmptyIndex(0)), 0 == edge?r:IndexReader.Open(MakeEmptyIndex(0))}), IndexReader.Open(MakeEmptyIndex(0 < edge?0:7)), IndexReader.Open(MakeEmptyIndex(0)), new MultiReader(new IndexReader[]{IndexReader.Open(MakeEmptyIndex(0 < edge?0:5)), IndexReader.Open(MakeEmptyIndex(0)), 0 < edge?r:IndexReader.Open(MakeEmptyIndex(0))})};
+		    IndexReader[] readers = new IndexReader[]
+		                                {
+		                                    edge < 0 ? r : IndexReader.Open(MakeEmptyIndex(0), true),
+		                                    IndexReader.Open(MakeEmptyIndex(0), true),
+		                                    new MultiReader(new IndexReader[]
+		                                                        {
+		                                                            IndexReader.Open(MakeEmptyIndex(edge < 0 ? 4 : 0), true),
+		                                                            IndexReader.Open(MakeEmptyIndex(0), true),
+		                                                            0 == edge ? r : IndexReader.Open(MakeEmptyIndex(0), true)
+		                                                        }),
+		                                    IndexReader.Open(MakeEmptyIndex(0 < edge ? 0 : 7), true),
+		                                    IndexReader.Open(MakeEmptyIndex(0), true),
+		                                    new MultiReader(new IndexReader[]
+		                                                        {
+		                                                            IndexReader.Open(MakeEmptyIndex(0 < edge ? 0 : 5), true),
+		                                                            IndexReader.Open(MakeEmptyIndex(0), true),
+		                                                            0 < edge ? r : IndexReader.Open(MakeEmptyIndex(0), true)
+		                                                        })
+		                                };
 			IndexSearcher out_Renamed = new IndexSearcher(new MultiReader(readers));
 			out_Renamed.SetSimilarity(s.GetSimilarity());
 			return out_Renamed;
@@ -331,7 +350,24 @@ namespace Lucene.Net.Search
 			
 			// we can't put deleted docs before the nested reader, because
 			// it will through off the docIds
-			Searcher[] searchers = new Searcher[]{edge < 0?s:new IndexSearcher(MakeEmptyIndex(0)), new MultiSearcher(new Searcher[]{new IndexSearcher(MakeEmptyIndex(edge < 0?65:0)), new IndexSearcher(MakeEmptyIndex(0)), 0 == edge?s:new IndexSearcher(MakeEmptyIndex(0))}), new IndexSearcher(MakeEmptyIndex(0 < edge?0:3)), new IndexSearcher(MakeEmptyIndex(0)), new MultiSearcher(new Searcher[]{new IndexSearcher(MakeEmptyIndex(0 < edge?0:5)), new IndexSearcher(MakeEmptyIndex(0)), 0 < edge?s:new IndexSearcher(MakeEmptyIndex(0))})};
+		    Searcher[] searchers = new Searcher[]
+		                               {
+		                                   edge < 0 ? s : new IndexSearcher(MakeEmptyIndex(0), true),
+		                                   new MultiSearcher(new Searcher[]
+		                                                         {
+		                                                             new IndexSearcher(MakeEmptyIndex(edge < 0 ? 65 : 0), true),
+		                                                             new IndexSearcher(MakeEmptyIndex(0), true),
+		                                                             0 == edge ? s : new IndexSearcher(MakeEmptyIndex(0), true)
+		                                                         }),
+		                                   new IndexSearcher(MakeEmptyIndex(0 < edge ? 0 : 3), true),
+		                                   new IndexSearcher(MakeEmptyIndex(0), true),
+		                                   new MultiSearcher(new Searcher[]
+		                                                         {
+		                                                             new IndexSearcher(MakeEmptyIndex(0 < edge ? 0 : 5), true),
+		                                                             new IndexSearcher(MakeEmptyIndex(0), true),
+		                                                             0 < edge ? s : new IndexSearcher(MakeEmptyIndex(0), true)
+		                                                         })
+		                               };
 			MultiSearcher out_Renamed = new MultiSearcher(searchers);
 			out_Renamed.SetSimilarity(s.GetSimilarity());
 			return out_Renamed;
@@ -355,7 +391,7 @@ namespace Lucene.Net.Search
 			Assert.AreEqual(numDeletedDocs, w.MaxDoc(), "writer is missing some deleted docs");
 			Assert.AreEqual(0, w.NumDocs(), "writer has non-deleted docs");
 			w.Close();
-			IndexReader r = IndexReader.Open(d);
+            IndexReader r = IndexReader.Open(d, true);
 			Assert.AreEqual(numDeletedDocs, r.NumDeletedDocs(), "reader has wrong number of deleted docs");
 			r.Close();
 			return d;
@@ -397,7 +433,7 @@ namespace Lucene.Net.Search
 		{
 			//System.out.println("Checking "+q);
 			
-			if (BooleanQuery.GetAllowDocsOutOfOrder())
+			if (q.Weight(s).ScoresDocsOutOfOrder())
 				return ; // in this case order of skipTo() might differ from that of next().
 			
 			int skip_op = 0;
@@ -411,24 +447,19 @@ namespace Lucene.Net.Search
 				// System.out.print(order[i]==skip_op ? " skip()":" next()");
 				// System.out.println();
 				int[] opidx = new int[]{0};
-				
-				Weight w = q.Weight(s);
-				Scorer scorer = w.Scorer(s.GetIndexReader(), true, false);
-				if (scorer == null)
-				{
-					continue;
-				}
+			    int[] lastDoc = new[] {-1};
 				
 				// FUTURE: ensure scorer.doc()==-1
 				
-				int[] sdoc = new int[]{- 1};
 				float maxDiff = 1e-5f;
-				s.Search(q, new AnonymousClassCollector(order, opidx, skip_op, scorer, sdoc, maxDiff, q, s));
+			    IndexReader[] lastReader = new IndexReader[] {null};
+
+				s.Search(q, new AnonymousClassCollector(order, opidx, skip_op, lastReader, lastDoc, maxDiff, q, s));
 				
 				// make sure next call to scorer is false.
-				int op = order[(opidx[0]++) % order.Length];
+				int op2 = order[(opidx[0]++) % order.Length];
 				// System.out.println(op==skip_op ? "last: skip()":"last: next()");
-				bool more = (op == skip_op?scorer.Advance(sdoc[0] + 1):scorer.NextDoc()) != DocIdSetIterator.NO_MORE_DOCS;
+                bool more = (op2 == skip_op ? scorer.Advance(sdoc[0] + 1) : scorer.NextDoc()) != DocIdSetIterator.NO_MORE_DOCS;
 				Assert.IsFalse(more);
 			}
 		}

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Spans/JustCompileSearchSpans.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Spans/JustCompileSearchSpans.cs?rev=1201357&r1=1201356&r2=1201357&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Spans/JustCompileSearchSpans.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Spans/JustCompileSearchSpans.cs Sat Nov 12 23:51:42 2011
@@ -90,14 +90,6 @@ namespace Lucene.Net.Search.Spans
 				throw new System.NotSupportedException(Lucene.Net.Search.Spans.JustCompileSearchSpans.UNSUPPORTED_MSG);
 			}
 			
-			/// <deprecated> delete in 3.0. 
-			/// </deprecated>
-            [Obsolete("delete in 3.0")]
-			public override System.Collections.ICollection GetTerms()
-			{
-				throw new System.NotSupportedException(Lucene.Net.Search.Spans.JustCompileSearchSpans.UNSUPPORTED_MSG);
-			}
-			
 			public override System.String ToString(System.String field)
 			{
 				throw new System.NotSupportedException(Lucene.Net.Search.Spans.JustCompileSearchSpans.UNSUPPORTED_MSG);

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Spans/TestBasics.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Spans/TestBasics.cs?rev=1201357&r1=1201356&r2=1201357&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Spans/TestBasics.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Spans/TestBasics.cs Sat Nov 12 23:51:42 2011
@@ -71,7 +71,7 @@ namespace Lucene.Net.Search.Spans
 			
 			writer.Close();
 			
-			searcher = new IndexSearcher(directory);
+			searcher = new IndexSearcher(directory, true);
 		}
 		
 		[Test]

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Spans/TestFieldMaskingSpanQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Spans/TestFieldMaskingSpanQuery.cs?rev=1201357&r1=1201356&r2=1201357&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Spans/TestFieldMaskingSpanQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Spans/TestFieldMaskingSpanQuery.cs Sat Nov 12 23:51:42 2011
@@ -26,12 +26,6 @@ using IndexReader = Lucene.Net.Index.Ind
 using IndexWriter = Lucene.Net.Index.IndexWriter;
 using Term = Lucene.Net.Index.Term;
 using RAMDirectory = Lucene.Net.Store.RAMDirectory;
-using CheckHits = Lucene.Net.Search.CheckHits;
-using IndexSearcher = Lucene.Net.Search.IndexSearcher;
-using Query = Lucene.Net.Search.Query;
-using QueryUtils = Lucene.Net.Search.QueryUtils;
-using Scorer = Lucene.Net.Search.Scorer;
-using Weight = Lucene.Net.Search.Weight;
 using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
 
 namespace Lucene.Net.Search.Spans
@@ -101,7 +95,7 @@ namespace Lucene.Net.Search.Spans
 			writer.AddDocument(Doc(new Field[]{Field("id", "4"), Field("gender", "female"), Field("first", "sally"), Field("last", "smith"), Field("gender", "female"), Field("first", "linda"), Field("last", "dixit"), Field("gender", "male"), Field("first", "bubba"), Field("last", "jones")}));
 			
 			writer.Close();
-			searcher = new IndexSearcher(directory);
+			searcher = new IndexSearcher(directory, true);
 		}
 		
 		[TearDown]
@@ -124,8 +118,10 @@ namespace Lucene.Net.Search.Spans
 			SpanQuery qr = (SpanQuery) searcher.Rewrite(q);
 			
 			QueryUtils.CheckEqual(q, qr);
-			
-			Assert.AreEqual(1, qr.GetTerms().Count);
+
+            var terms = new System.Collections.Generic.HashSet<Term>();
+            qr.ExtractTerms(terms);
+			Assert.AreEqual(1, terms.Count);
 		}
 		
         [Test]
@@ -137,8 +133,10 @@ namespace Lucene.Net.Search.Spans
 			SpanQuery qr = (SpanQuery) searcher.Rewrite(q);
 			
 			QueryUtils.CheckUnequal(q, qr);
-			
-			Assert.AreEqual(2, qr.GetTerms().Count);
+
+            var terms = new System.Collections.Generic.HashSet<Term>();
+            qr.ExtractTerms(terms);
+			Assert.AreEqual(2, terms.Count);
 		}
 		
         [Test]
@@ -151,7 +149,7 @@ namespace Lucene.Net.Search.Spans
 			
 			QueryUtils.CheckEqual(q, qr);
 			
-			System.Collections.Hashtable set_Renamed = new System.Collections.Hashtable();
+			var set_Renamed = new System.Collections.Generic.HashSet<Term>();
 			qr.ExtractTerms(set_Renamed);
 			Assert.AreEqual(2, set_Renamed.Count);
 		}

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Spans/TestNearSpansOrdered.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Spans/TestNearSpansOrdered.cs?rev=1201357&r1=1201356&r2=1201357&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Spans/TestNearSpansOrdered.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Spans/TestNearSpansOrdered.cs Sat Nov 12 23:51:42 2011
@@ -42,7 +42,7 @@ namespace Lucene.Net.Search.Spans
 		protected internal IndexSearcher searcher;
 		
 		public const System.String FIELD = "field";
-		public static readonly QueryParser qp = new QueryParser(FIELD, new WhitespaceAnalyzer());
+		public static readonly QueryParser qp = new QueryParser(Util.Version.LUCENE_CURRENT, FIELD, new WhitespaceAnalyzer());
 		
 		[TearDown]
 		public override void  TearDown()
@@ -64,7 +64,7 @@ namespace Lucene.Net.Search.Spans
 				writer.AddDocument(doc);
 			}
 			writer.Close();
-			searcher = new IndexSearcher(directory);
+			searcher = new IndexSearcher(directory, true);
 		}
 		
 		protected internal System.String[] docFields = new System.String[]{"w1 w2 w3 w4 w5", "w1 w3 w2 w3 zz", "w1 xx w2 yy w3", "w1 w3 xx w2 yy w3 zz"};
@@ -188,10 +188,8 @@ namespace Lucene.Net.Search.Spans
 		public virtual void  TestSpanNearScorerExplain()
 		{
 			SpanNearQuery q = MakeQuery();
-			Weight w = q.Weight(searcher);
-			Scorer s = w.Scorer(searcher.GetIndexReader(), true, false);
-			Explanation e = s.Explain(1);
-			Assert.IsTrue(0.0f < e.GetValue(), "Scorer explanation value for doc#1 isn't positive: " + e.ToString());
+		    Explanation e = q.Weight(searcher).Explain(searcher.GetIndexReader(), 1);
+		    Assert.IsTrue(0.0f < e.GetValue(), "Scorer explanation value for doc#1 isn't positive: " + e.ToString());
 		}
 	}
 }
\ No newline at end of file

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Spans/TestPayloadSpans.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Spans/TestPayloadSpans.cs?rev=1201357&r1=1201356&r2=1201357&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Spans/TestPayloadSpans.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Spans/TestPayloadSpans.cs Sat Nov 12 23:51:42 2011
@@ -118,7 +118,7 @@ namespace Lucene.Net.Search.Spans
 		{
 			RAMDirectory directory = new RAMDirectory();
 			PayloadAnalyzer analyzer = new PayloadAnalyzer(this);
-			IndexWriter writer = new IndexWriter(directory, analyzer, true);
+			IndexWriter writer = new IndexWriter(directory, analyzer, true, IndexWriter.MaxFieldLength.UNLIMITED);
 			writer.SetSimilarity(similarity);
 			
 			Document doc = new Document();
@@ -127,7 +127,7 @@ namespace Lucene.Net.Search.Spans
 			
 			writer.Close();
 			
-			IndexSearcher searcher = new IndexSearcher(directory);
+			IndexSearcher searcher = new IndexSearcher(directory, true);
 			searcher.SetSimilarity(similarity);
 			return searcher;
 		}
@@ -268,7 +268,7 @@ namespace Lucene.Net.Search.Spans
 			writer.AddDocument(doc);
 			writer.Close();
 			
-			IndexSearcher is_Renamed = new IndexSearcher(directory);
+			IndexSearcher is_Renamed = new IndexSearcher(directory, true);
 			
 			SpanTermQuery stq1 = new SpanTermQuery(new Term("content", "a"));
 			SpanTermQuery stq2 = new SpanTermQuery(new Term("content", "k"));
@@ -305,7 +305,7 @@ namespace Lucene.Net.Search.Spans
 			writer.AddDocument(doc);
 			writer.Close();
 			
-			IndexSearcher is_Renamed = new IndexSearcher(directory);
+			IndexSearcher is_Renamed = new IndexSearcher(directory, true);
 			
 			SpanTermQuery stq1 = new SpanTermQuery(new Term("content", "a"));
 			SpanTermQuery stq2 = new SpanTermQuery(new Term("content", "k"));
@@ -320,7 +320,6 @@ namespace Lucene.Net.Search.Spans
 				while (spans.Next())
 				{
 					System.Collections.Generic.ICollection<byte[]> payloads = spans.GetPayload();
-					int cnt = 0;
 					for (System.Collections.IEnumerator it = payloads.GetEnumerator(); it.MoveNext(); )
 					{
 						CollectionsHelper.AddIfNotContains(payloadSet, new System.String(System.Text.UTF8Encoding.UTF8.GetChars((byte[]) it.Current)));
@@ -342,7 +341,7 @@ namespace Lucene.Net.Search.Spans
 			writer.AddDocument(doc);
 			writer.Close();
 			
-			IndexSearcher is_Renamed = new IndexSearcher(directory);
+			IndexSearcher is_Renamed = new IndexSearcher(directory, true);
 			
 			SpanTermQuery stq1 = new SpanTermQuery(new Term("content", "a"));
 			SpanTermQuery stq2 = new SpanTermQuery(new Term("content", "k"));
@@ -382,7 +381,7 @@ namespace Lucene.Net.Search.Spans
 		{
 			RAMDirectory directory = new RAMDirectory();
 			PayloadAnalyzer analyzer = new PayloadAnalyzer(this);
-			IndexWriter writer = new IndexWriter(directory, analyzer, true);
+			IndexWriter writer = new IndexWriter(directory, analyzer, true, IndexWriter.MaxFieldLength.UNLIMITED);
 			writer.SetSimilarity(similarity);
 			Document doc = new Document();
 			doc.Add(new Field(PayloadHelper.FIELD, "xx rr yy mm  pp", Field.Store.YES, Field.Index.ANALYZED));
@@ -390,7 +389,7 @@ namespace Lucene.Net.Search.Spans
 			
 			writer.Close();
 			
-			IndexSearcher searcher = new IndexSearcher(directory);
+			IndexSearcher searcher = new IndexSearcher(directory, true);
 			
 			IndexReader reader = searcher.GetIndexReader();
 			PayloadSpanUtil psu = new PayloadSpanUtil(reader);
@@ -446,7 +445,7 @@ namespace Lucene.Net.Search.Spans
 			RAMDirectory directory = new RAMDirectory();
 			PayloadAnalyzer analyzer = new PayloadAnalyzer(this);
 			System.String[] docs = new System.String[]{"xx rr yy mm  pp", "xx yy mm rr pp", "nopayload qq ss pp np", "one two three four five six seven eight nine ten eleven", "nine one two three four five six seven eight eleven ten"};
-			IndexWriter writer = new IndexWriter(directory, analyzer, true);
+			IndexWriter writer = new IndexWriter(directory, analyzer, true, IndexWriter.MaxFieldLength.UNLIMITED);
 			
 			writer.SetSimilarity(similarity);
 			
@@ -461,7 +460,7 @@ namespace Lucene.Net.Search.Spans
 			
 			writer.Close();
 			
-			IndexSearcher searcher = new IndexSearcher(directory);
+			IndexSearcher searcher = new IndexSearcher(directory, true);
 			return searcher;
 		}
 		
@@ -559,9 +558,9 @@ namespace Lucene.Net.Search.Spans
 				CollectionsHelper.AddIfNotContains(entities, "one");
 				CollectionsHelper.AddIfNotContains(nopayload, "nopayload");
 				CollectionsHelper.AddIfNotContains(nopayload, "np");
-				termAtt = (TermAttribute) AddAttribute(typeof(TermAttribute));
-				posIncrAtt = (PositionIncrementAttribute) AddAttribute(typeof(PositionIncrementAttribute));
-				payloadAtt = (PayloadAttribute) AddAttribute(typeof(PayloadAttribute));
+                termAtt = AddAttribute<TermAttribute>();
+                posIncrAtt = AddAttribute<PositionIncrementAttribute>();
+                payloadAtt = AddAttribute<PayloadAttribute>();
 			}
 			
 			public override bool IncrementToken()

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Spans/TestSpans.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Spans/TestSpans.cs?rev=1201357&r1=1201356&r2=1201357&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Spans/TestSpans.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Spans/TestSpans.cs Sat Nov 12 23:51:42 2011
@@ -16,7 +16,7 @@
  */
 
 using System;
-
+using System.Collections.Generic;
 using NUnit.Framework;
 
 using WhitespaceAnalyzer = Lucene.Net.Analysis.WhitespaceAnalyzer;
@@ -114,7 +114,7 @@ namespace Lucene.Net.Search.Spans
 				writer.AddDocument(doc);
 			}
 			writer.Close();
-			searcher = new IndexSearcher(directory);
+			searcher = new IndexSearcher(directory, true);
 		}
 		
 		private System.String[] docFields = new System.String[]{"w1 w2 w3 w4 w5", "w1 w3 w2 w3", "w1 xx w2 yy w3", "w1 w3 xx w2 yy w3", "u2 u2 u1", "u2 xx u2 u1", "u2 u2 xx u1", "u2 xx u2 yy u1", "u2 xx u1 u2", "u2 u1 xx u2", "u1 u2 xx u2", "t1 t2 t1 t3 t2 t3"};
@@ -471,8 +471,8 @@ namespace Lucene.Net.Search.Spans
 		private void  AddDoc(IndexWriter writer, System.String id, System.String text)
 		{
 			Document doc = new Document();
-			doc.Add(new Field("id", id, Field.Store.YES, Field.Index.UN_TOKENIZED));
-			doc.Add(new Field("text", text, Field.Store.YES, Field.Index.TOKENIZED));
+			doc.Add(new Field("id", id, Field.Store.YES, Field.Index.NOT_ANALYZED));
+			doc.Add(new Field("text", text, Field.Store.YES, Field.Index.ANALYZED));
 			writer.AddDocument(doc);
 		}
 		
@@ -505,7 +505,7 @@ namespace Lucene.Net.Search.Spans
 		public virtual void  TestNPESpanQuery()
 		{
 			Directory dir = new MockRAMDirectory();
-			IndexWriter writer = new IndexWriter(dir, new StandardAnalyzer(new System.Collections.Hashtable(0)), IndexWriter.MaxFieldLength.LIMITED);
+			IndexWriter writer = new IndexWriter(dir, new StandardAnalyzer(Util.Version.LUCENE_CURRENT, new HashSet<string>()), IndexWriter.MaxFieldLength.LIMITED);
 			
 			// Add documents
 			AddDoc(writer, "1", "the big dogs went running to the market");
@@ -515,7 +515,7 @@ namespace Lucene.Net.Search.Spans
 			writer.Close();
 			
 			// Get searcher
-			IndexReader reader = IndexReader.Open(dir);
+			IndexReader reader = IndexReader.Open(dir, true);
 			IndexSearcher searcher = new IndexSearcher(reader);
 			
 			// Control (make sure docs indexed)

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Spans/TestSpansAdvanced.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Spans/TestSpansAdvanced.cs?rev=1201357&r1=1201356&r2=1201357&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Spans/TestSpansAdvanced.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Spans/TestSpansAdvanced.cs Sat Nov 12 23:51:42 2011
@@ -59,13 +59,13 @@ namespace Lucene.Net.Search.Spans
 			
 			// create test index
 			mDirectory = new RAMDirectory();
-			IndexWriter writer = new IndexWriter(mDirectory, new StandardAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
+			IndexWriter writer = new IndexWriter(mDirectory, new StandardAnalyzer(Util.Version.LUCENE_CURRENT), true, IndexWriter.MaxFieldLength.LIMITED);
 			addDocument(writer, "1", "I think it should work.");
 			addDocument(writer, "2", "I think it should work.");
 			addDocument(writer, "3", "I think it should work.");
 			addDocument(writer, "4", "I think it should work.");
 			writer.Close();
-			searcher = new IndexSearcher(mDirectory);
+			searcher = new IndexSearcher(mDirectory, true);
 		}
 		
 		[TearDown]

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Spans/TestSpansAdvanced2.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Spans/TestSpansAdvanced2.cs?rev=1201357&r1=1201356&r2=1201357&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Spans/TestSpansAdvanced2.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/Spans/TestSpansAdvanced2.cs Sat Nov 12 23:51:42 2011
@@ -44,7 +44,7 @@ namespace Lucene.Net.Search.Spans
 			base.SetUp();
 			
 			// create test index
-			IndexWriter writer = new IndexWriter(mDirectory, new StandardAnalyzer(), false, IndexWriter.MaxFieldLength.LIMITED);
+			IndexWriter writer = new IndexWriter(mDirectory, new StandardAnalyzer(Util.Version.LUCENE_CURRENT), false, IndexWriter.MaxFieldLength.LIMITED);
 			addDocument(writer, "A", "Should we, could we, would we?");
 			addDocument(writer, "B", "it should.  Should it?");
 			addDocument(writer, "C", "it shouldn't.");
@@ -52,7 +52,7 @@ namespace Lucene.Net.Search.Spans
 			writer.Close();
 			
 			// re-open the searcher since we added more docs
-			searcher2 = new IndexSearcher(mDirectory);
+			searcher2 = new IndexSearcher(mDirectory, true);
 		}
 		
 		/// <summary> Verifies that the index has the correct number of documents.
@@ -62,7 +62,7 @@ namespace Lucene.Net.Search.Spans
 		[Test]
 		public virtual void  TestVerifyIndex()
 		{
-			IndexReader reader = IndexReader.Open(mDirectory);
+			IndexReader reader = IndexReader.Open(mDirectory, true);
 			Assert.AreEqual(8, reader.NumDocs());
 			reader.Close();
 		}

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestSimilarity.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestSimilarity.cs?rev=1201357&r1=1201356&r2=1201357&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestSimilarity.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestSimilarity.cs Sat Nov 12 23:51:42 2011
@@ -209,7 +209,7 @@ namespace Lucene.Net.Search
 			{
 				return 2.0f;
 			}
-			public override float Idf(System.Collections.ICollection terms, Searcher searcher)
+			public override float Idf(System.Collections.Generic.ICollection<Term> terms, Searcher searcher)
 			{
 				return 1.0f;
 			}



Mime
View raw message