fr.gouv.culture.sdx.search.lucene.highlight
Class LuceneTermHighlighter
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.cocoon.xml.AbstractXMLProducer
org.apache.cocoon.xml.AbstractXMLPipe
fr.gouv.culture.sdx.utils.xml.AbstractSdxXMLPipe
fr.gouv.culture.sdx.pipeline.AbstractPipeline
fr.gouv.culture.sdx.pipeline.GenericPipeline
fr.gouv.culture.sdx.search.lucene.highlight.LuceneTermHighlighter
- All Implemented Interfaces:
- Pipeline, TermHighlighter, Describable, Encodable, Identifiable, Localizable, SdxObject, org.apache.avalon.excalibur.pool.Poolable, org.apache.avalon.excalibur.pool.Recyclable, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.service.Serviceable, org.apache.cocoon.xml.XMLPipe, org.apache.cocoon.xml.XMLProducer, org.apache.excalibur.xml.sax.XMLConsumer, org.apache.excalibur.xml.sax.XMLizable, org.xml.sax.ContentHandler, org.xml.sax.ext.LexicalHandler
public class LuceneTermHighlighter
- extends GenericPipeline
- implements TermHighlighter
Fields inherited from class fr.gouv.culture.sdx.utils.xml.AbstractSdxXMLPipe |
_configuration, _context, _description, _encoding, _id, _locale, _logger, _manager, _xmlizable_objects, _xmlLang, isToSaxInitialized |
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer |
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer |
Method Summary |
void |
characters(char[] c,
int start,
int len)
|
void |
endElement(java.lang.String uri,
java.lang.String loc,
java.lang.String raw)
|
protected org.xml.sax.Attributes |
getHilitedAttributes(org.xml.sax.Attributes a)
|
void |
highlightTerm(java.lang.String term,
java.lang.String termText)
Highlight an arbitrary term. |
void |
recycle()
Recycle the producer by removing references |
void |
setQuery(Query query)
Set's up the pipeline |
void |
setTerms(Terms terms)
|
void |
startElement(java.lang.String uri,
java.lang.String loc,
java.lang.String raw,
org.xml.sax.Attributes a)
|
Methods inherited from class fr.gouv.culture.sdx.pipeline.AbstractPipeline |
addTransformation, configure, getClassNameSuffix, getParameters, getTransformedBytes, getTransformedFile, initToSax, initVolatileObjectsToSax, newInstance, setConsumer, setParameters, setParametersToTransformations, verifyConfigurationParameters |
Methods inherited from class fr.gouv.culture.sdx.utils.xml.AbstractSdxXMLPipe |
configureDescription, contextualize, enableLogging, getBaseAttributes, getConfiguration, getContext, getDescription, getEncoding, getId, getLocale, getLog, getServiceManager, getXmlLang, service, setDescription, setEncoding, setId, setLocale, setUpSdxObject, setUpSdxObject, setXmlLang, toSAX, verifyConfigurationResources |
Methods inherited from class org.apache.cocoon.xml.AbstractXMLPipe |
comment, endCDATA, endDocument, endDTD, endEntity, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startCDATA, startDocument, startDTD, startEntity, startPrefixMapping |
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer |
setContentHandler, setLexicalHandler |
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
getLogger, setupLogger, setupLogger, setupLogger |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.xml.sax.ContentHandler |
endDocument, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping |
Methods inherited from interface org.xml.sax.ext.LexicalHandler |
comment, endCDATA, endDTD, endEntity, startCDATA, startDTD, startEntity |
Methods inherited from interface org.apache.cocoon.xml.XMLProducer |
setConsumer |
Methods inherited from interface fr.gouv.culture.sdx.utils.SdxObject |
getLog |
Methods inherited from interface org.apache.avalon.framework.logger.LogEnabled |
enableLogging |
Methods inherited from interface org.apache.avalon.framework.context.Contextualizable |
contextualize |
Methods inherited from interface org.apache.avalon.framework.service.Serviceable |
service |
Methods inherited from interface org.apache.avalon.framework.configuration.Configurable |
configure |
Methods inherited from interface org.apache.excalibur.xml.sax.XMLizable |
toSAX |
LuceneTermHighlighter
public LuceneTermHighlighter()
setQuery
public void setQuery(Query query)
throws SDXException
- Set's up the pipeline
- Specified by:
setQuery
in interface TermHighlighter
- Parameters:
query
- The sdx query object on which the results are based
- Throws:
SDXException
setTerms
public void setTerms(Terms terms)
- Specified by:
setTerms
in interface TermHighlighter
highlightTerm
public void highlightTerm(java.lang.String term,
java.lang.String termText)
throws org.xml.sax.SAXException
- Highlight an arbitrary term. For example, an HTML TermHighlighter could simply do:
return "<b>" + term + "</b>";
- Parameters:
term
- term text to highlighttermText
- the string value of the term on which the comparison was made
- Throws:
org.xml.sax.SAXException
characters
public void characters(char[] c,
int start,
int len)
throws org.xml.sax.SAXException
- Specified by:
characters
in interface org.xml.sax.ContentHandler
- Overrides:
characters
in class org.apache.cocoon.xml.AbstractXMLPipe
- Throws:
org.xml.sax.SAXException
endElement
public void endElement(java.lang.String uri,
java.lang.String loc,
java.lang.String raw)
throws org.xml.sax.SAXException
- Specified by:
endElement
in interface org.xml.sax.ContentHandler
- Overrides:
endElement
in class org.apache.cocoon.xml.AbstractXMLPipe
- Throws:
org.xml.sax.SAXException
startElement
public void startElement(java.lang.String uri,
java.lang.String loc,
java.lang.String raw,
org.xml.sax.Attributes a)
throws org.xml.sax.SAXException
- Specified by:
startElement
in interface org.xml.sax.ContentHandler
- Overrides:
startElement
in class org.apache.cocoon.xml.AbstractXMLPipe
- Throws:
org.xml.sax.SAXException
getHilitedAttributes
protected org.xml.sax.Attributes getHilitedAttributes(org.xml.sax.Attributes a)
throws SDXException,
java.io.IOException
- Throws:
SDXException
java.io.IOException
recycle
public void recycle()
- Recycle the producer by removing references
- Specified by:
recycle
in interface TermHighlighter
- Specified by:
recycle
in interface org.apache.avalon.excalibur.pool.Recyclable
- Overrides:
recycle
in class org.apache.cocoon.xml.AbstractXMLProducer
Copyright © 2000-2010 Ministere de la culture et de la communication / AJLSM. All Rights Reserved.