lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [28/34] lucenenet git commit: Passing Similarity and TimeZone into RandomIndexWriter ctors.
Date Fri, 12 Aug 2016 13:20:42 GMT
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Index/TestDocValuesIndexing.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestDocValuesIndexing.cs b/src/Lucene.Net.Tests/core/Index/TestDocValuesIndexing.cs
index 0a50535..8aeddf0 100644
--- a/src/Lucene.Net.Tests/core/Index/TestDocValuesIndexing.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestDocValuesIndexing.cs
@@ -57,7 +57,7 @@ namespace Lucene.Net.Index
         public virtual void TestAddIndexes()
         {
             Directory d1 = NewDirectory();
-            RandomIndexWriter w = new RandomIndexWriter(Random(), d1);
+            RandomIndexWriter w = new RandomIndexWriter(Random(), d1, Similarity, TimeZone);
             Document doc = new Document();
             doc.Add(NewStringField("id", "1", Field.Store.YES));
             doc.Add(new NumericDocValuesField("dv", 1));
@@ -66,7 +66,7 @@ namespace Lucene.Net.Index
             w.Dispose();
 
             Directory d2 = NewDirectory();
-            w = new RandomIndexWriter(Random(), d2);
+            w = new RandomIndexWriter(Random(), d2, Similarity, TimeZone);
             doc = new Document();
             doc.Add(NewStringField("id", "2", Field.Store.YES));
             doc.Add(new NumericDocValuesField("dv", 2));
@@ -75,7 +75,7 @@ namespace Lucene.Net.Index
             w.Dispose();
 
             Directory d3 = NewDirectory();
-            w = new RandomIndexWriter(Random(), d3);
+            w = new RandomIndexWriter(Random(), d3, Similarity, TimeZone);
             w.AddIndexes(SlowCompositeReaderWrapper.Wrap(r1), SlowCompositeReaderWrapper.Wrap(r2));
             r1.Dispose();
             d1.Dispose();
@@ -97,7 +97,7 @@ namespace Lucene.Net.Index
         public virtual void TestMultiValuedDocValuesField()
         {
             Directory d = NewDirectory();
-            RandomIndexWriter w = new RandomIndexWriter(Random(), d);
+            RandomIndexWriter w = new RandomIndexWriter(Random(), d, Similarity, TimeZone);
             Document doc = new Document();
             Field f = new NumericDocValuesField("field", 17);
             // Index doc values are single-valued so we should not
@@ -129,7 +129,7 @@ namespace Lucene.Net.Index
         public virtual void TestDifferentTypedDocValuesField()
         {
             Directory d = NewDirectory();
-            RandomIndexWriter w = new RandomIndexWriter(Random(), d);
+            RandomIndexWriter w = new RandomIndexWriter(Random(), d, Similarity, TimeZone);
             Document doc = new Document();
             // Index doc values are single-valued so we should not
             // be able to add same field more than once:
@@ -161,7 +161,7 @@ namespace Lucene.Net.Index
         public virtual void TestDifferentTypedDocValuesField2()
         {
             Directory d = NewDirectory();
-            RandomIndexWriter w = new RandomIndexWriter(Random(), d);
+            RandomIndexWriter w = new RandomIndexWriter(Random(), d, Similarity, TimeZone);
             Document doc = new Document();
             // Index doc values are single-valued so we should not
             // be able to add same field more than once:

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Index/TestDocValuesWithThreads.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestDocValuesWithThreads.cs b/src/Lucene.Net.Tests/core/Index/TestDocValuesWithThreads.cs
index 5d29a06..3ba618a 100644
--- a/src/Lucene.Net.Tests/core/Index/TestDocValuesWithThreads.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestDocValuesWithThreads.cs
@@ -181,7 +181,7 @@ namespace Lucene.Net.Index
             Random random = Random();
             int NUM_DOCS = AtLeast(100);
             Directory dir = NewDirectory();
-            RandomIndexWriter writer = new RandomIndexWriter(random, dir);
+            RandomIndexWriter writer = new RandomIndexWriter(random, dir, Similarity, TimeZone);
             bool allowDups = random.NextBoolean();
             HashSet<string> seen = new HashSet<string>();
             if (VERBOSE)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Index/TestDocsAndPositions.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestDocsAndPositions.cs b/src/Lucene.Net.Tests/core/Index/TestDocsAndPositions.cs
index 1a11039..c86d82a 100644
--- a/src/Lucene.Net.Tests/core/Index/TestDocsAndPositions.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestDocsAndPositions.cs
@@ -377,7 +377,7 @@ namespace Lucene.Net.Index
         public virtual void TestDocsEnumStart()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
             Document doc = new Document();
             doc.Add(NewStringField("foo", "bar", Field.Store.NO));
             writer.AddDocument(doc);
@@ -404,7 +404,7 @@ namespace Lucene.Net.Index
         public virtual void TestDocsAndPositionsEnumStart()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
             Document doc = new Document();
             doc.Add(NewTextField("foo", "bar", Field.Store.NO));
             writer.AddDocument(doc);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Index/TestFieldsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestFieldsReader.cs b/src/Lucene.Net.Tests/core/Index/TestFieldsReader.cs
index 5e5825d..0ec38fe 100644
--- a/src/Lucene.Net.Tests/core/Index/TestFieldsReader.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestFieldsReader.cs
@@ -46,7 +46,7 @@ namespace Lucene.Net.Index
         private static FieldInfos.Builder FieldInfos = null;
 
         [TestFixtureSetUp]
-        public static void BeforeClass()
+        public void BeforeClass()
         {
             TestDoc = new Document();
             FieldInfos = new FieldInfos.Builder();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Index/TestIndexWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexWriter.cs b/src/Lucene.Net.Tests/core/Index/TestIndexWriter.cs
index b1c9888..45f0640 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriter.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriter.cs
@@ -2278,7 +2278,7 @@ namespace Lucene.Net.Index
         {
             Directory dir = NewDirectory();
             Analyzer a = new AnalyzerAnonymousInnerClassHelper2(this);
-            RandomIndexWriter iw = new RandomIndexWriter(Random(), dir, a);
+            RandomIndexWriter iw = new RandomIndexWriter(Random(), dir, a, Similarity, TimeZone);
             Document doc = new Document();
             doc.Add(new TextField("body", "just a", Field.Store.NO));
             doc.Add(new TextField("body", "test of gaps", Field.Store.NO));
@@ -2320,7 +2320,7 @@ namespace Lucene.Net.Index
             Directory dir = NewDirectory();
             Automaton secondSet = BasicAutomata.MakeString("foobar");
             Analyzer a = new AnalyzerAnonymousInnerClassHelper3(this, secondSet);
-            RandomIndexWriter iw = new RandomIndexWriter(Random(), dir, a);
+            RandomIndexWriter iw = new RandomIndexWriter(Random(), dir, a, Similarity, TimeZone);
             Document doc = new Document();
             doc.Add(new TextField("body", "just a foobar", Field.Store.NO));
             doc.Add(new TextField("body", "test of gaps", Field.Store.NO));

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Index/TestIndexWriterDelete.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexWriterDelete.cs b/src/Lucene.Net.Tests/core/Index/TestIndexWriterDelete.cs
index 60df181..4d640f3 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriterDelete.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriterDelete.cs
@@ -332,7 +332,7 @@ namespace Lucene.Net.Index
         public virtual void TestDeleteAllNoDeadLock()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter modifier = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter modifier = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
             int numThreads = AtLeast(2);
             ThreadClass[] threads = new ThreadClass[numThreads];
             CountdownEvent latch = new CountdownEvent(1);
@@ -1106,7 +1106,7 @@ namespace Lucene.Net.Index
         public virtual void TestDeleteAllSlowly()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter w = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter w = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
             int NUM_DOCS = AtLeast(1000);
             IList<int?> ids = new List<int?>(NUM_DOCS);
             for (int id = 0; id < NUM_DOCS; id++)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs b/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs
index 2a927d9..0498329 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs
@@ -1720,7 +1720,7 @@ namespace Lucene.Net.Index
         public virtual void TestAddDocsNonAbortingException()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter w = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter w = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
             int numDocs1 = Random().Next(25);
             for (int docCount = 0; docCount < numDocs1; docCount++)
             {
@@ -1786,7 +1786,7 @@ namespace Lucene.Net.Index
         public virtual void TestUpdateDocsNonAbortingException()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter w = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter w = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
             int numDocs1 = Random().Next(25);
             for (int docCount = 0; docCount < numDocs1; docCount++)
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Index/TestIndexWriterReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexWriterReader.cs b/src/Lucene.Net.Tests/core/Index/TestIndexWriterReader.cs
index 051fd98..cd560cc 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriterReader.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriterReader.cs
@@ -488,7 +488,7 @@ namespace Lucene.Net.Index
                 this.NumDirs = numDirs;
                 this.MainWriter = mainWriter;
                 AddDir = NewDirectory();
-                IndexWriter writer = new IndexWriter(AddDir, (IndexWriterConfig)NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetMaxBufferedDocs(2));
+                IndexWriter writer = new IndexWriter(AddDir, OuterInstance.NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random())).SetMaxBufferedDocs(2));
                 TestUtil.ReduceOpenFiles(writer);
                 for (int i = 0; i < NUM_INIT_DOCS; i++)
                 {
@@ -704,9 +704,9 @@ namespace Lucene.Net.Index
          * //} //writer.DeleteDocuments(term); td.Dispose(); return doc; }
          */
 
-        public static void CreateIndex(Random random, Directory dir1, string indexName, bool multiSegment)
+        public void CreateIndex(Random random, Directory dir1, string indexName, bool multiSegment)
         {
-            IndexWriter w = new IndexWriter(dir1, LuceneTestCase.NewIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer(random)).SetMergePolicy(new LogDocMergePolicy()));
+            IndexWriter w = new IndexWriter(dir1, NewIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer(random)).SetMergePolicy(new LogDocMergePolicy()));
             for (int i = 0; i < 100; i++)
             {
                 w.AddDocument(DocHelper.CreateDocument(i, indexName, 4));
@@ -1186,7 +1186,7 @@ namespace Lucene.Net.Index
 
             public override void Warm(AtomicReader r)
             {
-                IndexSearcher s = NewSearcher(r);
+                IndexSearcher s = OuterInstance.NewSearcher(r);
                 TopDocs hits = s.Search(new TermQuery(new Term("foo", "bar")), 10);
                 Assert.AreEqual(20, hits.TotalHits);
                 DidWarm.Set(true);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Index/TestIndexWriterUnicode.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexWriterUnicode.cs b/src/Lucene.Net.Tests/core/Index/TestIndexWriterUnicode.cs
index a296efa..9e301f7 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriterUnicode.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriterUnicode.cs
@@ -317,7 +317,7 @@ namespace Lucene.Net.Index
         {
             Random rnd = Random();
             Directory dir = NewDirectory();
-            RandomIndexWriter writer = new RandomIndexWriter(rnd, dir);
+            RandomIndexWriter writer = new RandomIndexWriter(rnd, dir, Similarity, TimeZone);
             Document d = new Document();
             // Single segment
             Field f = NewStringField("f", "", Field.Store.NO);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Index/TestIndexableField.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexableField.cs b/src/Lucene.Net.Tests/core/Index/TestIndexableField.cs
index cce7ca3..d353dfa 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexableField.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexableField.cs
@@ -232,7 +232,7 @@ namespace Lucene.Net.Index
         public virtual void TestArbitraryFields()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter w = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter w = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
 
             int NUM_DOCS = AtLeast(27);
             if (VERBOSE)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Index/TestIsCurrent.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIsCurrent.cs b/src/Lucene.Net.Tests/core/Index/TestIsCurrent.cs
index b8e0a7e..6cb1f03 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIsCurrent.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIsCurrent.cs
@@ -40,7 +40,7 @@ namespace Lucene.Net.Index
 
             // initialize directory
             Directory = NewDirectory();
-            Writer = new RandomIndexWriter(Random(), directory, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            Writer = new RandomIndexWriter(Random(), Directory, Similarity, TimeZone);
 
             // write document
             Document doc = new Document();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Index/TestOmitPositions.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestOmitPositions.cs b/src/Lucene.Net.Tests/core/Index/TestOmitPositions.cs
index 264f811..db15cdd 100644
--- a/src/Lucene.Net.Tests/core/Index/TestOmitPositions.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestOmitPositions.cs
@@ -45,7 +45,7 @@ namespace Lucene.Net.Index
         public virtual void TestBasic()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter w = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter w = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
             Document doc = new Document();
             FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);
             ft.IndexOptions = FieldInfo.IndexOptions.DOCS_AND_FREQS;
@@ -254,7 +254,7 @@ namespace Lucene.Net.Index
             ft.IndexOptions = FieldInfo.IndexOptions.DOCS_AND_FREQS;
 
             Directory dir = NewDirectory();
-            RandomIndexWriter iw = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter iw = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
 
             for (int i = 0; i < 20; i++)
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Index/TestPayloads.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestPayloads.cs b/src/Lucene.Net.Tests/core/Index/TestPayloads.cs
index ed80cc3..2e9427f 100644
--- a/src/Lucene.Net.Tests/core/Index/TestPayloads.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestPayloads.cs
@@ -636,13 +636,13 @@ namespace Lucene.Net.Index
         public virtual void TestAcrossFields()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, new MockAnalyzer(Random(), MockTokenizer.WHITESPACE, true));
+            RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, new MockAnalyzer(Random(), MockTokenizer.WHITESPACE, true), Similarity, TimeZone);
             Document doc = new Document();
             doc.Add(new TextField("hasMaybepayload", "here we go", Field.Store.YES));
             writer.AddDocument(doc);
             writer.Dispose();
 
-            writer = new RandomIndexWriter(Random(), dir, new MockAnalyzer(Random(), MockTokenizer.WHITESPACE, true));
+            writer = new RandomIndexWriter(Random(), dir, new MockAnalyzer(Random(), MockTokenizer.WHITESPACE, true), Similarity, TimeZone);
             doc = new Document();
             doc.Add(new TextField("hasMaybepayload2", "here we go", Field.Store.YES));
             writer.AddDocument(doc);
@@ -696,7 +696,7 @@ namespace Lucene.Net.Index
         public virtual void TestMixupMultiValued()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
             Document doc = new Document();
             Field field = new TextField("field", "", Field.Store.NO);
             TokenStream ts = new MockTokenizer(new StringReader("here we go"), MockTokenizer.WHITESPACE, true);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Index/TestPayloadsOnVectors.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestPayloadsOnVectors.cs b/src/Lucene.Net.Tests/core/Index/TestPayloadsOnVectors.cs
index d2f6380..b785164 100644
--- a/src/Lucene.Net.Tests/core/Index/TestPayloadsOnVectors.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestPayloadsOnVectors.cs
@@ -95,7 +95,7 @@ namespace Lucene.Net.Index
         public virtual void TestMixupMultiValued()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
             Document doc = new Document();
             FieldType customType = new FieldType(TextField.TYPE_NOT_STORED);
             customType.StoreTermVectors = true;
@@ -138,7 +138,7 @@ namespace Lucene.Net.Index
         public virtual void TestPayloadsWithoutPositions()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
             Document doc = new Document();
             FieldType customType = new FieldType(TextField.TYPE_NOT_STORED);
             customType.StoreTermVectors = true;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Index/TestPostingsOffsets.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestPostingsOffsets.cs b/src/Lucene.Net.Tests/core/Index/TestPostingsOffsets.cs
index 9aa4dfa..8b0e0ba 100644
--- a/src/Lucene.Net.Tests/core/Index/TestPostingsOffsets.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestPostingsOffsets.cs
@@ -438,7 +438,7 @@ namespace Lucene.Net.Index
         public virtual void TestAddFieldTwice()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter iw = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter iw = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
             Document doc = new Document();
             FieldType customType3 = new FieldType(TextField.TYPE_STORED);
             customType3.StoreTermVectors = true;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Index/TestRollback.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestRollback.cs b/src/Lucene.Net.Tests/core/Index/TestRollback.cs
index d7f0e86..c55f16d 100644
--- a/src/Lucene.Net.Tests/core/Index/TestRollback.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestRollback.cs
@@ -36,7 +36,7 @@ namespace Lucene.Net.Index
         public virtual void TestRollbackIntegrityWithBufferFlush()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter rw = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter rw = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
             for (int i = 0; i < 5; i++)
             {
                 Document doc = new Document();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Index/TestSameTokenSamePosition.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestSameTokenSamePosition.cs b/src/Lucene.Net.Tests/core/Index/TestSameTokenSamePosition.cs
index ee7e0a8..5f832b0 100644
--- a/src/Lucene.Net.Tests/core/Index/TestSameTokenSamePosition.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestSameTokenSamePosition.cs
@@ -39,7 +39,7 @@ namespace Lucene.Net.Index
         public virtual void Test()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter riw = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter riw = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
             Document doc = new Document();
             doc.Add(new TextField("eng", new BugReproTokenStream()));
             riw.AddDocument(doc);
@@ -54,7 +54,7 @@ namespace Lucene.Net.Index
         public virtual void TestMoreDocs()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter riw = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter riw = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
             for (int i = 0; i < 100; i++)
             {
                 Document doc = new Document();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Index/TestSizeBoundedForceMerge.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestSizeBoundedForceMerge.cs b/src/Lucene.Net.Tests/core/Index/TestSizeBoundedForceMerge.cs
index c9080e0..7d0e0ab 100644
--- a/src/Lucene.Net.Tests/core/Index/TestSizeBoundedForceMerge.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestSizeBoundedForceMerge.cs
@@ -50,7 +50,7 @@ namespace Lucene.Net.Index
             writer.Commit();
         }
 
-        private static IndexWriterConfig NewWriterConfig()
+        private IndexWriterConfig NewWriterConfig()
         {
             IndexWriterConfig conf = NewIndexWriterConfig(TEST_VERSION_CURRENT, null);
             conf.SetMaxBufferedDocs(IndexWriterConfig.DISABLE_AUTO_FLUSH);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Index/TestStressAdvance.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestStressAdvance.cs b/src/Lucene.Net.Tests/core/Index/TestStressAdvance.cs
index 4e8cefb..ecd8643 100644
--- a/src/Lucene.Net.Tests/core/Index/TestStressAdvance.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestStressAdvance.cs
@@ -41,7 +41,7 @@ namespace Lucene.Net.Index
                     Console.WriteLine("\nTEST: iter=" + iter);
                 }
                 Directory dir = NewDirectory();
-                RandomIndexWriter w = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+                RandomIndexWriter w = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
                 HashSet<int> aDocs = new HashSet<int>();
                 Documents.Document doc = new Documents.Document();
                 Field f = NewStringField("field", "", Field.Store.NO);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Index/TestStressIndexing.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestStressIndexing.cs b/src/Lucene.Net.Tests/core/Index/TestStressIndexing.cs
index f594fdc..48dbbff 100644
--- a/src/Lucene.Net.Tests/core/Index/TestStressIndexing.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestStressIndexing.cs
@@ -130,10 +130,12 @@ namespace Lucene.Net.Index
         private class SearcherThread : TimedThread
         {
             internal Directory Directory;
+            private readonly LuceneTestCase OuterInstance;
 
-            public SearcherThread(Directory directory, TimedThread[] threads)
+            public SearcherThread(Directory directory, TimedThread[] threads, LuceneTestCase outerInstance)
                 : base(threads)
             {
+                OuterInstance = outerInstance;
                 this.Directory = directory;
             }
 
@@ -142,7 +144,7 @@ namespace Lucene.Net.Index
                 for (int i = 0; i < 100; i++)
                 {
                     IndexReader ir = DirectoryReader.Open(Directory);
-                    IndexSearcher @is = NewSearcher(ir);
+                    IndexSearcher @is = OuterInstance.NewSearcher(ir);
                     ir.Dispose();
                 }
                 Count += 100;
@@ -174,11 +176,11 @@ namespace Lucene.Net.Index
 
             // Two searchers that constantly just re-instantiate the
             // searcher:
-            SearcherThread searcherThread1 = new SearcherThread(directory, threads);
+            SearcherThread searcherThread1 = new SearcherThread(directory, threads, this);
             threads[numThread++] = searcherThread1;
             searcherThread1.Start();
 
-            SearcherThread searcherThread2 = new SearcherThread(directory, threads);
+            SearcherThread searcherThread2 = new SearcherThread(directory, threads, this);
             threads[numThread++] = searcherThread2;
             searcherThread2.Start();
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Index/TestStressIndexing2.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestStressIndexing2.cs b/src/Lucene.Net.Tests/core/Index/TestStressIndexing2.cs
index f335a90..2275402 100644
--- a/src/Lucene.Net.Tests/core/Index/TestStressIndexing2.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestStressIndexing2.cs
@@ -272,9 +272,9 @@ namespace Lucene.Net.Index
             return docs;
         }
 
-        public static void IndexSerial(Random random, IDictionary<string, Document> docs, Directory dir)
+        public void IndexSerial(Random random, IDictionary<string, Document> docs, Directory dir)
         {
-            IndexWriter w = new IndexWriter(dir, LuceneTestCase.NewIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer(random)).SetMergePolicy(NewLogMergePolicy()));
+            IndexWriter w = new IndexWriter(dir, NewIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer(random)).SetMergePolicy(NewLogMergePolicy()));
 
             // index all docs in a single thread
             IEnumerator<Document> iter = docs.Values.GetEnumerator();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Index/TestStressNRT.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestStressNRT.cs b/src/Lucene.Net.Tests/core/Index/TestStressNRT.cs
index af8649a..7a61009 100644
--- a/src/Lucene.Net.Tests/core/Index/TestStressNRT.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestStressNRT.cs
@@ -465,7 +465,7 @@ namespace Lucene.Net.Index
                         }
                         else
                         {
-                            searcher = NewSearcher(r);
+                            searcher = OuterInstance.NewSearcher(r);
                             lastReader = r;
                             lastSearcher = searcher;
                         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Index/TestSumDocFreq.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestSumDocFreq.cs b/src/Lucene.Net.Tests/core/Index/TestSumDocFreq.cs
index 73cc3c4..27ab03a 100644
--- a/src/Lucene.Net.Tests/core/Index/TestSumDocFreq.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestSumDocFreq.cs
@@ -41,7 +41,7 @@ namespace Lucene.Net.Index
             int numDocs = AtLeast(500);
 
             Directory dir = NewDirectory();
-            RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
 
             Document doc = new Document();
             Field id = NewStringField("id", "", Field.Store.NO);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Index/TestTermVectorsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestTermVectorsReader.cs b/src/Lucene.Net.Tests/core/Index/TestTermVectorsReader.cs
index 86937a3..c2620c9 100644
--- a/src/Lucene.Net.Tests/core/Index/TestTermVectorsReader.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestTermVectorsReader.cs
@@ -410,7 +410,7 @@ namespace Lucene.Net.Index
         public virtual void TestIllegalIndexableField()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter w = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter w = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
             FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);
             ft.StoreTermVectors = true;
             ft.StoreTermVectorPayloads = true;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Index/TestTermsEnum.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestTermsEnum.cs b/src/Lucene.Net.Tests/core/Index/TestTermsEnum.cs
index f175d90..39c404c 100644
--- a/src/Lucene.Net.Tests/core/Index/TestTermsEnum.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestTermsEnum.cs
@@ -53,7 +53,7 @@ namespace Lucene.Net.Index
             Directory d = NewDirectory();
             MockAnalyzer analyzer = new MockAnalyzer(Random());
             analyzer.MaxTokenLength = TestUtil.NextInt(Random(), 1, IndexWriter.MAX_TERM_LENGTH);
-            RandomIndexWriter w = new RandomIndexWriter(Random(), d, analyzer);
+            RandomIndexWriter w = new RandomIndexWriter(Random(), d, analyzer, Similarity, TimeZone);
             int numDocs = AtLeast(10);
             for (int docCount = 0; docCount < numDocs; docCount++)
             {
@@ -230,7 +230,7 @@ namespace Lucene.Net.Index
         public virtual void TestIntersectRandom()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter w = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter w = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
 
             int numTerms = AtLeast(300);
             //final int numTerms = 50;
@@ -583,7 +583,7 @@ namespace Lucene.Net.Index
         public virtual void TestZeroTerms()
         {
             var d = NewDirectory();
-            RandomIndexWriter w = new RandomIndexWriter(Random(), d);
+            RandomIndexWriter w = new RandomIndexWriter(Random(), d, Similarity, TimeZone);
             Document doc = new Document();
             doc.Add(NewTextField("field", "one two three", Field.Store.NO));
             doc = new Document();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Index/TestTransactions.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestTransactions.cs b/src/Lucene.Net.Tests/core/Index/TestTransactions.cs
index a6d4635..24f539f 100644
--- a/src/Lucene.Net.Tests/core/Index/TestTransactions.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestTransactions.cs
@@ -134,7 +134,7 @@ namespace Lucene.Net.Index
 
             public override void DoWork()
             {
-                var config = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))
+                var config = OuterInstance.NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))
                                 .SetMaxBufferedDocs(3)
                                 .SetMergeScheduler(_scheduler1)
                                 .SetMergePolicy(NewLogMergePolicy(2));
@@ -143,7 +143,7 @@ namespace Lucene.Net.Index
 
                 // Intentionally use different params so flush/merge
                 // happen @ different times
-                var config2 = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))
+                var config2 = OuterInstance.NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))
                                 .SetMaxBufferedDocs(2)
                                 .SetMergeScheduler(_scheduler2)
                                 .SetMergePolicy(NewLogMergePolicy(3));

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Search/Payloads/PayloadHelper.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/Payloads/PayloadHelper.cs b/src/Lucene.Net.Tests/core/Search/Payloads/PayloadHelper.cs
index b9d3543..1a33ec7 100644
--- a/src/Lucene.Net.Tests/core/Search/Payloads/PayloadHelper.cs
+++ b/src/Lucene.Net.Tests/core/Search/Payloads/PayloadHelper.cs
@@ -144,7 +144,7 @@ namespace Lucene.Net.Search.Payloads
             Reader = DirectoryReader.Open(writer, true);
             writer.Dispose();
 
