org.apache.jackrabbit.core.query.lucene
Class DefaultXMLExcerpt

java.lang.Object
  extended by org.apache.jackrabbit.core.query.lucene.AbstractExcerpt
      extended by org.apache.jackrabbit.core.query.lucene.DefaultXMLExcerpt
All Implemented Interfaces:
ExcerptProvider, HighlightingExcerptProvider

public class DefaultXMLExcerpt
extends AbstractExcerpt

DefaultXMLExcerpt creates an XML excerpt of a matching node.
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>
 


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
DefaultXMLExcerpt()
           
 
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 org.apache.jackrabbit.core.query.lucene.AbstractExcerpt
getExcerpt, getQueryTerms, highlight, init
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultXMLExcerpt

public DefaultXMLExcerpt()
Method Detail

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-2010 The Apache Software Foundation. All Rights Reserved.