fr.gouv.culture.sdx.search.lucene.highlight
Class LuceneTermHighlighter

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLoggable
      extended byorg.apache.cocoon.xml.AbstractXMLProducer
          extended byorg.apache.cocoon.xml.AbstractXMLPipe
              extended byfr.gouv.culture.sdx.pipeline.AbstractPipeline
                  extended byfr.gouv.culture.sdx.pipeline.GenericPipeline
                      extended byfr.gouv.culture.sdx.search.lucene.highlight.LuceneTermHighlighter
All Implemented Interfaces:
org.apache.avalon.framework.component.Composable, org.apache.avalon.framework.configuration.Configurable, org.xml.sax.ContentHandler, org.xml.sax.ext.LexicalHandler, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.logger.Loggable, Pipeline, org.apache.avalon.excalibur.pool.Poolable, org.apache.avalon.excalibur.pool.Recyclable, TermHighlighter, org.apache.cocoon.xml.XMLConsumer, org.apache.cocoon.xml.XMLPipe, org.apache.cocoon.xml.XMLProducer

public class LuceneTermHighlighter
extends GenericPipeline
implements TermHighlighter


Field Summary
 
Fields inherited from class fr.gouv.culture.sdx.pipeline.AbstractPipeline
configuration, id, keepStep, logger, manager, props, transformations, transformsList
 
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, lexicalHandler, xmlConsumer
 
Fields inherited from interface fr.gouv.culture.sdx.pipeline.Pipeline
ATTRIBUTE_ID, ATTRIBUTE_TYPE, CLASS_NAME_SUFFIX, ELEMENT_NAME, ELEMENT_NAME_PIPELINES, PACKAGE_QUALNAME
 
Constructor Summary
LuceneTermHighlighter()
           
 
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, compose, configure, enableLogging, getId, getParameters, getTransformedBytes, getTransformedFile, newInstance, setConsumer, setParameters, setParametersToTransformations, setProperties, verifyConfigurationParameters
 
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.AbstractLoggable
getLogger, setLogger, 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 fr.gouv.culture.sdx.pipeline.Pipeline
addTransformation, getId, getParameters, getTransformedBytes, getTransformedFile, newInstance, setParameters, setProperties
 
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 org.apache.avalon.framework.logger.LogEnabled
enableLogging
 
Methods inherited from interface org.apache.avalon.framework.configuration.Configurable
configure
 
Methods inherited from interface org.apache.avalon.framework.component.Composable
compose
 

Constructor Detail

LuceneTermHighlighter

public LuceneTermHighlighter()
Method Detail

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 highlight
termText - 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
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
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
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


Copyright © 2000-2004 Ministere de la culture et de la communication / AJLSM. All Rights Reserved.