-            IndexSearcher searcher = LuceneTestCase.NewSearcher(Reader);
+            IndexSearcher searcher = LuceneTestCase.NewSearcher(Reader, similarity);
             searcher.Similarity = similarity;
             return searcher;
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Search/Payloads/TestPayloadTermQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/Payloads/TestPayloadTermQuery.cs b/src/Lucene.Net.Tests/core/Search/Payloads/TestPayloadTermQuery.cs
index 7e5038c..7a1e1cd 100644
--- a/src/Lucene.Net.Tests/core/Search/Payloads/TestPayloadTermQuery.cs
+++ b/src/Lucene.Net.Tests/core/Search/Payloads/TestPayloadTermQuery.cs
@@ -305,7 +305,7 @@ namespace Lucene.Net.Search.Payloads
             Assert.IsTrue(hits.TotalHits == 1, "hits Size: " + hits.TotalHits + " is not: " + 1);
             int[] results = new int[1];
             results[0] = 0; //hits.ScoreDocs[0].Doc;
-            CheckHits.CheckHitCollector(Random(), query, PayloadHelper.NO_PAYLOAD_FIELD, Searcher, results);
+            CheckHits.CheckHitCollector(Random(), query, PayloadHelper.NO_PAYLOAD_FIELD, Searcher, results, Similarity);
         }
 
         internal class BoostingSimilarity : DefaultSimilarity

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Search/Similarities/TestSimilarity2.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/Similarities/TestSimilarity2.cs b/src/Lucene.Net.Tests/core/Search/Similarities/TestSimilarity2.cs
index 27e58b2..c2d3fab 100644
--- a/src/Lucene.Net.Tests/core/Search/Similarities/TestSimilarity2.cs
+++ b/src/Lucene.Net.Tests/core/Search/Similarities/TestSimilarity2.cs
@@ -84,7 +84,7 @@ namespace Lucene.Net.Search.Similarities
         public virtual void TestEmptyIndex()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter iw = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter iw = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
             IndexReader ir = iw.Reader;
             iw.Dispose();
             IndexSearcher @is = NewSearcher(ir);
