degu.util.enchancer
Class Enchancer

java.lang.Object
  extended by degu.util.enchancer.Enchancer
Direct Known Subclasses:
PDFEnchancer

public abstract class Enchancer
extends java.lang.Object

Modifies an original document reagarding a lucene query and lucene hits. Modifacations are highlighting, bookmark entries etc.


Field Summary
protected  java.io.ByteArrayOutputStream byteArrayOut
           
protected  DeguHits hits
           
protected  java.io.InputStream is
           
protected  org.apache.lucene.queryParser.QueryParser queryParser
           
protected  java.lang.String queryStr
           
protected  java.util.HashSet terms
           
 
Constructor Summary
Enchancer(java.io.File file, java.lang.String queryStr)
           
Enchancer(java.io.InputStream is, java.lang.String queryStr, DeguHits hits)
           
 
Method Summary
abstract  void enchance()
          Enchances the document.
abstract  void enchanceTo(java.io.OutputStream os)
          Writes the enhanced document directly to the OutputStream os.
 byte[] getEnchancedData()
           
 java.io.InputStream getEnchancedIS()
           
 DeguHits getHits()
           
 java.lang.String getQuery()
           
 void setHits(DeguHits hits)
           
 void setIS(java.io.InputStream is)
           
 void setQuery(java.lang.String queryStr)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

is

protected java.io.InputStream is

queryStr

protected java.lang.String queryStr

hits

protected DeguHits hits

queryParser

protected org.apache.lucene.queryParser.QueryParser queryParser

terms

protected java.util.HashSet terms

byteArrayOut

protected java.io.ByteArrayOutputStream byteArrayOut
Constructor Detail

Enchancer

public Enchancer(java.io.InputStream is,
                 java.lang.String queryStr,
                 DeguHits hits)
          throws org.apache.lucene.queryParser.ParseException
Throws:
org.apache.lucene.queryParser.ParseException

Enchancer

public Enchancer(java.io.File file,
                 java.lang.String queryStr)
          throws org.apache.lucene.queryParser.ParseException,
                 java.io.FileNotFoundException
Throws:
org.apache.lucene.queryParser.ParseException
java.io.FileNotFoundException
Method Detail

setIS

public void setIS(java.io.InputStream is)

setQuery

public void setQuery(java.lang.String queryStr)
              throws org.apache.lucene.queryParser.ParseException
Throws:
org.apache.lucene.queryParser.ParseException

setHits

public void setHits(DeguHits hits)

enchance

public abstract void enchance()
                       throws BadDataException
Enchances the document. Result can be obtained with getEnchancedIS() or getEnchancedData()

Throws:
BadDataException

enchanceTo

public abstract void enchanceTo(java.io.OutputStream os)
                         throws BadDataException
Writes the enhanced document directly to the OutputStream os. (getEnchancedIS() and getEnchancedData() do not work here!)

Parameters:
os -
Throws:
BadDataException

getQuery

public java.lang.String getQuery()

getHits

public DeguHits getHits()

getEnchancedIS

public java.io.InputStream getEnchancedIS()

getEnchancedData

public byte[] getEnchancedData()