Understanding PatternReplaceCharFilterFactor

This filter uses regular expressions to replace or change character patterns.

Arguments:

  • pattern: The regular expression pattern to apply to the incoming text
  • replacement: The text to use to replace matching patterns

Example:

<fieldType name="text_en" class="solr.TextField" positionIncrementGap="100">
<analyzer>
<charFilter class="solr.PatternReplaceCharFilterFactory" pattern="(w+)(ing)" replacement="$1"/>
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
</analyzer>
</fieldType>

Inputshowing see-ing viewing

Outputshowsee-ingview

As per the behavior of the pattern, ing is removed from the end of the words except see-ing.

Explaining every char filter is not possible here. Please refer to the Solr documents for these.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.104.196