@@ -104,7 +104,7 @@ namespace Lucene.Net.Search.Similarities
         public virtual void TestEmptyField()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter iw = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter iw = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
             Document doc = new Document();
             doc.Add(NewTextField("foo", "bar", Field.Store.NO));
             iw.AddDocument(doc);
@@ -130,7 +130,7 @@ namespace Lucene.Net.Search.Similarities
         public virtual void TestEmptyTerm()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter iw = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter iw = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
             Document doc = new Document();
             doc.Add(NewTextField("foo", "bar", Field.Store.NO));
             iw.AddDocument(doc);
@@ -156,7 +156,7 @@ namespace Lucene.Net.Search.Similarities
         public virtual void TestNoNorms()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter iw = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter iw = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
             Document doc = new Document();
             FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);
             ft.OmitNorms = true;
@@ -184,7 +184,7 @@ namespace Lucene.Net.Search.Similarities
         public virtual void TestOmitTF()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter iw = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter iw = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
             Document doc = new Document();
             FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);
             ft.IndexOptions = FieldInfo.IndexOptions.DOCS_ONLY;
@@ -213,7 +213,7 @@ namespace Lucene.Net.Search.Similarities
         public virtual void TestOmitTFAndNorms()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter iw = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter iw = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
             Document doc = new Document();
             FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);
             ft.IndexOptions = FieldInfo.IndexOptions.DOCS_ONLY;
