C# Class Lucene.Net.Analysis.MockAnalyzer

Analyzer for testing

this analyzer is a replacement for Whitespace/Simple/KeywordAnalyzers for unit tests. If you are testing a custom component such as a queryparser or analyzer-wrapper that consumes analysis streams, its a great idea to test it with this analyzer instead. MockAnalyzer has the following behavior:

  • By default, the assertions in MockTokenizer are turned on for extra checks that the consumer is consuming properly. These checks can be disabled with #setEnableChecks(boolean).
  • Payload data is randomly injected into the stream for more thorough testing of payloads.
Inheritance: Analyzer
Afficher le fichier Open project: paulirwin/lucene.net Class Usage Examples

Méthodes publiques

Méthode Description
CreateComponents ( string fieldName, TextReader reader ) : TokenStreamComponents
GetOffsetGap ( string fieldName ) : int

Get the offset gap between tokens in fields if several fields with the same name were added.

GetPositionIncrementGap ( string fieldName ) : int
MockAnalyzer ( Random random ) : System

Create a Whitespace-lowercasing analyzer with no stopwords removal.

Calls {@link #MockAnalyzer(Random, CharacterRunAutomaton, boolean, CharacterRunAutomaton) MockAnalyzer(random, MockTokenizer.WHITESPACE, true, MockTokenFilter.EMPTY_STOPSET, false}).

MockAnalyzer ( Random random, CharacterRunAutomaton runAutomaton, bool lowerCase ) : System

Calls {@link #MockAnalyzer(Random, CharacterRunAutomaton, boolean, CharacterRunAutomaton) MockAnalyzer(random, runAutomaton, lowerCase, MockTokenFilter.EMPTY_STOPSET, false}).

MockAnalyzer ( Random random, CharacterRunAutomaton runAutomaton, bool lowerCase, CharacterRunAutomaton filter ) : System

Creates a new MockAnalyzer.

Private Methods

Méthode Description
MaybePayload ( Lucene.Net.Analysis.TokenFilter stream, string fieldName ) : Lucene.Net.Analysis.TokenFilter

Method Details

CreateComponents() public méthode

public CreateComponents ( string fieldName, TextReader reader ) : TokenStreamComponents
fieldName string
reader System.IO.TextReader
Résultat TokenStreamComponents

GetOffsetGap() public méthode

Get the offset gap between tokens in fields if several fields with the same name were added.
public GetOffsetGap ( string fieldName ) : int
fieldName string Currently not used, the same offset gap is returned for each field.
Résultat int

GetPositionIncrementGap() public méthode

public GetPositionIncrementGap ( string fieldName ) : int
fieldName string
Résultat int

MockAnalyzer() public méthode

Create a Whitespace-lowercasing analyzer with no stopwords removal.

Calls {@link #MockAnalyzer(Random, CharacterRunAutomaton, boolean, CharacterRunAutomaton) MockAnalyzer(random, MockTokenizer.WHITESPACE, true, MockTokenFilter.EMPTY_STOPSET, false}).

public MockAnalyzer ( Random random ) : System
random System.Random
Résultat System

MockAnalyzer() public méthode

Calls {@link #MockAnalyzer(Random, CharacterRunAutomaton, boolean, CharacterRunAutomaton) MockAnalyzer(random, runAutomaton, lowerCase, MockTokenFilter.EMPTY_STOPSET, false}).
public MockAnalyzer ( Random random, CharacterRunAutomaton runAutomaton, bool lowerCase ) : System
random System.Random
runAutomaton CharacterRunAutomaton
lowerCase bool
Résultat System

MockAnalyzer() public méthode

Creates a new MockAnalyzer.
public MockAnalyzer ( Random random, CharacterRunAutomaton runAutomaton, bool lowerCase, CharacterRunAutomaton filter ) : System
random System.Random Random for payloads behavior
runAutomaton CharacterRunAutomaton DFA describing how tokenization should happen (e.g. [a-zA-Z]+)
lowerCase bool true if the tokenizer should lowercase terms
filter CharacterRunAutomaton DFA describing how terms should be filtered (set of stopwords, etc)
Résultat System