com.atlassian.confluence.search.summary
Class HitHighlighter

java.lang.Object
  extended by com.atlassian.confluence.search.summary.HitHighlighter

@NotThreadSafe
public class HitHighlighter
extends Object

Finds search hits in content based on a given Lucene query. Highlights those hits with a formatter. This class is not thread safe.


Constructor Summary
HitHighlighter(org.apache.lucene.search.Query query, org.apache.lucene.analysis.Analyzer analyzer)
          Create a new highlighter that uses the default formatter, and HTML encoding.
HitHighlighter(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.
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)
          Create a new highlighter
 
Method Summary
 String getBestFragments(String text)
          Use the Lucene Highlighter directly.
 String getSummary(String text)
          Get a summary, suitable for displaying excerpts of search results.
 String highlightText(String text)
          Highlights text without fragmenting it.
 String highlightWikiMarkup(String markup)
          Highlight text without fragmenting, after stripping wiki markup.
 void setFragmenter(org.apache.lucene.search.highlight.Fragmenter originalFragmenter)
           
 void setNoFragments()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HitHighlighter

public HitHighlighter(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


HitHighlighter

public HitHighlighter(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.


HitHighlighter

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)
Create a new highlighter

Method Detail

setFragmenter

public void setFragmenter(org.apache.lucene.search.highlight.Fragmenter originalFragmenter)

setNoFragments

public void setNoFragments()

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

public String highlightWikiMarkup(String markup)
Highlight text without fragmenting, after stripping wiki markup.


highlightText

public String highlightText(String text)
Highlights text without fragmenting it.


getBestFragments

public String getBestFragments(String text)
Use the Lucene Highlighter directly. Text that doesn't match the query will return an empty string.



Copyright © 2003-2012 Atlassian. All Rights Reserved.