Class BaseTokenStreamTestCase
Base class for all Lucene unit tests that use TokenStreams.
When writing unit tests for analysis components, its highly recommended
to use the helper methods here (especially in conjunction with MockAnalyzer or
MockTokenizer), as they contain many assertions and checks to
catch bugs.
Inheritance
System.Object
BaseTokenStreamTestCase
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: Lucene.Net.TestFramework.dll
Syntax
public abstract class BaseTokenStreamTestCase : LuceneTestCase
Methods
|
Improve this Doc
View Source
AssertAnalyzesTo(Analyzer, String, String[])
Declaration
public static void AssertAnalyzesTo(Analyzer a, string input, string[] output)
Parameters
| Type |
Name |
Description |
| Analyzer |
a |
|
| System.String |
input |
|
| System.String[] |
output |
|
|
Improve this Doc
View Source
AssertAnalyzesTo(Analyzer, String, String[], Int32[])
Declaration
public static void AssertAnalyzesTo(Analyzer a, string input, string[] output, int[] posIncrements)
Parameters
| Type |
Name |
Description |
| Analyzer |
a |
|
| System.String |
input |
|
| System.String[] |
output |
|
| System.Int32[] |
posIncrements |
|
|
Improve this Doc
View Source
AssertAnalyzesTo(Analyzer, String, String[], Int32[], Int32[])
Declaration
public static void AssertAnalyzesTo(Analyzer a, string input, string[] output, int[] startOffsets, int[] endOffsets)
Parameters
| Type |
Name |
Description |
| Analyzer |
a |
|
| System.String |
input |
|
| System.String[] |
output |
|
| System.Int32[] |
startOffsets |
|
| System.Int32[] |
endOffsets |
|
|
Improve this Doc
View Source
AssertAnalyzesTo(Analyzer, String, String[], Int32[], Int32[], Int32[])
Declaration
public static void AssertAnalyzesTo(Analyzer a, string input, string[] output, int[] startOffsets, int[] endOffsets, int[] posIncrements)
Parameters
| Type |
Name |
Description |
| Analyzer |
a |
|
| System.String |
input |
|
| System.String[] |
output |
|
| System.Int32[] |
startOffsets |
|
| System.Int32[] |
endOffsets |
|
| System.Int32[] |
posIncrements |
|
|
Improve this Doc
View Source
AssertAnalyzesTo(Analyzer, String, String[], Int32[], Int32[], String[], Int32[])
Declaration
public static void AssertAnalyzesTo(Analyzer a, string input, string[] output, int[] startOffsets, int[] endOffsets, string[] types, int[] posIncrements)
Parameters
| Type |
Name |
Description |
| Analyzer |
a |
|
| System.String |
input |
|
| System.String[] |
output |
|
| System.Int32[] |
startOffsets |
|
| System.Int32[] |
endOffsets |
|
| System.String[] |
types |
|
| System.Int32[] |
posIncrements |
|
|
Improve this Doc
View Source
AssertAnalyzesTo(Analyzer, String, String[], Int32[], Int32[], String[], Int32[], Int32[])
Declaration
public static void AssertAnalyzesTo(Analyzer a, string input, string[] output, int[] startOffsets, int[] endOffsets, string[] types, int[] posIncrements, int[] posLengths)
Parameters
| Type |
Name |
Description |
| Analyzer |
a |
|
| System.String |
input |
|
| System.String[] |
output |
|
| System.Int32[] |
startOffsets |
|
| System.Int32[] |
endOffsets |
|
| System.String[] |
types |
|
| System.Int32[] |
posIncrements |
|
| System.Int32[] |
posLengths |
|
|
Improve this Doc
View Source
AssertAnalyzesTo(Analyzer, String, String[], Int32[], Int32[], String[], Int32[], Int32[], Boolean)
Declaration
public static void AssertAnalyzesTo(Analyzer a, string input, string[] output, int[] startOffsets, int[] endOffsets, string[] types, int[] posIncrements, int[] posLengths, bool offsetsAreCorrect)
Parameters
| Type |
Name |
Description |
| Analyzer |
a |
|
| System.String |
input |
|
| System.String[] |
output |
|
| System.Int32[] |
startOffsets |
|
| System.Int32[] |
endOffsets |
|
| System.String[] |
types |
|
| System.Int32[] |
posIncrements |
|
| System.Int32[] |
posLengths |
|
| System.Boolean |
offsetsAreCorrect |
|
|
Improve this Doc
View Source
AssertAnalyzesTo(Analyzer, String, String[], Int32[], Int32[], String[], Int32[], Int32[], Boolean, Byte[][])
Declaration
public static void AssertAnalyzesTo(Analyzer a, string input, string[] output, int[] startOffsets, int[] endOffsets, string[] types, int[] posIncrements, int[] posLengths, bool graphOffsetsAreCorrect, byte[][] payloads)
Parameters
| Type |
Name |
Description |
| Analyzer |
a |
|
| System.String |
input |
|
| System.String[] |
output |
|
| System.Int32[] |
startOffsets |
|
| System.Int32[] |
endOffsets |
|
| System.String[] |
types |
|
| System.Int32[] |
posIncrements |
|
| System.Int32[] |
posLengths |
|
| System.Boolean |
graphOffsetsAreCorrect |
|
| System.Byte[][] |
payloads |
|
|
Improve this Doc
View Source
AssertAnalyzesTo(Analyzer, String, String[], String[])
Declaration
public static void AssertAnalyzesTo(Analyzer a, string input, string[] output, string[] types)
Parameters
| Type |
Name |
Description |
| Analyzer |
a |
|
| System.String |
input |
|
| System.String[] |
output |
|
| System.String[] |
types |
|
|
Improve this Doc
View Source
AssertAnalyzesToPositions(Analyzer, String, String[], Int32[], Int32[])
Declaration
public static void AssertAnalyzesToPositions(Analyzer a, string input, string[] output, int[] posIncrements, int[] posLengths)
Parameters
| Type |
Name |
Description |
| Analyzer |
a |
|
| System.String |
input |
|
| System.String[] |
output |
|
| System.Int32[] |
posIncrements |
|
| System.Int32[] |
posLengths |
|
|
Improve this Doc
View Source
AssertTokenStreamContents(TokenStream, String[])
Declaration
public static void AssertTokenStreamContents(TokenStream ts, string[] output)
Parameters
| Type |
Name |
Description |
| TokenStream |
ts |
|
| System.String[] |
output |
|
|
Improve this Doc
View Source
AssertTokenStreamContents(TokenStream, String[], Int32[])
Declaration
public static void AssertTokenStreamContents(TokenStream ts, string[] output, int[] posIncrements)
Parameters
| Type |
Name |
Description |
| TokenStream |
ts |
|
| System.String[] |
output |
|
| System.Int32[] |
posIncrements |
|
|
Improve this Doc
View Source
AssertTokenStreamContents(TokenStream, String[], Int32[], Int32[])
Declaration
public static void AssertTokenStreamContents(TokenStream ts, string[] output, int[] startOffsets, int[] endOffsets)
Parameters
| Type |
Name |
Description |
| TokenStream |
ts |
|
| System.String[] |
output |
|
| System.Int32[] |
startOffsets |
|
| System.Int32[] |
endOffsets |
|
|
Improve this Doc
View Source
AssertTokenStreamContents(TokenStream, String[], Int32[], Int32[], Int32[])
Declaration
public static void AssertTokenStreamContents(TokenStream ts, string[] output, int[] startOffsets, int[] endOffsets, int[] posIncrements)
Parameters
| Type |
Name |
Description |
| TokenStream |
ts |
|
| System.String[] |
output |
|
| System.Int32[] |
startOffsets |
|
| System.Int32[] |
endOffsets |
|
| System.Int32[] |
posIncrements |
|
|
Improve this Doc
View Source
AssertTokenStreamContents(TokenStream, String[], Int32[], Int32[], Int32[], Int32[], Nullable<Int32>)
Declaration
public static void AssertTokenStreamContents(TokenStream ts, string[] output, int[] startOffsets, int[] endOffsets, int[] posIncrements, int[] posLengths, int? finalOffset)
Parameters
| Type |
Name |
Description |
| TokenStream |
ts |
|
| System.String[] |
output |
|
| System.Int32[] |
startOffsets |
|
| System.Int32[] |
endOffsets |
|
| System.Int32[] |
posIncrements |
|
| System.Int32[] |
posLengths |
|
| System.Nullable<System.Int32> |
finalOffset |
|
|
Improve this Doc
View Source
AssertTokenStreamContents(TokenStream, String[], Int32[], Int32[], Int32[], Nullable<Int32>)
Declaration
public static void AssertTokenStreamContents(TokenStream ts, string[] output, int[] startOffsets, int[] endOffsets, int[] posIncrements, int? finalOffset)
Parameters
| Type |
Name |
Description |
| TokenStream |
ts |
|
| System.String[] |
output |
|
| System.Int32[] |
startOffsets |
|
| System.Int32[] |
endOffsets |
|
| System.Int32[] |
posIncrements |
|
| System.Nullable<System.Int32> |
finalOffset |
|
|
Improve this Doc
View Source
AssertTokenStreamContents(TokenStream, String[], Int32[], Int32[], Nullable<Int32>)
Declaration
public static void AssertTokenStreamContents(TokenStream ts, string[] output, int[] startOffsets, int[] endOffsets, int? finalOffset)
Parameters
| Type |
Name |
Description |
| TokenStream |
ts |
|
| System.String[] |
output |
|
| System.Int32[] |
startOffsets |
|
| System.Int32[] |
endOffsets |
|
| System.Nullable<System.Int32> |
finalOffset |
|
|
Improve this Doc
View Source
AssertTokenStreamContents(TokenStream, String[], Int32[], Int32[], String[], Int32[])
Declaration
public static void AssertTokenStreamContents(TokenStream ts, string[] output, int[] startOffsets, int[] endOffsets, string[] types, int[] posIncrements)
Parameters
| Type |
Name |
Description |
| TokenStream |
ts |
|
| System.String[] |
output |
|
| System.Int32[] |
startOffsets |
|
| System.Int32[] |
endOffsets |
|
| System.String[] |
types |
|
| System.Int32[] |
posIncrements |
|
|
Improve this Doc
View Source
AssertTokenStreamContents(TokenStream, String[], Int32[], Int32[], String[], Int32[], Int32[], Nullable<Int32>)
Declaration
public static void AssertTokenStreamContents(TokenStream ts, string[] output, int[] startOffsets, int[] endOffsets, string[] types, int[] posIncrements, int[] posLengths, int? finalOffset)
Parameters
| Type |
Name |
Description |
| TokenStream |
ts |
|
| System.String[] |
output |
|
| System.Int32[] |
startOffsets |
|
| System.Int32[] |
endOffsets |
|
| System.String[] |
types |
|
| System.Int32[] |
posIncrements |
|
| System.Int32[] |
posLengths |
|
| System.Nullable<System.Int32> |
finalOffset |
|
|
Improve this Doc
View Source
AssertTokenStreamContents(TokenStream, String[], Int32[], Int32[], String[], Int32[], Int32[], Nullable<Int32>, Boolean)
Declaration
public static void AssertTokenStreamContents(TokenStream ts, string[] output, int[] startOffsets, int[] endOffsets, string[] types, int[] posIncrements, int[] posLengths, int? finalOffset, bool offsetsAreCorrect)
Parameters
| Type |
Name |
Description |
| TokenStream |
ts |
|
| System.String[] |
output |
|
| System.Int32[] |
startOffsets |
|
| System.Int32[] |
endOffsets |
|
| System.String[] |
types |
|
| System.Int32[] |
posIncrements |
|
| System.Int32[] |
posLengths |
|
| System.Nullable<System.Int32> |
finalOffset |
|
| System.Boolean |
offsetsAreCorrect |
|
|
Improve this Doc
View Source
AssertTokenStreamContents(TokenStream, String[], Int32[], Int32[], String[], Int32[], Int32[], Nullable<Int32>, Boolean[], Boolean)
Declaration
public static void AssertTokenStreamContents(TokenStream ts, string[] output, int[] startOffsets, int[] endOffsets, string[] types, int[] posIncrements, int[] posLengths, int? finalOffset, bool[] keywordAtts, bool offsetsAreCorrect)
Parameters
| Type |
Name |
Description |
| TokenStream |
ts |
|
| System.String[] |
output |
|
| System.Int32[] |
startOffsets |
|
| System.Int32[] |
endOffsets |
|
| System.String[] |
types |
|
| System.Int32[] |
posIncrements |
|
| System.Int32[] |
posLengths |
|
| System.Nullable<System.Int32> |
finalOffset |
|
| System.Boolean[] |
keywordAtts |
|
| System.Boolean |
offsetsAreCorrect |
|
|
Improve this Doc
View Source
AssertTokenStreamContents(TokenStream, String[], Int32[], Int32[], String[], Int32[], Int32[], Nullable<Int32>, Nullable<Int32>, Boolean[], Boolean, Byte[][])
Declaration
public static void AssertTokenStreamContents(TokenStream ts, string[] output, int[] startOffsets, int[] endOffsets, string[] types, int[] posIncrements, int[] posLengths, int? finalOffset, int? finalPosInc, bool[] keywordAtts, bool offsetsAreCorrect, byte[][] payloads)
Parameters
| Type |
Name |
Description |
| TokenStream |
ts |
|
| System.String[] |
output |
|
| System.Int32[] |
startOffsets |
|
| System.Int32[] |
endOffsets |
|
| System.String[] |
types |
|
| System.Int32[] |
posIncrements |
|
| System.Int32[] |
posLengths |
|
| System.Nullable<System.Int32> |
finalOffset |
|
| System.Nullable<System.Int32> |
finalPosInc |
|
| System.Boolean[] |
keywordAtts |
|
| System.Boolean |
offsetsAreCorrect |
|
| System.Byte[][] |
payloads |
|
|
Improve this Doc
View Source
AssertTokenStreamContents(TokenStream, String[], Int32[], Int32[], String[], Int32[], Nullable<Int32>)
Declaration
public static void AssertTokenStreamContents(TokenStream ts, string[] output, int[] startOffsets, int[] endOffsets, string[] types, int[] posIncrements, int? finalOffset)
Parameters
| Type |
Name |
Description |
| TokenStream |
ts |
|
| System.String[] |
output |
|
| System.Int32[] |
startOffsets |
|
| System.Int32[] |
endOffsets |
|
| System.String[] |
types |
|
| System.Int32[] |
posIncrements |
|
| System.Nullable<System.Int32> |
finalOffset |
|
|
Improve this Doc
View Source
AssertTokenStreamContents(TokenStream, String[], String[])
Declaration
public static void AssertTokenStreamContents(TokenStream ts, string[] output, string[] types)
Parameters
| Type |
Name |
Description |
| TokenStream |
ts |
|
| System.String[] |
output |
|
| System.String[] |
types |
|
|
Improve this Doc
View Source
CheckAnalysisConsistency(Random, Analyzer, Boolean, String)
Declaration
public static void CheckAnalysisConsistency(Random random, Analyzer a, bool useCharFilter, string text)
Parameters
| Type |
Name |
Description |
| System.Random |
random |
|
| Analyzer |
a |
|
| System.Boolean |
useCharFilter |
|
| System.String |
text |
|
|
Improve this Doc
View Source
CheckAnalysisConsistency(Random, Analyzer, Boolean, String, Boolean)
Declaration
public static void CheckAnalysisConsistency(Random random, Analyzer a, bool useCharFilter, string text, bool offsetsAreCorrect)
Parameters
| Type |
Name |
Description |
| System.Random |
random |
|
| Analyzer |
a |
|
| System.Boolean |
useCharFilter |
|
| System.String |
text |
|
| System.Boolean |
offsetsAreCorrect |
|
|
Improve this Doc
View Source
CheckOneTerm(Analyzer, String, String)
Simple utility method for testing stemmers
Declaration
public static void CheckOneTerm(Analyzer a, string input, string expected)
Parameters
| Type |
Name |
Description |
| Analyzer |
a |
|
| System.String |
input |
|
| System.String |
expected |
|
|
Improve this Doc
View Source
CheckRandomData(Random, Analyzer, Int32)
Utility method for blasting tokenstreams with data to make sure they don't do anything crazy
Declaration
public static void CheckRandomData(Random random, Analyzer a, int iterations)
Parameters
| Type |
Name |
Description |
| System.Random |
random |
|
| Analyzer |
a |
|
| System.Int32 |
iterations |
|
|
Improve this Doc
View Source
CheckRandomData(Random, Analyzer, Int32, Boolean)
Utility method for blasting tokenstreams with data to make sure they don't do anything crazy
Declaration
public static void CheckRandomData(Random random, Analyzer a, int iterations, bool simple)
Parameters
| Type |
Name |
Description |
| System.Random |
random |
|
| Analyzer |
a |
|
| System.Int32 |
iterations |
|
| System.Boolean |
simple |
true if only ascii strings will be used (try to avoid)
|
|
Improve this Doc
View Source
CheckRandomData(Random, Analyzer, Int32, Int32)
Utility method for blasting tokenstreams with data to make sure they don't do anything crazy
Declaration
public static void CheckRandomData(Random random, Analyzer a, int iterations, int maxWordLength)
Parameters
| Type |
Name |
Description |
| System.Random |
random |
|
| Analyzer |
a |
|
| System.Int32 |
iterations |
|
| System.Int32 |
maxWordLength |
|
|
Improve this Doc
View Source
CheckRandomData(Random, Analyzer, Int32, Int32, Boolean)
Declaration
public static void CheckRandomData(Random random, Analyzer a, int iterations, int maxWordLength, bool simple)
Parameters
| Type |
Name |
Description |
| System.Random |
random |
|
| Analyzer |
a |
|
| System.Int32 |
iterations |
|
| System.Int32 |
maxWordLength |
|
| System.Boolean |
simple |
|
|
Improve this Doc
View Source
CheckRandomData(Random, Analyzer, Int32, Int32, Boolean, Boolean)
Declaration
public static void CheckRandomData(Random random, Analyzer a, int iterations, int maxWordLength, bool simple, bool offsetsAreCorrect)
Parameters
| Type |
Name |
Description |
| System.Random |
random |
|
| Analyzer |
a |
|
| System.Int32 |
iterations |
|
| System.Int32 |
maxWordLength |
|
| System.Boolean |
simple |
|
| System.Boolean |
offsetsAreCorrect |
|
|
Improve this Doc
View Source
Escape(String)
Declaration
public static string Escape(string s)
Parameters
| Type |
Name |
Description |
| System.String |
s |
|
Returns
| Type |
Description |
| System.String |
|
|
Improve this Doc
View Source
NewAttributeFactory()
Declaration
public static AttributeSource.AttributeFactory NewAttributeFactory()
Returns
|
Improve this Doc
View Source
NewAttributeFactory(Random)
Declaration
public static AttributeSource.AttributeFactory NewAttributeFactory(Random random)
Parameters
| Type |
Name |
Description |
| System.Random |
random |
|
Returns
|
Improve this Doc
View Source
ToDot(Analyzer, String)
Declaration
protected virtual string ToDot(Analyzer a, string inputText)
Parameters
| Type |
Name |
Description |
| Analyzer |
a |
|
| System.String |
inputText |
|
Returns
| Type |
Description |
| System.String |
|
|
Improve this Doc
View Source
ToDotFile(Analyzer, String, String)
Declaration
protected virtual void ToDotFile(Analyzer a, string inputText, string localFileName)
Parameters
| Type |
Name |
Description |
| Analyzer |
a |
|
| System.String |
inputText |
|
| System.String |
localFileName |
|
See Also