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

    Modifier and Type
    Method
    Description
    Get a summary, suitable for displaying excerpts of search results.
    Highlights text without fragmenting it.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public String getSummary(String text)
      Get a summary, suitable for displaying excerpts of search results.
      Specified by:
      getSummary in interface HitHighlighter
      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 interface HitHighlighter