Class WeightedXMLExcerpt
- java.lang.Object
-
- org.apache.jackrabbit.core.query.lucene.AbstractExcerpt
-
- org.apache.jackrabbit.core.query.lucene.WeightedXMLExcerpt
-
- All Implemented Interfaces:
ExcerptProvider
,HighlightingExcerptProvider
public class WeightedXMLExcerpt extends AbstractExcerpt
WeightedXMLExcerpt
creates an XML excerpt of a matching node. In contrast toDefaultXMLExcerpt
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.
E.g. if you search for 'jackrabbit' and 'query' you may get the following result for a node:<excerpt> <fragment><highlight>Jackrabbit</highlight> implements both the mandatory XPath and optional SQL <highlight>query</highlight> syntax.</fragment> <fragment>Before parsing the XPath <highlight>query</highlight> in <highlight>Jackrabbit</highlight>, the statement is surrounded</fragment> </excerpt>
- See Also:
WeightedHighlighter
-
-
Field Summary
-
Fields inherited from class org.apache.jackrabbit.core.query.lucene.AbstractExcerpt
index, query
-
Fields inherited from interface org.apache.jackrabbit.core.query.lucene.ExcerptProvider
REP_EXCERPT
-
-
Constructor Summary
Constructors Constructor Description WeightedXMLExcerpt()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
createExcerpt(TermPositionVector tpv, String text, int maxFragments, int maxFragmentSize)
Creates an excerpt for the giventext
using token offset information provided bytpv
.-
Methods inherited from class org.apache.jackrabbit.core.query.lucene.AbstractExcerpt
getExcerpt, getQueryTerms, highlight, init
-
-
-
-
Method Detail
-
createExcerpt
protected String createExcerpt(TermPositionVector tpv, String text, int maxFragments, int maxFragmentSize) throws IOException
Creates an excerpt for the giventext
using token offset information provided bytpv
.- Specified by:
createExcerpt
in classAbstractExcerpt
- 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.
-
-