Class HitHighlighterImpl
java.lang.Object
com.atlassian.confluence.impl.search.summary.HitHighlighterImpl
- All Implemented Interfaces:
HitHighlighter
Finds search hits in content based on a given Lucene query. Highlights those hits with a formatter.
-
Constructor Summary
ConstructorsConstructorDescriptionHitHighlighterImpl(org.apache.lucene.search.Query query, org.apache.lucene.analysis.Analyzer analyzer) Create a new highlighter that uses the default formatter, and HTML encoding.HitHighlighterImpl(org.apache.lucene.search.Query query, org.apache.lucene.analysis.Analyzer analyzer, org.apache.lucene.search.highlight.Formatter formatter) Create a new highlighter with specified formatter with HTML encoding.HitHighlighterImpl(org.apache.lucene.search.Query query, org.apache.lucene.analysis.Analyzer analyzer, org.apache.lucene.search.highlight.Formatter formatter, org.apache.lucene.search.highlight.Encoder encoder) Create a new highlighter -
Method Summary
Modifier and TypeMethodDescriptiongetSummary(String text) Get a summary, suitable for displaying excerpts of search results.highlightText(String text) Highlights text without fragmenting it.
-
Constructor Details
-
HitHighlighterImpl
public HitHighlighterImpl(org.apache.lucene.search.Query query, org.apache.lucene.analysis.Analyzer analyzer) Create a new highlighter that uses the default formatter, and HTML encoding.The output format for hit highlights is:
Lorem ipsum <span class="search-highlight>dolor</span> sit amet -
HitHighlighterImpl
public HitHighlighterImpl(org.apache.lucene.search.Query query, org.apache.lucene.analysis.Analyzer analyzer, org.apache.lucene.search.highlight.Formatter formatter) Create a new highlighter with specified formatter with HTML encoding. -
HitHighlighterImpl
public HitHighlighterImpl(org.apache.lucene.search.Query query, org.apache.lucene.analysis.Analyzer analyzer, org.apache.lucene.search.highlight.Formatter formatter, org.apache.lucene.search.highlight.Encoder encoder) Create a new highlighter
-
-
Method Details
-
getSummary
Get a summary, suitable for displaying excerpts of search results.- Specified by:
getSummaryin interfaceHitHighlighter- Returns:
- a summary, or an empty string if the summary is null or empty.
-
highlightText
Highlights text without fragmenting it.- Specified by:
highlightTextin interfaceHitHighlighter
-