Package org.apache.solr.highlight
Class RegexFragmenter
- java.lang.Object
-
- org.apache.solr.highlight.HighlightingPluginBase
-
- org.apache.solr.highlight.RegexFragmenter
-
- All Implemented Interfaces:
AutoCloseable
,SolrInfoBean
,SolrFragmenter
,SolrMetricProducer
,NamedListInitializedPlugin
public class RegexFragmenter extends HighlightingPluginBase implements SolrFragmenter
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 asGapFragmenter
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.solr.core.SolrInfoBean
SolrInfoBean.Category, SolrInfoBean.Group
-
-
Field Summary
Fields Modifier and Type Field Description protected Pattern
defaultPattern
protected String
defaultPatternRaw
-
Fields inherited from class org.apache.solr.highlight.HighlightingPluginBase
defaults, metricManager, metricNames, numRequests, registry, registryName
-
-
Constructor Summary
Constructors Constructor Description RegexFragmenter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getDescription()
Simple one or two line descriptionorg.apache.lucene.search.highlight.Fragmenter
getFragmenter(String fieldName, SolrParams params)
Return aFragmenter
appropriate for this field.void
init(NamedList args)
init
will be called just once, immediately after creation.-
Methods inherited from class org.apache.solr.highlight.HighlightingPluginBase
getCategory, getMetricNames, getMetricRegistry, getName, initializeMetrics
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.solr.core.SolrInfoBean
getCategory, getMetricNames, getMetricRegistry, getMetricsSnapshot, getName, registerMetricName
-
Methods inherited from interface org.apache.solr.metrics.SolrMetricProducer
close, getSolrMetricsContext, initializeMetrics
-
-
-
-
Method Detail
-
init
public void init(NamedList args)
Description copied from interface:SolrFragmenter
init
will be called just once, immediately after creation.The args are user-level initialization parameters that may be specified when declaring a request handler in solrconfig.xml
- Specified by:
init
in interfaceNamedListInitializedPlugin
- Specified by:
init
in interfaceSolrFragmenter
- Overrides:
init
in classHighlightingPluginBase
-
getFragmenter
public org.apache.lucene.search.highlight.Fragmenter getFragmenter(String fieldName, SolrParams params)
Description copied from interface:SolrFragmenter
Return aFragmenter
appropriate for this field.- Specified by:
getFragmenter
in interfaceSolrFragmenter
- Parameters:
fieldName
- The name of the fieldparams
- The params controlling Highlighting- Returns:
- An appropriate
Fragmenter
.
-
getDescription
public String getDescription()
Description copied from interface:SolrInfoBean
Simple one or two line description- Specified by:
getDescription
in interfaceSolrInfoBean
- Specified by:
getDescription
in classHighlightingPluginBase
-
-