@@ -247,7 +247,7 @@ namespace Lucene.Net.Search.Similarities
             // however with spans, there is only one scorer for the whole hierarchy:
             // inner queries are not real queries, their boosts are ignored, etc.
             Directory dir = NewDirectory();
-            RandomIndexWriter iw = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter iw = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
             Document doc = new Document();
             FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);
             doc.Add(NewField("foo", "bar", ft));

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Search/Similarities/TestSimilarityBase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/Similarities/TestSimilarityBase.cs b/src/Lucene.Net.Tests/core/Search/Similarities/TestSimilarityBase.cs
index 2b2c7ab..5d744c2 100644
--- a/src/Lucene.Net.Tests/core/Search/Similarities/TestSimilarityBase.cs
+++ b/src/Lucene.Net.Tests/core/Search/Similarities/TestSimilarityBase.cs
@@ -106,7 +106,7 @@ namespace Lucene.Net.Search.Similarities
             base.SetUp();
 
             Dir = NewDirectory();
-            RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter writer = new RandomIndexWriter(Random(), Dir, Similarity, TimeZone);
 
             for (int i = 0; i < Docs.Length; i++)
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Search/Spans/TestBasics.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/Spans/TestBasics.cs b/src/Lucene.Net.Tests/core/Search/Spans/TestBasics.cs
index 968becb..bbe41ed 100644
--- a/src/Lucene.Net.Tests/core/Search/Spans/TestBasics.cs
+++ b/src/Lucene.Net.Tests/core/Search/Spans/TestBasics.cs
@@ -606,7 +606,7 @@ namespace Lucene.Net.Search.Spans
 
         private void CheckHits(Query query, int[] results)
         {
-            Search.CheckHits.DoCheckHits(Random(), query, "field", Searcher, results);
+            Search.CheckHits.DoCheckHits(Random(), query, "field", Searcher, results, Similarity);
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Search/Spans/TestFieldMaskingSpanQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/Spans/TestFieldMaskingSpanQuery.cs b/src/Lucene.Net.Tests/core/Search/Spans/TestFieldMaskingSpanQuery.cs
index 3d3bf4a..bb71d97 100644
--- a/src/Lucene.Net.Tests/core/Search/Spans/TestFieldMaskingSpanQuery.cs
+++ b/src/Lucene.Net.Tests/core/Search/Spans/TestFieldMaskingSpanQuery.cs
@@ -86,7 +86,7 @@ namespace Lucene.Net.Search.Spans
 
         protected internal virtual void Check(SpanQuery q, int[] docs)
         {
-            CheckHits.CheckHitCollector(Random(), q, null, Searcher, docs);
+            CheckHits.CheckHitCollector(Random(), q, null, Searcher, docs, Similarity);
         }
 
         [Test]

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Search/Spans/TestNearSpansOrdered.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/Spans/TestNearSpansOrdered.cs b/src/Lucene.Net.Tests/core/Search/Spans/TestNearSpansOrdered.cs
index 47d17f0..03a64ea 100644
--- a/src/Lucene.Net.Tests/core/Search/Spans/TestNearSpansOrdered.cs
+++ b/src/Lucene.Net.Tests/core/Search/Spans/TestNearSpansOrdered.cs
@@ -83,7 +83,7 @@ namespace Lucene.Net.Search.Spans
         public virtual void TestSpanNearQuery()
         {
             SpanNearQuery q = MakeQuery();
-            CheckHits.DoCheckHits(Random(), q, FIELD, Searcher, new int[] { 0, 1 });
+            CheckHits.DoCheckHits(Random(), q, FIELD, Searcher, new int[] { 0, 1 }, Similarity);
         }
 
         public virtual string s(Spans span)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Search/Spans/TestSpanFirstQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/Spans/TestSpanFirstQuery.cs b/src/Lucene.Net.Tests/core/Search/Spans/TestSpanFirstQuery.cs
index 4d53ab9..2266bf7 100644
--- a/src/Lucene.Net.Tests/core/Search/Spans/TestSpanFirstQuery.cs
+++ b/src/Lucene.Net.Tests/core/Search/Spans/TestSpanFirstQuery.cs
@@ -46,7 +46,7 @@ namespace Lucene.Net.Search.Spans
             CharacterRunAutomaton stopSet = new CharacterRunAutomaton((new RegExp("the|a|of")).ToAutomaton());
             Analyzer analyzer = new MockAnalyzer(Random(), MockTokenizer.SIMPLE, true, stopSet);
 
-            RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, analyzer);
+            RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, analyzer, Similarity, TimeZone);
             Document doc = new Document();
             doc.Add(NewTextField("field", "the quick brown fox", Field.Store.NO));
             writer.AddDocument(doc);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Search/Spans/TestSpanMultiTermQueryWrapper.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/Spans/TestSpanMultiTermQueryWrapper.cs b/src/Lucene.Net.Tests/core/Search/Spans/TestSpanMultiTermQueryWrapper.cs
