Skip to content

Commit

Permalink
Adding LUCENENET specific comments to APIs that changed
Browse files Browse the repository at this point in the history
  • Loading branch information
conniey committed Aug 8, 2016
1 parent 22caeb0 commit 13fadeb
Show file tree
Hide file tree
Showing 59 changed files with 440 additions and 43 deletions.
28 changes: 24 additions & 4 deletions src/Lucene.Net.TestFramework/Analysis/BaseTokenStreamTestCase.cs
Expand Up @@ -528,22 +528,37 @@ public static void CheckOneTerm(Analyzer a, string input, string expected)
}

/// <summary>
/// utility method for blasting tokenstreams with data to make sure they don't do anything crazy </summary>
/// utility method for blasting tokenstreams with data to make sure they don't do anything crazy
///
/// LUCENENET specific
/// Non-static to reduce the inter-class dependencies due to use of
/// static variables
/// </summary>
public void CheckRandomData(Random random, Analyzer a, int iterations)
{
CheckRandomData(random, a, iterations, 20, false, true);
}

/// <summary>
/// utility method for blasting tokenstreams with data to make sure they don't do anything crazy </summary>
/// utility method for blasting tokenstreams with data to make sure they don't do anything crazy
///
/// LUCENENET specific
/// Non-static to reduce the inter-class dependencies due to use of
/// static variables
/// </summary>
public void CheckRandomData(Random random, Analyzer a, int iterations, int maxWordLength)
{
CheckRandomData(random, a, iterations, maxWordLength, false, true);
}

