org.apache.jackrabbit.core.query.lucene
Class WeightedHTMLExcerpt
java.lang.Object
org.apache.jackrabbit.core.query.lucene.AbstractExcerpt
org.apache.jackrabbit.core.query.lucene.WeightedHTMLExcerpt
- All Implemented Interfaces:
- ExcerptProvider, HighlightingExcerptProvider
public class WeightedHTMLExcerpt
- extends AbstractExcerpt
WeightedHTMLExcerpt
creates a HTML excerpt with the following
format:
<div>
<span><strong>Jackrabbit</strong> implements both the mandatory XPath and optional SQL <strong>query</strong> syntax.</span>
<span>Before parsing the XPath <strong>query</strong> in <strong>Jackrabbit</strong>, the statement is surrounded</span>
</div>
In contrast to DefaultHTMLExcerpt
this implementation weights
fragments based on the proximity of highlighted terms. Highlighted terms that
are adjacent have a higher weight. In addition, the more highlighted terms,
the higher the weight.
- See Also:
WeightedHighlighter
Method Summary |
protected String |
createExcerpt(org.apache.lucene.index.TermPositionVector tpv,
String text,
int maxFragments,
int maxFragmentSize)
Creates an excerpt for the given text using token offset
information provided by tpv . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
WeightedHTMLExcerpt
public WeightedHTMLExcerpt()
createExcerpt
protected String createExcerpt(org.apache.lucene.index.TermPositionVector tpv,
String text,
int maxFragments,
int maxFragmentSize)
throws IOException
- Creates an excerpt for the given
text
using token offset
information provided by tpv
.
- Specified by:
createExcerpt
in class AbstractExcerpt
- Parameters:
tpv
- the term position vector for the fulltext field.text
- the original text.maxFragments
- the maximum number of fragments to create.maxFragmentSize
- the maximum number of characters in a fragment.
- Returns:
- the xml excerpt.
- Throws:
IOException
- if an error occurs while creating the excerpt.
Copyright © 2004-2008 The Apache Software Foundation. All Rights Reserved.