C# Class Lucene.Net.Analysis.Pattern.PatternReplaceCharFilter

CharFilter that uses a regular expression for the target of replace string. The pattern match will be done in each "block" in char stream.

ex1) source="aa  bb aa bb", pattern="(aa)\\s+(bb)" replacement="$1#$2"
output="aa#bb aa#bb"

NOTE: If you produce a phrase that has different length to source string and the field is used for highlighting for a term of the phrase, you will face a trouble.

ex2) source="aa123bb", pattern="(aa)\\d+(bb)" replacement="$1 $2"
output="aa bb"
and you want to search bb and highlight it, you will get
highlight snippet="aa1<em>23bb</em>"

@since Solr 1.5
Inheritance: Lucene.Net.Analysis.CharFilters.BaseCharFilter
Exibir arquivo Open project: apache/lucenenet Class Usage Examples

Public Methods

Method Description
PatternReplaceCharFilter ( Regex pattern, string replacement, TextReader @in ) : Lucene.Net.Analysis.CharFilters
Read ( ) : int
Read ( char cbuf, int off, int len ) : int

Protected Methods

Method Description
Correct ( int currentOff ) : int

Private Methods

Method Description
Fill ( ) : void
PatternReplaceCharFilter ( Regex pattern, string replacement, int maxBlockChars, string blockDelimiter, TextReader @in ) : Lucene.Net.Analysis.CharFilters
ProcessPattern ( StringBuilder input ) : string

Replace pattern in input and mark correction offsets.

Method Details

Correct() protected method

protected Correct ( int currentOff ) : int
currentOff int
return int

PatternReplaceCharFilter() public method

public PatternReplaceCharFilter ( Regex pattern, string replacement, TextReader @in ) : Lucene.Net.Analysis.CharFilters
pattern System.Text.RegularExpressions.Regex
replacement string
@in TextReader
return Lucene.Net.Analysis.CharFilters

Read() public method

public Read ( ) : int
return int

Read() public method

public Read ( char cbuf, int off, int len ) : int
cbuf char
off int
len int
return int