Show / Hide Table of Contents

    Class BaseTokenStreamTestCase

    Base class for all Lucene unit tests that use s.

    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
    LuceneTestCase
    BaseTokenStreamTestCase
    Inherited Members
    LuceneTestCase.TEST_VERSION_CURRENT
    LuceneTestCase.VERBOSE
    LuceneTestCase.INFOSTREAM
    LuceneTestCase.RANDOM_MULTIPLIER
    LuceneTestCase.DEFAULT_LINE_DOCS_FILE
    LuceneTestCase.JENKINS_LARGE_LINE_DOCS_FILE
    LuceneTestCase.TEST_CODEC
    LuceneTestCase.TEST_POSTINGSFORMAT
    LuceneTestCase.TEST_DOCVALUESFORMAT
    LuceneTestCase.TEST_DIRECTORY
    LuceneTestCase.TEST_LINE_DOCS_FILE
    LuceneTestCase.LEAVE_TEMPORARY
    LuceneTestCase.DoesntSupportOffsets
    LuceneTestCase.OldFormatImpersonationIsActive
    LuceneTestCase.SuiteFailureMarker
    LuceneTestCase.SetUp()
    LuceneTestCase.TearDown()
    LuceneTestCase.CodecFactory
    LuceneTestCase.DocValuesFormatFactory
    LuceneTestCase.PostingsFormatFactory
    LuceneTestCase.BeforeClass()
    LuceneTestCase.AfterClass()
    LuceneTestCase.Random
    LuceneTestCase.GetTestClass()
    LuceneTestCase.TestName
    LuceneTestCase.GetOnlySegmentReader(DirectoryReader)
    LuceneTestCase.AssertSaneFieldCaches(String)
    LuceneTestCase.AtLeast(Random, Int32)
    LuceneTestCase.AtLeast(Int32)
    LuceneTestCase.Rarely(Random)
    LuceneTestCase.Rarely()
    LuceneTestCase.Usually(Random)
    LuceneTestCase.Usually()
    LuceneTestCase.AssumeTrue(String, Boolean)
    LuceneTestCase.AssumeFalse(String, Boolean)
    LuceneTestCase.AssumeNoException(String, Exception)
    LuceneTestCase.AsSet(Object[])
    LuceneTestCase.DumpEnumerator(String, IEnumerator, TextWriter)
    LuceneTestCase.DumpArray(String, Object[], TextWriter)
    LuceneTestCase.NewIndexWriterConfig(LuceneVersion, Analyzer)
    LuceneTestCase.NewIndexWriterConfig(Random, LuceneVersion, Analyzer)
    LuceneTestCase.NewMergePolicy(Random)
    LuceneTestCase.NewMergePolicy()
    LuceneTestCase.NewLogMergePolicy()
    LuceneTestCase.NewTieredMergePolicy()
    LuceneTestCase.NewAlcoholicMergePolicy()
    LuceneTestCase.NewAlcoholicMergePolicy(Random, TimeZoneInfo)
    LuceneTestCase.NewLogMergePolicy(Random)
    LuceneTestCase.NewTieredMergePolicy(Random)
    LuceneTestCase.NewLogMergePolicy(Boolean)
    LuceneTestCase.NewLogMergePolicy(Boolean, Int32)
    LuceneTestCase.NewLogMergePolicy(Int32)
    LuceneTestCase.NewDirectory()
    LuceneTestCase.NewDirectory(Random)
    LuceneTestCase.NewMockDirectory()
    LuceneTestCase.NewMockDirectory(Random)
    LuceneTestCase.NewMockFSDirectory(DirectoryInfo)
    LuceneTestCase.NewDirectory(Directory)
    LuceneTestCase.NewFSDirectory(DirectoryInfo)
    LuceneTestCase.NewFSDirectory(DirectoryInfo, LockFactory)
    LuceneTestCase.NewDirectory(Random, Directory)
    LuceneTestCase.NewStringField(String, String, Field.Store)
    LuceneTestCase.NewTextField(String, String, Field.Store)
    LuceneTestCase.NewStringField(Random, String, String, Field.Store)
    LuceneTestCase.NewTextField(Random, String, String, Field.Store)
    LuceneTestCase.NewField(String, String, FieldType)
    LuceneTestCase.NewField(Random, String, String, FieldType)
    LuceneTestCase.RandomCulture(Random)
    LuceneTestCase.RandomTimeZone(Random)
    LuceneTestCase.CultureForName(String)
    LuceneTestCase.DefaultCodecSupportsDocValues
    LuceneTestCase.MaybeWrapReader(IndexReader)
    LuceneTestCase.NewIOContext(Random)
    LuceneTestCase.NewIOContext(Random, IOContext)
    LuceneTestCase.NewSearcher(IndexReader)
    LuceneTestCase.NewSearcher(IndexReader, Boolean)
    LuceneTestCase.NewSearcher(IndexReader, Boolean, Boolean)
    LuceneTestCase.GetDataFile(String)
    LuceneTestCase.DefaultCodecSupportsMissingDocValues
    LuceneTestCase.DefaultCodecSupportsSortedSet
    LuceneTestCase.DefaultCodecSupportsDocsWithField
    LuceneTestCase.DefaultCodecSupportsFieldUpdates
    LuceneTestCase.AssertReaderEquals(String, IndexReader, IndexReader)
    LuceneTestCase.AssertReaderStatisticsEquals(String, IndexReader, IndexReader)
    LuceneTestCase.AssertFieldsEquals(String, IndexReader, Fields, Fields, Boolean)
    LuceneTestCase.AssertFieldStatisticsEquals(String, Fields, Fields)
    LuceneTestCase.AssertTermsEquals(String, IndexReader, Terms, Terms, Boolean)
    LuceneTestCase.AssertTermsStatisticsEquals(String, Terms, Terms)
    LuceneTestCase.AssertTermsEnumEquals(String, IndexReader, TermsEnum, TermsEnum, Boolean)
    LuceneTestCase.AssertDocsAndPositionsEnumEquals(String, DocsAndPositionsEnum, DocsAndPositionsEnum)
    LuceneTestCase.AssertDocsEnumEquals(String, DocsEnum, DocsEnum, Boolean)
    LuceneTestCase.AssertDocsSkippingEquals(String, IndexReader, Int32, DocsEnum, DocsEnum, Boolean)
    LuceneTestCase.AssertPositionsSkippingEquals(String, IndexReader, Int32, DocsAndPositionsEnum, DocsAndPositionsEnum)
    LuceneTestCase.AssertTermStatsEquals(String, TermsEnum, TermsEnum)
    LuceneTestCase.AssertNormsEquals(String, IndexReader, IndexReader)
    LuceneTestCase.AssertStoredFieldsEquals(String, IndexReader, IndexReader)
    LuceneTestCase.AssertStoredFieldEquals(String, IIndexableField, IIndexableField)
    LuceneTestCase.AssertTermVectorsEquals(String, IndexReader, IndexReader)
    LuceneTestCase.AssertDocValuesEquals(String, IndexReader, IndexReader)
    LuceneTestCase.AssertDocValuesEquals(String, Int32, NumericDocValues, NumericDocValues)
    LuceneTestCase.AssertDeletedDocsEquals(String, IndexReader, IndexReader)
    LuceneTestCase.AssertFieldInfosEquals(String, IndexReader, IndexReader)
    LuceneTestCase.SlowFileExists(Directory, String)
    LuceneTestCase.CreateTempDir()
    LuceneTestCase.CreateTempDir(String)
    LuceneTestCase.CreateTempFile(String, String)
    LuceneTestCase.CreateTempFile()
    LuceneTestCase.GetFullMethodName(String)
    LuceneTestCase.RandomGaussian()
    Namespace: Lucene.Net.Analysis
    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
    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
    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
    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
    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
    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
    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
    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()

    Returns a random impl

    Declaration
    public static AttributeSource.AttributeFactory NewAttributeFactory()
    Returns
    Type Description
    AttributeSource.AttributeFactory
    | Improve this Doc View Source

    NewAttributeFactory(Random)

    Returns a random impl

    Declaration
    public static AttributeSource.AttributeFactory NewAttributeFactory(Random random)
    Parameters
    Type Name Description
    Random random
    Returns
    Type Description
    AttributeSource.AttributeFactory
    | 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

    MockAnalyzer
    MockTokenizer
    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)