index 364b2e7..1f0d524 100644
--- a/src/Lucene.Net.Tests/core/Search/Spans/TestSpanMultiTermQueryWrapper.cs
+++ b/src/Lucene.Net.Tests/core/Search/Spans/TestSpanMultiTermQueryWrapper.cs
@@ -44,7 +44,7 @@ namespace Lucene.Net.Search.Spans
         {
             base.SetUp();
             Directory = NewDirectory();
-            RandomIndexWriter iw = new RandomIndexWriter(Random(), directory, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter iw = new RandomIndexWriter(Random(), Directory, Similarity, TimeZone);
             Document doc = new Document();
             Field field = NewTextField("field", "", Field.Store.NO);
             doc.Add(field);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Search/Spans/TestSpans.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/Spans/TestSpans.cs b/src/Lucene.Net.Tests/core/Search/Spans/TestSpans.cs
index e4e7277..0244808 100644
--- a/src/Lucene.Net.Tests/core/Search/Spans/TestSpans.cs
+++ b/src/Lucene.Net.Tests/core/Search/Spans/TestSpans.cs
@@ -83,7 +83,7 @@ namespace Lucene.Net.Search.Spans
 
         private void CheckHits(Query query, int[] results)
         {
-            Search.CheckHits.DoCheckHits(Random(), query, field, Searcher, results);
+            Search.CheckHits.DoCheckHits(Random(), query, field, Searcher, results, Similarity);
         }
 
         private void OrderedSlopTest3SQ(SpanQuery q1, SpanQuery q2, SpanQuery q3, int slop, int[] expectedDocs)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Search/Spans/TestSpansAdvanced.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/Spans/TestSpansAdvanced.cs b/src/Lucene.Net.Tests/core/Search/Spans/TestSpansAdvanced.cs
index 857ced7..859ca20 100644
--- a/src/Lucene.Net.Tests/core/Search/Spans/TestSpansAdvanced.cs
+++ b/src/Lucene.Net.Tests/core/Search/Spans/TestSpansAdvanced.cs
@@ -128,9 +128,9 @@ namespace Lucene.Net.Search.Spans
         /// <param name="description"> the description of the search </param>
         /// <param name="expectedIds"> the expected document ids of the hits </param>
         /// <param name="expectedScores"> the expected scores of the hits </param>
-        protected internal static void AssertHits(IndexSearcher s, Query query, string description, string[] expectedIds, float[] expectedScores)
+        protected internal void AssertHits(IndexSearcher s, Query query, string description, string[] expectedIds, float[] expectedScores)
         {
-            QueryUtils.Check(Random(), query, s);
+            QueryUtils.Check(Random(), query, s, Similarity);
 
             const float tolerance = 1e-5f;
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Search/TestAutomatonQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestAutomatonQuery.cs b/src/Lucene.Net.Tests/core/Search/TestAutomatonQuery.cs
index 370bb9f..4cd8d3c 100644
--- a/src/Lucene.Net.Tests/core/Search/TestAutomatonQuery.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestAutomatonQuery.cs
@@ -55,7 +55,7 @@ namespace Lucene.Net.Search
         {
             base.SetUp();
             Directory = NewDirectory();
-            RandomIndexWriter writer = new RandomIndexWriter(Random(), directory, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter writer = new RandomIndexWriter(Random(), Directory, Similarity, TimeZone);
             Document doc = new Document();
             Field titleField = NewTextField("title", "some title", Field.Store.NO);
             Field field = NewTextField(FN, "this is document one 2345", Field.Store.NO);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Search/TestAutomatonQueryUnicode.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestAutomatonQueryUnicode.cs b/src/Lucene.Net.Tests/core/Search/TestAutomatonQueryUnicode.cs
index 56b4df1..60a38db 100644
--- a/src/Lucene.Net.Tests/core/Search/TestAutomatonQueryUnicode.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestAutomatonQueryUnicode.cs
@@ -50,7 +50,7 @@ namespace Lucene.Net.Search
         {
             base.SetUp();
             Directory = NewDirectory();
-            RandomIndexWriter writer = new RandomIndexWriter(Random(), directory, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter writer = new RandomIndexWriter(Random(), Directory, Similarity, TimeZone);
             Document doc = new Document();
             Field titleField = NewTextField("title", "some title", Field.Store.NO);
             Field field = NewTextField(FN, "", Field.Store.NO);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Search/TestBoolean2.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestBoolean2.cs b/src/Lucene.Net.Tests/core/Search/TestBoolean2.cs
index cb2ce62..7ba20e3 100644
--- a/src/Lucene.Net.Tests/core/Search/TestBoolean2.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestBoolean2.cs
@@ -91,7 +91,7 @@ namespace Lucene.Net.Search
                     Console.WriteLine("\nTEST: cycle...");
                 }
                 Directory copy = new MockDirectoryWrapper(Random(), new RAMDirectory(Dir2, IOContext.DEFAULT));
-                RandomIndexWriter w = new RandomIndexWriter(Random(), Dir2);
+                RandomIndexWriter w = new RandomIndexWriter(Random(), Dir2, Similarity, TimeZone);
                 w.AddIndexes(copy);
                 docCount = w.MaxDoc();
                 w.Dispose();
@@ -302,12 +302,12 @@ namespace Lucene.Net.Search
                     // match up.
                     Sort sort = Sort.INDEXORDER;
 
-                    QueryUtils.Check(Random(), q1, Searcher); // baseline sim
+                    QueryUtils.Check(Random(), q1, Searcher, Similarity); // baseline sim
                     try
                     {
                         // a little hackish, QueryUtils.check is too costly to do on bigSearcher in this loop.
                         Searcher.Similarity = BigSearcher.Similarity; // random sim
-                        QueryUtils.Check(Random(), q1, Searcher);
+                        QueryUtils.Check(Random(), q1, Searcher, Similarity);
                     }
                     finally
                     {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Search/TestBooleanMinShouldMatch.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestBooleanMinShouldMatch.cs b/src/Lucene.Net.Tests/core/Search/TestBooleanMinShouldMatch.cs
index 450cd73..fca1ddd 100644
--- a/src/Lucene.Net.Tests/core/Search/TestBooleanMinShouldMatch.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestBooleanMinShouldMatch.cs
@@ -50,7 +50,7 @@ namespace Lucene.Net.Search
             string[] data = new string[] { "A 1 2 3 4 5 6", "Z       4 5 6", null, "B   2   4 5 6", "Y     3   5 6", null, "C     3     6", "X       4 5 6" };
 
             Index = NewDirectory();
-            RandomIndexWriter w = new RandomIndexWriter(Random(), Index);
+            RandomIndexWriter w = new RandomIndexWriter(Random(), Index, Similarity, TimeZone);
 
             for (int i = 0; i < data.Length; i++)
             {
@@ -100,7 +100,7 @@ namespace Lucene.Net.Search
             }
             Assert.AreEqual(expected, h2.Length, "result count (bs2)");
 
-            QueryUtils.Check(Random(), q, s);
+            QueryUtils.Check(Random(), q, s, Similarity);
         }
 
         [Test]
@@ -352,8 +352,8 @@ namespace Lucene.Net.Search
                 TopDocs top2 = s.Search(q2, null, 100);
                 if (i < 100)
                 {
-                    QueryUtils.Check(Random(), q1, s);
-                    QueryUtils.Check(Random(), q2, s);
+                    QueryUtils.Check(Random(), q1, s, Similarity);
+                    QueryUtils.Check(Random(), q2, s, Similarity);
                 }
                 AssertSubsetOfSameScores(q2, top1, top2);
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Search/TestBooleanOr.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestBooleanOr.cs b/src/Lucene.Net.Tests/core/Search/TestBooleanOr.cs
index ede9299..1743a2f 100644
--- a/src/Lucene.Net.Tests/core/Search/TestBooleanOr.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestBooleanOr.cs
@@ -51,7 +51,7 @@ namespace Lucene.Net.Search
 
         private int Search(Query q)
         {
-            QueryUtils.Check(Random(), q, Searcher);
+            QueryUtils.Check(Random(), q, Searcher, Similarity);
             return Searcher.Search(q, null, 1000).TotalHits;
         }
 
@@ -145,7 +145,7 @@ namespace Lucene.Net.Search
             Dir = NewDirectory();
 
             //
-            RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter writer = new RandomIndexWriter(Random(), Dir, Similarity, TimeZone);
 
             //
             Document d = new Document();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Search/TestBooleanQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestBooleanQuery.cs b/src/Lucene.Net.Tests/core/Search/TestBooleanQuery.cs
index f3288c2..2e3272f 100644
--- a/src/Lucene.Net.Tests/core/Search/TestBooleanQuery.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestBooleanQuery.cs
@@ -86,7 +86,7 @@ namespace Lucene.Net.Search
         public virtual void TestNullOrSubScorer()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter w = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter w = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
             Document doc = new Document();
             doc.Add(NewTextField("field", "a b c d", Field.Store.NO));
             w.AddDocument(doc);
@@ -200,7 +200,7 @@ namespace Lucene.Net.Search
         public virtual void TestBS2DisjunctionNextVsAdvance()
         {
             Directory d = NewDirectory();
-            RandomIndexWriter w = new RandomIndexWriter(Random(), d);
+            RandomIndexWriter w = new RandomIndexWriter(Random(), d, Similarity, TimeZone);
             int numDocs = AtLeast(300);
             for (int docUpto = 0; docUpto < numDocs; docUpto++)
             {
@@ -369,7 +369,7 @@ namespace Lucene.Net.Search
         public virtual void TestInOrderWithMinShouldMatch()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter w = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter w = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
             Document doc = new Document();
             doc.Add(NewTextField("field", "some text here", Field.Store.NO));
             w.AddDocument(doc);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Search/TestBooleanScorer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestBooleanScorer.cs b/src/Lucene.Net.Tests/core/Search/TestBooleanScorer.cs
index 0e6915a..8af050b 100644
--- a/src/Lucene.Net.Tests/core/Search/TestBooleanScorer.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestBooleanScorer.cs
@@ -49,7 +49,7 @@ namespace Lucene.Net.Search
 
             string[] values = new string[] { "1", "2", "3", "4" };
 
-            RandomIndexWriter writer = new RandomIndexWriter(Random(), directory, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter writer = new RandomIndexWriter(Random(), directory, Similarity, TimeZone);
             for (int i = 0; i < values.Length; i++)
             {
                 Document doc = new Document();
@@ -83,7 +83,7 @@ namespace Lucene.Net.Search
             // changes, we have a test to back it up.
 
             Directory directory = NewDirectory();
-            RandomIndexWriter writer = new RandomIndexWriter(Random(), directory, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter writer = new RandomIndexWriter(Random(), directory, Similarity, TimeZone);
             writer.Commit();
             IndexReader ir = writer.Reader;
             writer.Dispose();
@@ -166,7 +166,7 @@ namespace Lucene.Net.Search
         public virtual void TestMoreThan32ProhibitedClauses()
         {
             Directory d = NewDirectory();
-            RandomIndexWriter w = new RandomIndexWriter(Random(), d);
+            RandomIndexWriter w = new RandomIndexWriter(Random(), d, Similarity, TimeZone);
             Document doc = new Document();
             doc.Add(new TextField("field", "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33", Field.Store.NO));
             w.AddDocument(doc);
@@ -321,7 +321,7 @@ namespace Lucene.Net.Search
         public virtual void TestEmbeddedBooleanScorer()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter w = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter w = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
             Document doc = new Document();
             doc.Add(NewTextField("field", "doctors are people who prescribe medicines of which they know little, to cure diseases of which they know less, in human beings of whom they know nothing", Field.Store.NO));
             w.AddDocument(doc);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Search/TestCachingWrapperFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestCachingWrapperFilter.cs b/src/Lucene.Net.Tests/core/Search/TestCachingWrapperFilter.cs
index 180d890..45a0894 100644
--- a/src/Lucene.Net.Tests/core/Search/TestCachingWrapperFilter.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestCachingWrapperFilter.cs
@@ -53,7 +53,7 @@ namespace Lucene.Net.Search
         {
             base.SetUp();
             Dir = NewDirectory();
-            Iw = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            Iw = new RandomIndexWriter(Random(), Dir, Similarity, TimeZone);
             Document doc = new Document();
             Field idField = new StringField("id", "", Field.Store.NO);
             doc.Add(idField);
@@ -173,7 +173,7 @@ namespace Lucene.Net.Search
         public virtual void TestCachingWorks()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
             writer.Dispose();
 
             IndexReader reader = SlowCompositeReaderWrapper.Wrap(DirectoryReader.Open(dir));
@@ -201,7 +201,7 @@ namespace Lucene.Net.Search
         public virtual void TestNullDocIdSet()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
             writer.Dispose();
 
             IndexReader reader = SlowCompositeReaderWrapper.Wrap(DirectoryReader.Open(dir));
@@ -240,7 +240,7 @@ namespace Lucene.Net.Search
         public virtual void TestNullDocIdSetIterator()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
             writer.Dispose();
 
             IndexReader reader = SlowCompositeReaderWrapper.Wrap(DirectoryReader.Open(dir));
@@ -324,7 +324,7 @@ namespace Lucene.Net.Search
         public virtual void TestIsCacheAble()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
             writer.AddDocument(new Document());
             writer.Dispose();
 
@@ -371,7 +371,7 @@ namespace Lucene.Net.Search
             // (must) get an NRT reader:
             DirectoryReader reader = DirectoryReader.Open(writer.w, true);
             // same reason we don't wrap?
-            IndexSearcher searcher = NewSearcher(reader, false);
+            IndexSearcher searcher = NewSearcher(reader, false, Similarity);
 
             // add a doc, refresh the reader, and check that it's there
             Document doc = new Document();
@@ -379,7 +379,7 @@ namespace Lucene.Net.Search
             writer.AddDocument(doc);
 
             reader = RefreshReader(reader);
-            searcher = NewSearcher(reader, false);
+            searcher = NewSearcher(reader, false, Similarity);
 
             TopDocs docs = searcher.Search(new MatchAllDocsQuery(), 1);
             Assert.AreEqual(1, docs.TotalHits, "Should find a hit...");
@@ -422,7 +422,7 @@ namespace Lucene.Net.Search
             oldReader = reader;
             reader = RefreshReader(reader);
 
-            searcher = NewSearcher(reader, false);
+            searcher = NewSearcher(reader, false, Similarity);
 
             missCount = filter.MissCount;
             docs = searcher.Search(new MatchAllDocsQuery(), filter, 1);
@@ -437,7 +437,7 @@ namespace Lucene.Net.Search
             filter = new CachingWrapperFilter(startFilter);
             writer.AddDocument(doc);
             reader = RefreshReader(reader);
-            searcher = NewSearcher(reader, false);
+            searcher = NewSearcher(reader, false, Similarity);
 
             docs = searcher.Search(new MatchAllDocsQuery(), filter, 1);
             Assert.AreEqual(1, docs.TotalHits, "[query + filter] Should find a hit...");
@@ -456,7 +456,7 @@ namespace Lucene.Net.Search
             oldReader = reader;
 
             reader = RefreshReader(reader);
-            searcher = NewSearcher(reader, false);
+            searcher = NewSearcher(reader, false, Similarity);
 
             docs = searcher.Search(new MatchAllDocsQuery(), filter, 1);
             Assert.AreEqual(2, docs.TotalHits, "[query + filter] Should find 2 hits...");
@@ -472,7 +472,7 @@ namespace Lucene.Net.Search
             writer.DeleteDocuments(new Term("id", "1"));
 
             reader = RefreshReader(reader);
-            searcher = NewSearcher(reader, false);
+            searcher = NewSearcher(reader, false, Similarity);
 
             docs = searcher.Search(new MatchAllDocsQuery(), filter, 1);
             Assert.AreEqual(0, docs.TotalHits, "[query + filter] Should *not* find a hit...");

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Search/TestConstantScoreQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestConstantScoreQuery.cs b/src/Lucene.Net.Tests/core/Search/TestConstantScoreQuery.cs
index 5097f22..e1a4ac5 100644
--- a/src/Lucene.Net.Tests/core/Search/TestConstantScoreQuery.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestConstantScoreQuery.cs
@@ -125,7 +125,7 @@ namespace Lucene.Net.Search
             try
             {
                 directory = NewDirectory();
-                RandomIndexWriter writer = new RandomIndexWriter(Random(), directory, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+                RandomIndexWriter writer = new RandomIndexWriter(Random(), directory, Similarity, TimeZone);
 
                 Document doc = new Document();
                 doc.Add(NewStringField("field", "term", Field.Store.NO));
@@ -191,7 +191,7 @@ namespace Lucene.Net.Search
         public virtual void TestConstantScoreQueryAndFilter()
         {
             Directory d = NewDirectory();
-            RandomIndexWriter w = new RandomIndexWriter(Random(), d);
+            RandomIndexWriter w = new RandomIndexWriter(Random(), d, Similarity, TimeZone);
             Document doc = new Document();
             doc.Add(NewStringField("field", "a", Field.Store.NO));
             w.AddDocument(doc);
@@ -222,7 +222,7 @@ namespace Lucene.Net.Search
         public virtual void TestQueryWrapperFilter()
         {
             Directory d = NewDirectory();
-            RandomIndexWriter w = new RandomIndexWriter(Random(), d);
+            RandomIndexWriter w = new RandomIndexWriter(Random(), d, Similarity, TimeZone);
             Document doc = new Document();
             doc.Add(NewStringField("field", "a", Field.Store.NO));
             w.AddDocument(doc);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Search/TestCustomSearcherSort.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestCustomSearcherSort.cs b/src/Lucene.Net.Tests/core/Search/TestCustomSearcherSort.cs
index dfa1d3c..4d374a0 100644
--- a/src/Lucene.Net.Tests/core/Search/TestCustomSearcherSort.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestCustomSearcherSort.cs
@@ -54,7 +54,7 @@ namespace Lucene.Net.Search
             base.SetUp();
             INDEX_SIZE = AtLeast(2000);
             Index = NewDirectory();
-            RandomIndexWriter writer = new RandomIndexWriter(Random(), Index);
+            RandomIndexWriter writer = new RandomIndexWriter(Random(), Index, Similarity, TimeZone);
             RandomGen random = new RandomGen(this, Random());
             for (int i = 0; i < INDEX_SIZE; ++i) // don't decrease; if to low the
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Search/TestDateFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestDateFilter.cs b/src/Lucene.Net.Tests/core/Search/TestDateFilter.cs
index 33a6831..01c41ed 100644
--- a/src/Lucene.Net.Tests/core/Search/TestDateFilter.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestDateFilter.cs
@@ -45,7 +45,7 @@ namespace Lucene.Net.Search
         {
             // create an index
             Directory indexStore = NewDirectory();
-            RandomIndexWriter writer = new RandomIndexWriter(Random(), indexStore);
+            RandomIndexWriter writer = new RandomIndexWriter(Random(), indexStore, Similarity, TimeZone);
 
             long now = DateTime.UtcNow.Ticks / TimeSpan.TicksPerMillisecond;
 
@@ -109,7 +109,7 @@ namespace Lucene.Net.Search
         {
             // create an index
             Directory indexStore = NewDirectory();
-            RandomIndexWriter writer = new RandomIndexWriter(Random(), indexStore);
+            RandomIndexWriter writer = new RandomIndexWriter(Random(), indexStore, Similarity, TimeZone);
 
             long now = DateTime.UtcNow.Ticks / TimeSpan.TicksPerMillisecond;
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Search/TestDateSort.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestDateSort.cs b/src/Lucene.Net.Tests/core/Search/TestDateSort.cs
index 122c9f1..0416740 100644
--- a/src/Lucene.Net.Tests/core/Search/TestDateSort.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestDateSort.cs
@@ -50,7 +50,7 @@ namespace Lucene.Net.Search
             base.SetUp();
             // Create an index writer.
             Directory = NewDirectory();
-            RandomIndexWriter writer = new RandomIndexWriter(Random(), directory, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter writer = new RandomIndexWriter(Random(), Directory, Similarity, TimeZone);
 
             // oldest doc:
             // Add the first document.  text = "Document 1"  dateTime = Oct 10 03:25:22 EDT 2007

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Search/TestDisjunctionMaxQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestDisjunctionMaxQuery.cs b/src/Lucene.Net.Tests/core/Search/TestDisjunctionMaxQuery.cs
index 9225131..ee10095 100644
--- a/src/Lucene.Net.Tests/core/Search/TestDisjunctionMaxQuery.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestDisjunctionMaxQuery.cs
@@ -185,7 +185,7 @@ namespace Lucene.Net.Search
             dq.Add(Tq("id", "d1"));
             dq.Add(Tq("dek", "DOES_NOT_EXIST"));
 
-            QueryUtils.Check(Random(), dq, s);
+            QueryUtils.Check(Random(), dq, s, Similarity);
             Assert.IsTrue(s.TopReaderContext is AtomicReaderContext);
             Weight dw = s.CreateNormalizedWeight(dq);
             AtomicReaderContext context = (AtomicReaderContext)s.TopReaderContext;
@@ -204,7 +204,7 @@ namespace Lucene.Net.Search
             dq.Add(Tq("dek", "albino"));
             dq.Add(Tq("dek", "DOES_NOT_EXIST"));
             Assert.IsTrue(s.TopReaderContext is AtomicReaderContext);
-            QueryUtils.Check(Random(), dq, s);
+            QueryUtils.Check(Random(), dq, s, Similarity);
             Weight dw = s.CreateNormalizedWeight(dq);
             AtomicReaderContext context = (AtomicReaderContext)s.TopReaderContext;
             Scorer ds = dw.Scorer(context, (context.AtomicReader).LiveDocs);
@@ -218,7 +218,7 @@ namespace Lucene.Net.Search
             DisjunctionMaxQuery q = new DisjunctionMaxQuery(0.0f);
             q.Add(Tq("hed", "albino"));
             q.Add(Tq("hed", "elephant"));
-            QueryUtils.Check(Random(), q, s);
+            QueryUtils.Check(Random(), q, s, Similarity);
 
             ScoreDoc[] h = s.Search(q, null, 1000).ScoreDocs;
 
@@ -245,7 +245,7 @@ namespace Lucene.Net.Search
             DisjunctionMaxQuery q = new DisjunctionMaxQuery(0.0f);
             q.Add(Tq("dek", "albino"));
             q.Add(Tq("dek", "elephant"));
-            QueryUtils.Check(Random(), q, s);
+            QueryUtils.Check(Random(), q, s, Similarity);
 
             ScoreDoc[] h = s.Search(q, null, 1000).ScoreDocs;
 
@@ -273,7 +273,7 @@ namespace Lucene.Net.Search
             q.Add(Tq("hed", "elephant"));
             q.Add(Tq("dek", "albino"));
             q.Add(Tq("dek", "elephant"));
-            QueryUtils.Check(Random(), q, s);
+            QueryUtils.Check(Random(), q, s, Similarity);
 
             ScoreDoc[] h = s.Search(q, null, 1000).ScoreDocs;
 
@@ -299,7 +299,7 @@ namespace Lucene.Net.Search
             DisjunctionMaxQuery q = new DisjunctionMaxQuery(0.01f);
             q.Add(Tq("dek", "albino"));
             q.Add(Tq("dek", "elephant"));
-            QueryUtils.Check(Random(), q, s);
+            QueryUtils.Check(Random(), q, s, Similarity);
 
             ScoreDoc[] h = s.Search(q, null, 1000).ScoreDocs;
 
@@ -329,17 +329,17 @@ namespace Lucene.Net.Search
                 q1.Add(Tq("hed", "albino"));
                 q1.Add(Tq("dek", "albino"));
                 q.Add(q1, BooleanClause.Occur.MUST); // true,false);
-                QueryUtils.Check(Random(), q1, s);
+                QueryUtils.Check(Random(), q1, s, Similarity);
             }
             {
                 DisjunctionMaxQuery q2 = new DisjunctionMaxQuery(0.0f);
                 q2.Add(Tq("hed", "elephant"));
                 q2.Add(Tq("dek", "elephant"));
                 q.Add(q2, BooleanClause.Occur.MUST); // true,false);
-                QueryUtils.Check(Random(), q2, s);
+                QueryUtils.Check(Random(), q2, s, Similarity);
             }
 
-            QueryUtils.Check(Random(), q, s);
+            QueryUtils.Check(Random(), q, s, Similarity);
 
             ScoreDoc[] h = s.Search(q, null, 1000).ScoreDocs;
 
@@ -375,7 +375,7 @@ namespace Lucene.Net.Search
                 q2.Add(Tq("dek", "elephant"));
                 q.Add(q2, BooleanClause.Occur.SHOULD); // false,false);
             }
-            QueryUtils.Check(Random(), q, s);
+            QueryUtils.Check(Random(), q, s, Similarity);
 
             ScoreDoc[] h = s.Search(q, null, 1000).ScoreDocs;
 
@@ -414,7 +414,7 @@ namespace Lucene.Net.Search
                 q2.Add(Tq("dek", "elephant"));
                 q.Add(q2, BooleanClause.Occur.SHOULD); // false,false);
             }
-            QueryUtils.Check(Random(), q, s);
+            QueryUtils.Check(Random(), q, s, Similarity);
 
             ScoreDoc[] h = s.Search(q, null, 1000).ScoreDocs;
 
@@ -464,7 +464,7 @@ namespace Lucene.Net.Search
                 q2.Add(Tq("dek", "elephant"));
                 q.Add(q2, BooleanClause.Occur.SHOULD); // false,false);
             }
-            QueryUtils.Check(Random(), q, s);
+            QueryUtils.Check(Random(), q, s, Similarity);
 
             ScoreDoc[] h = s.Search(q, null, 1000).ScoreDocs;
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Search/TestDocIdSet.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestDocIdSet.cs b/src/Lucene.Net.Tests/core/Search/TestDocIdSet.cs
index a4a1569..e322c18 100644
--- a/src/Lucene.Net.Tests/core/Search/TestDocIdSet.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestDocIdSet.cs
@@ -147,7 +147,7 @@ namespace Lucene.Net.Search
             // Tests that if a Filter produces a null DocIdSet, which is given to
             // IndexSearcher, everything works fine. this came up in LUCENE-1754.
             Directory dir = NewDirectory();
-            RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
             Document doc = new Document();
             doc.Add(NewStringField("c", "val", Field.Store.NO));
             writer.AddDocument(doc);
@@ -185,7 +185,7 @@ namespace Lucene.Net.Search
         public virtual void TestNullIteratorFilteredDocIdSet()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter writer = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
             Document doc = new Document();
             doc.Add(NewStringField("c", "val", Field.Store.NO));
             writer.AddDocument(doc);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Search/TestDocValuesScoring.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestDocValuesScoring.cs b/src/Lucene.Net.Tests/core/Search/TestDocValuesScoring.cs
index b7708c3..ba42db2 100644
--- a/src/Lucene.Net.Tests/core/Search/TestDocValuesScoring.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestDocValuesScoring.cs
@@ -51,7 +51,7 @@ namespace Lucene.Net.Search
         public virtual void TestSimple()
         {
             Directory dir = NewDirectory();
-            RandomIndexWriter iw = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            RandomIndexWriter iw = new RandomIndexWriter(Random(), dir, Similarity, TimeZone);
             Document doc = new Document();
             Field field = NewTextField("foo", "", Field.Store.NO);
             doc.Add(field);
@@ -72,16 +72,16 @@ namespace Lucene.Net.Search
             iw.Dispose();
 
             // no boosting
-            IndexSearcher searcher1 = NewSearcher(ir, false);
+            IndexSearcher searcher1 = NewSearcher(ir, false, Similarity);
             Similarity @base = searcher1.Similarity;
             // boosting
-            IndexSearcher searcher2 = NewSearcher(ir, false);
+            IndexSearcher searcher2 = NewSearcher(ir, false, Similarity);
             searcher2.Similarity = new PerFieldSimilarityWrapperAnonymousInnerClassHelper(this, field, @base);
 
             // in this case, we searched on field "foo". first document should have 2x the score.
             TermQuery tq = new TermQuery(new Term("foo", "quick"));
-            QueryUtils.Check(Random(), tq, searcher1);
-            QueryUtils.Check(Random(), tq, searcher2);
+            QueryUtils.Check(Random(), tq, searcher1, Similarity);
+            QueryUtils.Check(Random(), tq, searcher2, Similarity);
 
             TopDocs noboost = searcher1.Search(tq, 10);
             TopDocs boost = searcher2.Search(tq, 10);
@@ -93,8 +93,8 @@ namespace Lucene.Net.Search
 
             // this query matches only the second document, which should have 4x the score.
             tq = new TermQuery(new Term("foo", "jumps"));
-            QueryUtils.Check(Random(), tq, searcher1);
-            QueryUtils.Check(Random(), tq, searcher2);
+            QueryUtils.Check(Random(), tq, searcher1, Similarity);
+            QueryUtils.Check(Random(), tq, searcher2, Similarity);
 
             noboost = searcher1.Search(tq, 10);
             boost = searcher2.Search(tq, 10);
@@ -106,8 +106,8 @@ namespace Lucene.Net.Search
             // search on on field bar just for kicks, nothing should happen, since we setup
             // our sim provider to only use foo_boost for field foo.
             tq = new TermQuery(new Term("bar", "quick"));
-            QueryUtils.Check(Random(), tq, searcher1);
-            QueryUtils.Check(Random(), tq, searcher2);
+            QueryUtils.Check(Random(), tq, searcher1, Similarity);
+            QueryUtils.Check(Random(), tq, searcher2, Similarity);
 
             noboost = searcher1.Search(tq, 10);
             boost = searcher2.Search(tq, 10);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Search/TestEarlyTermination.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestEarlyTermination.cs b/src/Lucene.Net.Tests/core/Search/TestEarlyTermination.cs
index e59f004..7bf327b 100644
--- a/src/Lucene.Net.Tests/core/Search/TestEarlyTermination.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestEarlyTermination.cs
@@ -38,7 +38,7 @@ namespace Lucene.Net.Search
         {
             base.SetUp();
             Dir = NewDirectory();
-            Writer = new RandomIndexWriter(Random(), dir, ClassEnvRule.Similarity, ClassEnvRule.TimeZone);
+            Writer = new RandomIndexWriter(Random(), Dir, Similarity, TimeZone);
             int numDocs = AtLeast(100);
             for (int i = 0; i < numDocs; i++)
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Search/TestExplanations.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestExplanations.cs b/src/Lucene.Net.Tests/core/Search/TestExplanations.cs
index 4cd748d..50e6e70 100644
--- a/src/Lucene.Net.Tests/core/Search/TestExplanations.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestExplanations.cs
@@ -99,7 +99,7 @@ namespace Lucene.Net.Search
         /// check the expDocNrs first, then check the query (and the explanations) </summary>
         public virtual void Qtest(Query q, int[] expDocNrs)
         {
-            CheckHits.CheckHitCollector(Random(), q, FIELD, Searcher, expDocNrs);
+            CheckHits.CheckHitCollector(Random(), q, FIELD, Searcher, expDocNrs, Similarity);
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/c8e1eae6/src/Lucene.Net.Tests/core/Search/TestFieldCacheTermsFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestFieldCacheTermsFilter.cs b/src/Lucene.Net.Tests/core/Search/TestFieldCacheTermsFilter.cs
index c6a10b6..a7d231f 100644
--- a/src/Lucene.Net.Tests/core/Search/TestFieldCacheTermsFilter.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestFieldCacheTermsFilter.cs
@@ -41,7 +41,7 @@ namespace Lucene.Net.Search
         {
             string fieldName = "field1";
             Directory rd = NewDirectory();
-            RandomIndexWriter w = new RandomIndexWriter(Random(), rd);
+            RandomIndexWriter w = new RandomIndexWriter(Random(), rd, Similarity, TimeZone);
             for (int i = 0; i < 100; i++)
             {
                 Document doc = new Document();


Mime
View raw message