|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.opencms.search.documents.CmsHighlightFinder
public final class CmsHighlightFinder
Adapted from Maik Schreiber's LuceneTools.java,v 1.5 2001/10/16 07:25:55. Alterations include: + Changed to support Lucene 1.3 release (requires no change to Lucene code base but consequently no longer supports MultiTermQuery, RangeQuery and PrefixQuery highlighting currently) + Performance enhancement - CmsHighlightExtractor caches m_query m_terms and can therefore be called repeatedly to highlight multiple results more efficently + New feature: can extract the most relevant parts of large bodies of text - with user defined size of extracts
| Constructor Summary | |
|---|---|
CmsHighlightFinder(I_CmsTermHighlighter highlighter,
Query query,
Analyzer analyzer)
|
|
| Method Summary | |
|---|---|
String[] |
getBestFragments(String text,
int fragmentSize,
int maxNumFragments)
Highlights a text in accordance to the given m_query, extracting the most relevant sections. |
String |
getBestFragments(String text,
int fragmentSize,
int maxNumFragments,
String separator)
Highlights a text in accordance to the given m_query and extracting the most relevant sections. |
static void |
getTerms(Query query,
HashSet terms,
boolean prohibited)
Extracts all term texts of a given Query. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CmsHighlightFinder(I_CmsTermHighlighter highlighter,
Query query,
Analyzer analyzer)
throws IOException
highlighter - I_TermHighlighter to use to highlight m_terms in the textquery - Query which contains the m_terms to be highlighted in the textanalyzer - Analyzer used to construct the Query
IOException - if something goes wrong| Method Detail |
|---|
public static void getTerms(Query query,
HashSet terms,
boolean prohibited)
throws IOException
query - Query to extract term texts fromterms - HashSet where extracted term texts should be put into
(Elements: String)prohibited - true to extract "prohibited" m_terms, too
IOException - if something goes wrong
public String[] getBestFragments(String text,
int fragmentSize,
int maxNumFragments)
throws IOException
text - text to highlight m_terms infragmentSize - the size in bytes of each fragment to be returnedmaxNumFragments - the maximum number of fragments.
IOException - if something goes wrong
public String getBestFragments(String text,
int fragmentSize,
int maxNumFragments,
String separator)
throws IOException
text - text to highlight m_terms infragmentSize - the size in bytes of each fragment to be returnedmaxNumFragments - the maximum number of fragments.separator - the separator used to intersperse the document fragments
(typically " ... ")
IOException - if something goes wrong
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||