Class HitHighlighterImpl
- java.lang.Object
-
- com.atlassian.confluence.impl.search.summary.HitHighlighterImpl
-
- All Implemented Interfaces:
HitHighlighter
@NotThreadSafe public class HitHighlighterImpl extends Object implements HitHighlighter
Finds search hits in content based on a given Lucene query. Highlights those hits with a formatter.
-
-
Constructor Summary
Constructors Constructor Description 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.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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getSummary(String text)
Get a summary, suitable for displaying excerpts of search results.String
highlightText(String text)
Highlights text without fragmenting it.
-
-
-
Constructor Detail
-
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 Detail
-
getSummary
public String getSummary(String text)
Get a summary, suitable for displaying excerpts of search results.- Specified by:
getSummary
in interfaceHitHighlighter
- Returns:
- a summary, or an empty string if the summary is null or empty.
-
highlightText
public String highlightText(String text)
Highlights text without fragmenting it.- Specified by:
highlightText
in interfaceHitHighlighter
-
-