Class SimpleExcerptProvider
- java.lang.Object
-
- org.apache.jackrabbit.core.query.lucene.SimpleExcerptProvider
-
- All Implemented Interfaces:
ExcerptProvider
public class SimpleExcerptProvider extends Object implements ExcerptProvider
SimpleExcerptProvider
is a very simple excerpt provider. It does not do any highlighting and simply returns up tomaxFragmentSize
characters of string properties for a given node.
-
-
Field Summary
-
Fields inherited from interface org.apache.jackrabbit.core.query.lucene.ExcerptProvider
REP_EXCERPT
-
-
Constructor Summary
Constructors Constructor Description SimpleExcerptProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getExcerpt(NodeId id, int maxFragments, int maxFragmentSize)
Returns the XML excerpt for the node withid
.void
init(Query query, SearchIndex index)
Initializes this excerpt provider.
-
-
-
Method Detail
-
init
public void init(Query query, SearchIndex index) throws IOException
Initializes this excerpt provider.- Specified by:
init
in interfaceExcerptProvider
- Parameters:
query
- excerpts will be based on this query.index
- provides access to the search index.- Throws:
IOException
- if an error occurs while initializing this excerpt provider.
-
getExcerpt
public String getExcerpt(NodeId id, int maxFragments, int maxFragmentSize) throws IOException
Returns the XML excerpt for the node withid
.- Specified by:
getExcerpt
in interfaceExcerptProvider
- Parameters:
id
- a node id.maxFragments
- the maximum number of fragments to create.maxFragmentSize
- the maximum number of characters in a fragment.- Returns:
- the XML excerpt or
null
if there is no node withid
. - Throws:
IOException
- if an error occurs while creating the excerpt.
-
-