/// <summary>
/// utility method for blasting tokenstreams with data to make sure they don't do anything crazy </summary>
/// <param name="simple"> true if only ascii strings will be used (try to avoid) </param>
/// utility method for blasting tokenstreams with data to make sure they don't do anything crazy
///
/// LUCENENET specific
/// Non-static to reduce the inter-class dependencies due to use of
/// static variables
/// </summary>
/// <param name="simple"> true if only ascii strings will be used (try to avoid)</param>
public void CheckRandomData(Random random, Analyzer a, int iterations, bool simple)
{
CheckRandomData(random, a, iterations, 20, simple, true);
Expand All @@ -567,6 +582,11 @@ internal class AnalysisThread : ThreadClass
// interact)... so this is just "best effort":
public bool Failed;

/// <summary>
/// <param name="outerInstance">
/// LUCENENET specific
/// Added to remove a call to the then-static BaseTokenStreamTestCase methods</param>
/// </summary>
internal AnalysisThread(long seed, /*CountdownEvent latch,*/ Analyzer a, int iterations, int maxWordLength,
bool useCharFilter, bool simple, bool offsetsAreCorrect, RandomIndexWriter iw, BaseTokenStreamTestCase outerInstance)
{
Expand Down
Expand Up @@ -33,6 +33,12 @@ public class PreFlexRWCodec : Lucene3xCodec
private readonly StoredFieldsFormat StoredFields = new PreFlexRWStoredFieldsFormat();
private readonly bool _oldFormatImpersonationIsActive;

/// <summary>
/// </summary>
/// <param name="oldFormatImpersonationIsActive">
/// LUCENENET specific
/// Added to remove dependency on then-static <see cref="LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE"/>
/// </param>
public PreFlexRWCodec(bool oldFormatImpersonationIsActive) : base()
{
_oldFormatImpersonationIsActive = oldFormatImpersonationIsActive;
Expand Down
10 changes: 9 additions & 1 deletion src/Lucene.Net.TestFramework/Codecs/lucene40/Lucene40RWCodec.cs
Expand Up @@ -24,7 +24,11 @@ namespace Lucene.Net.Codecs.Lucene40
public sealed class Lucene40RWCodec : Lucene40Codec
{
private readonly FieldInfosFormat fieldInfos;


/// <param name="oldFormatImpersonationIsActive">
/// LUCENENET specific
/// Added to remove dependency on then-static <see cref="LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE"/>
/// </param>
public Lucene40RWCodec(bool oldFormatImpersonationIsActive) : base()
{
fieldInfos = new Lucene40FieldInfosFormatAnonymousInnerClassHelper(oldFormatImpersonationIsActive);
Expand All @@ -36,6 +40,10 @@ private class Lucene40FieldInfosFormatAnonymousInnerClassHelper : Lucene40FieldI
{
private readonly bool _oldFormatImpersonationIsActive;

/// <param name="oldFormatImpersonationIsActive">
/// LUCENENET specific
/// Added to remove dependency on then-static <see cref="LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE"/>
/// </param>
public Lucene40FieldInfosFormatAnonymousInnerClassHelper(bool oldFormatImpersonationIsActive) : base()
{
_oldFormatImpersonationIsActive = oldFormatImpersonationIsActive;
Expand Down
Expand Up @@ -27,6 +27,10 @@ public class Lucene40RWDocValuesFormat : Lucene40DocValuesFormat
{
private readonly bool _oldFormatImpersonationIsActive;

/// <param name="oldFormatImpersonationIsActive">
/// LUCENENET specific
/// Added to remove dependency on then-static <see cref="LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE"/>
/// </param>
public Lucene40RWDocValuesFormat(bool oldFormatImpersonationIsActive) : base()
{
_oldFormatImpersonationIsActive = oldFormatImpersonationIsActive;
Expand Down
Expand Up @@ -27,6 +27,10 @@ public class Lucene40RWNormsFormat : Lucene40NormsFormat
{
private readonly bool _oldFormatImpersonationIsActive;

/// <param name="oldFormatImpersonationIsActive">
/// LUCENENET specific
/// Added to remove dependency on then-static <see cref="LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE"/>
/// </param>
public Lucene40RWNormsFormat(bool oldFormatImpersonationIsActive) : base()
{
_oldFormatImpersonationIsActive = oldFormatImpersonationIsActive;
Expand Down
Expand Up @@ -27,6 +27,10 @@ public class Lucene40RWPostingsFormat : Lucene40PostingsFormat
{
private readonly bool _oldFormatImpersonationIsActive;

/// <param name="oldFormatImpersonationIsActive">
/// LUCENENET specific
/// Added to remove dependency on then-static <see cref="LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE"/>
/// </param>
public Lucene40RWPostingsFormat(bool oldFormatImpersonationIsActive) : base()
{
_oldFormatImpersonationIsActive = oldFormatImpersonationIsActive;
Expand Down
Expand Up @@ -34,6 +34,10 @@ public class Lucene41RWCodec : Lucene41Codec
private readonly NormsFormat Norms;
private readonly bool _oldFormatImpersonationIsActive;

/// <param name="oldFormatImpersonationIsActive">
/// LUCENENET specific
/// Added to remove dependency on then-static <see cref="LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE"/>
/// </param>
public Lucene41RWCodec(bool oldFormatImpersonationIsActive) : base()
{
_oldFormatImpersonationIsActive = oldFormatImpersonationIsActive;
Expand All @@ -47,6 +51,10 @@ private class Lucene40FieldInfosFormatAnonymousInnerClassHelper : Lucene40FieldI
{
private readonly bool _oldFormatImpersonationIsActive;

/// <param name="oldFormatImpersonationIsActive">
/// LUCENENET specific
/// Added to remove dependency on then-static <see cref="LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE"/>
/// </param>
public Lucene40FieldInfosFormatAnonymousInnerClassHelper(bool oldFormatImpersonationIsActive) : base()
{
_oldFormatImpersonationIsActive = oldFormatImpersonationIsActive;
Expand Down
Expand Up @@ -28,6 +28,10 @@ public class Lucene42RWCodec : Lucene42Codec
private readonly NormsFormat Norms = new Lucene42NormsFormat();
private readonly FieldInfosFormat fieldInfosFormat;

/// <param name="oldFormatImpersonationIsActive">
/// LUCENENET specific
/// Added to remove dependency on then-static <see cref="LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE"/>
/// </param>
public Lucene42RWCodec(bool oldFormatImpersonationIsActive) : base()
{
Dv = new Lucene42RWDocValuesFormat(oldFormatImpersonationIsActive);
Expand All @@ -38,6 +42,10 @@ private class Lucene42FieldInfosFormatAnonymousInnerClassHelper : Lucene42FieldI
{
private readonly bool _oldFormatImpersonationIsActive;

/// <param name="oldFormatImpersonationIsActive">
/// LUCENENET specific
/// Added to remove dependency on then-static <see cref="LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE"/>
/// </param>
public Lucene42FieldInfosFormatAnonymousInnerClassHelper(bool oldFormatImpersonationIsActive) : base()
{
_oldFormatImpersonationIsActive = oldFormatImpersonationIsActive;
Expand Down
Expand Up @@ -28,6 +28,10 @@ public class Lucene42RWDocValuesFormat : Lucene42DocValuesFormat
{
private readonly bool _oldFormatImpersonationIsActive;

/// <param name="oldFormatImpersonationIsActive">
/// LUCENENET specific
/// Added to remove dependency on then-static <see cref="LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE"/>
/// </param>
public Lucene42RWDocValuesFormat(bool oldFormatImpersonationIsActive) : base()
{
_oldFormatImpersonationIsActive = oldFormatImpersonationIsActive;
Expand Down
Expand Up @@ -28,6 +28,10 @@ public class Lucene45RWCodec : Lucene45Codec
{
private readonly FieldInfosFormat fieldInfosFormat;

/// <param name="oldFormatImpersonationIsActive">
/// LUCENENET specific
/// Added to remove dependency on then-static <see cref="LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE"/>
/// </param>
public Lucene45RWCodec(bool oldFormatImpersonationIsActive) : base()
{
fieldInfosFormat = new Lucene42FieldInfosFormatAnonymousInnerClassHelper(oldFormatImpersonationIsActive);
Expand All @@ -37,6 +41,10 @@ private class Lucene42FieldInfosFormatAnonymousInnerClassHelper : Lucene42FieldI
{
private readonly bool _oldFormatImpersonationIsActive;

/// <param name="oldFormatImpersonationIsActive">
/// LUCENENET specific
/// Added to remove dependency on then-static <see cref="LuceneTestCase.OLD_FORMAT_IMPERSONATION_IS_ACTIVE"/>
/// </param>
public Lucene42FieldInfosFormatAnonymousInnerClassHelper(bool oldFormatImpersonationIsActive) : base()
{
_oldFormatImpersonationIsActive = oldFormatImpersonationIsActive;
Expand Down
27 changes: 21 additions & 6 deletions src/Lucene.Net.TestFramework/Index/RandomIndexWriter.cs
Expand Up @@ -85,26 +85,41 @@ public static IndexWriter MockIndexWriter(Directory dir, IndexWriterConfig conf,
}

/// <summary>
/// create a RandomIndexWriter with a random config: Uses TEST_VERSION_CURRENT and MockAnalyzer </summary>
/// create a RandomIndexWriter with a random config: Uses TEST_VERSION_CURRENT and MockAnalyzer
///
/// LUCENENET specific
/// Similarity and TimeZone parameters allow a RandomIndexWriter to be
/// created without adding a dependency on
/// <see cref="LuceneTestCase.ClassEnv.Similarity"/> and
/// <see cref="LuceneTestCase.ClassEnv.TimeZone"/>
/// </summary>
public RandomIndexWriter(Random r, Directory dir, Similarity similarity, TimeZone timezone)
: this(r, dir, LuceneTestCase.NewIndexWriterConfig(r, LuceneTestCase.TEST_VERSION_CURRENT, new MockAnalyzer(r), similarity, timezone))
{
}

/// <summary>
/// create a RandomIndexWriter with a random config: Uses TEST_VERSION_CURRENT </summary>
/// create a RandomIndexWriter with a random config: Uses TEST_VERSION_CURRENT
///
/// LUCENENET specific
/// Similarity and TimeZone parameters allow a RandomIndexWriter to be
/// created without adding a dependency on
/// <see cref="LuceneTestCase.ClassEnv.Similarity"/> and
/// <see cref="LuceneTestCase.ClassEnv.TimeZone"/>
/// </summary>
public RandomIndexWriter(Random r, Directory dir, Analyzer a, Similarity similarity, TimeZone timezone)
: this(r, dir, LuceneTestCase.NewIndexWriterConfig(r, LuceneTestCase.TEST_VERSION_CURRENT, a, similarity, timezone))
{
}

/// <summary>
/// Creates a RandomIndexWriter with a random config
///
///
/// LUCENENET specific
/// This override allows a RandomIndexWriter to be created without
/// adding a dependency on the LuceneTestCase.ClassEnv.Similarity and
/// LuceneTestCase.ClassEnv.TimeZone property
/// Similarity and TimeZone parameters allow a RandomIndexWriter to be
/// created without adding a dependency on
/// <see cref="LuceneTestCase.ClassEnv.Similarity"/> and
/// <see cref="LuceneTestCase.ClassEnv.TimeZone"/>
/// </summary>
public RandomIndexWriter(Random r, Directory dir, LuceneVersion v, Analyzer a, Similarity similarity, TimeZone timezone)
: this(r, dir, LuceneTestCase.NewIndexWriterConfig(r, v, a, similarity, timezone))
Expand Down
10 changes: 9 additions & 1 deletion src/Lucene.Net.TestFramework/Search/CheckHits.cs
Expand Up @@ -91,7 +91,11 @@ public static void CheckNoMatchExplanations(Query q, string defaultFieldName, In
/// <param name="searcher"> the searcher to test the query against </param>
/// <param name="defaultFieldName"> used for displaying the query in assertion messages </param>
/// <param name="results"> a list of documentIds that must match the query </param>
/// <seealso cref= #checkHits </seealso>
/// <param name="similarity">
/// LUCENENET specific
/// Removes dependency on <see cref="LuceneTestCase.ClassEnv.Similarity"/>
/// </param>
/// <seealso cref=#checkHits </seealso>
public static void CheckHitCollector(Random random, Query query, string defaultFieldName, IndexSearcher searcher, int[] results, Similarity similarity)
{
QueryUtils.Check(random, query, searcher, similarity);
Expand Down Expand Up @@ -170,6 +174,10 @@ public override bool AcceptsDocsOutOfOrder()
/// <param name="searcher"> the searcher to test the query against </param>
/// <param name="defaultFieldName"> used for displaing the query in assertion messages </param>
/// <param name="results"> a list of documentIds that must match the query </param>
/// <param name="similarity">
/// LUCENENET specific
/// Removes dependency on <see cref="LuceneTestCase.ClassEnv.Similarity"/>
/// </param>
/// <seealso cref= #checkHitCollector </seealso>
public static void DoCheckHits(Random random, Query query, string defaultFieldName, IndexSearcher searcher, int[] results, Similarity similarity)
{
Expand Down
22 changes: 21 additions & 1 deletion src/Lucene.Net.TestFramework/Search/QueryUtils.cs
Expand Up @@ -118,6 +118,10 @@ public static void CheckExplanations(Query q, IndexSearcher s)
/// Various query sanity checks on a searcher, some checks are only done for
/// instanceof IndexSearcher.
/// </summary>
/// <param name = "similarity" >
/// LUCENENET specific
/// Removes dependency on <see cref="LuceneTestCase.ClassEnv.Similarity"/>
/// </param>
/// <seealso cref= #check(Query) </seealso>
/// <seealso cref= #checkFirstSkipTo </seealso>
/// <seealso cref= #checkSkipTo </seealso>
Expand All @@ -128,6 +132,10 @@ public static void Check(Random random, Query q1, IndexSearcher s, Similarity si
Check(random, q1, s, true, similarity);
}

/// <param name = "similarity" >
/// LUCENENET specific
/// Removes dependency on <see cref="LuceneTestCase.ClassEnv.Similarity"/>
/// </param>
public static void Check(Random random, Query q1, IndexSearcher s, bool wrap, Similarity similarity)
{
try
Expand Down Expand Up @@ -200,6 +208,10 @@ public override object CombinedCoreAndDeletesKey
/// behave exactly the same as the original IndexSearcher. </summary>
/// <param name="s"> the searcher to wrap </param>
/// <param name="edge"> if negative, s will be the first sub; if 0, s will be in the middle, if positive s will be the last sub </param>
/// <param name="similarity">
/// LUCENENET specific
/// Removes dependency on <see cref="LuceneTestCase.ClassEnv.Similarity"/>
/// </param>
public static IndexSearcher WrapUnderlyingReader(Random random, IndexSearcher s, int edge, Similarity similarity)
{
IndexReader r = s.IndexReader;
Expand Down Expand Up @@ -251,6 +263,10 @@ private static IndexReader MakeEmptyIndex(Random random, int numDocs)
/// alternate scorer skipTo(),skipTo(),next(),next(),skipTo(),skipTo(), etc
/// and ensure a hitcollector receives same docs and scores
/// </summary>
/// <param name = "similarity" >
/// LUCENENET specific
/// Removes dependency on <see cref="LuceneTestCase.ClassEnv.Similarity"/>
/// </param>
public static void CheckSkipTo(Query q, IndexSearcher s, Similarity similarity)
{
//System.out.println("Checking "+q);
Expand Down Expand Up @@ -412,7 +428,11 @@ public override bool AcceptsDocsOutOfOrder()
}

/// <summary>
/// check that first skip on just created scorers always goes to the right doc </summary>
/// check that first skip on just created scorers always goes to the right doc</summary>
/// <param name = "similarity" >
/// LUCENENET specific
/// Removes dependency on <see cref="LuceneTestCase.ClassEnv.Similarity"/>
/// </param>
public static void CheckFirstSkipTo(Query q, IndexSearcher s, Similarity similarity)
{
//System.out.println("checkFirstSkipTo: "+q);
Expand Down
Expand Up @@ -57,6 +57,10 @@ public abstract class SearchEquivalenceTestBase : LuceneTestCase
protected internal static Analyzer Analyzer;
protected internal static string Stopword; // we always pick a character as a stopword

/// <summary>
/// LUCENENET specific
/// Is non-static because ClassEnvRule is no longer static.
/// </summary>
[SetUp]
public void BeforeClass()
{
Expand Down

0 comments on commit 13fadeb

Please sign in to comment.