Package org.apache.solr.highlight
Class RegexFragmenter
java.lang.Object
org.apache.solr.highlight.HighlightingPluginBase
org.apache.solr.highlight.RegexFragmenter
- All Implemented Interfaces:
SolrFragmenter,NamedListInitializedPlugin
Fragmenter that tries to produce snippets that "look"
like a regular expression. solrconfig.xml parameters:
hl.regex.pattern: regular expression corresponding to "nice" fragments.hl.regex.slop: how far the fragmenter can stray from the ideal fragment size. A slop of 0.2 means that the fragmenter can go over or under by 20%.hl.regex.maxAnalyzedChars: how many characters to apply the regular expression to (independent from the global highlighter setting).
maxAnalyzedChars is much lower for this fragmenter. After this
limit is exhausted, fragments are produced in the same way as GapFragmenter-
Field Summary
FieldsFields inherited from class org.apache.solr.highlight.HighlightingPluginBase
defaults, solrMetricsContext -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.lucene.search.highlight.FragmentergetFragmenter(String fieldName, org.apache.solr.common.params.SolrParams params) Return aFragmenterappropriate for this field.voidinit(org.apache.solr.common.util.NamedList<?> args) initwill be called just once, immediately after creation.
-
Field Details
-
defaultPatternRaw
-
defaultPattern
-
-
Constructor Details
-
RegexFragmenter
public RegexFragmenter()
-
-
Method Details
-
init
public void init(org.apache.solr.common.util.NamedList<?> args) Description copied from interface:NamedListInitializedPlugininitwill be called just once, immediately after creation.Source of the initialization arguments will typically be solrconfig.xml, but will ultimately depends on the plugin itself
- Specified by:
initin interfaceNamedListInitializedPlugin- Overrides:
initin classHighlightingPluginBase- Parameters:
args- non-null list of initialization parameters (may be empty)
-
getFragmenter
public org.apache.lucene.search.highlight.Fragmenter getFragmenter(String fieldName, org.apache.solr.common.params.SolrParams params) Description copied from interface:SolrFragmenterReturn aFragmenterappropriate for this field.- Specified by:
getFragmenterin interfaceSolrFragmenter- Parameters:
fieldName- The name of the fieldparams- The params controlling Highlighting- Returns:
- An appropriate
Fragmenter.
-