Class HitHighlighter


  • @NotThreadSafe
    public class HitHighlighter
    extends Object
    Finds search hits in content based on a given Lucene query. Highlights those hits with a formatter.
    • Constructor Detail

      • HitHighlighter

        @Deprecated
        public HitHighlighter​(org.apache.lucene.search.Query query,
                              org.apache.lucene.analysis.Analyzer analyzer)
        Deprecated.
        since 7.20, use HitHighlighterFactory.create(String) instead.
        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

      • HitHighlighter

        @Deprecated
        public HitHighlighter​(org.apache.lucene.search.Query query,
                              org.apache.lucene.analysis.Analyzer analyzer,
                              org.apache.lucene.search.highlight.Formatter formatter)
        Deprecated.
        since 7.20, use HitHighlighterFactory.create(String) instead.
        Create a new highlighter with specified formatter with HTML encoding.
      • HitHighlighter

        @Deprecated
        public HitHighlighter​(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)
        Deprecated.
        since 7.20, use HitHighlighterFactory.create(String) instead.
        Create a new highlighter
    • Method Detail

      • setFragmenter

        @Deprecated
        public void setFragmenter​(org.apache.lucene.search.highlight.Fragmenter originalFragmenter)
        Deprecated.
        since 7.20, no replacement. A default fragmenter will be used.
      • setNoFragments

        @Deprecated
        public void setNoFragments()
        Deprecated.
        since 7.20, no replacement.
      • getSummary

        public String getSummary​(String text)
        Get a summary, suitable for displaying excerpts of search results.
        Returns:
        a summary, or an empty string if the summary is null or empty.
      • highlightWikiMarkup

        @Deprecated
        public String highlightWikiMarkup​(String markup)
        Deprecated.
        since 6.13.0, no replacement
        Highlight text without fragmenting, after stripping wiki markup.
      • highlightText

        public String highlightText​(String text)
        Highlights text without fragmenting it.
      • getBestFragments

        @Deprecated
        public String getBestFragments​(String text)
        Deprecated.
        since 7.20, no replacement.
        Use the Lucene Highlighter directly. Text that doesn't match the query will return an empty string.