DLESE Tools
v1.2

org.dlese.dpc.index.reader
Class DocReader

java.lang.Object
  extended byorg.dlese.dpc.index.reader.DocReader
Direct Known Subclasses:
FileIndexingServiceDocReader, HarvestLogReader, SimpleDocReader, WebLogReader

public abstract class DocReader
extends Object

An abstract class that defines basic getter methods to read data from a typed Lucene Document. The getter methods can then be accessed from (Struts) beans that need the data. When writing a new concrete class of this type, a switch should be added to return it from ResultDoc.getDocReader().

Author:
John Weatherley
See Also:
ResultDoc

Field Summary
protected  ResultDocConfig conf
          The index that was searched over.
protected  Document doc
          The Lucene Document that is being read.
protected  float score
          The Lucene score assigned to the Document, or -1 if none available.
 
Constructor Summary
protected DocReader()
          Constructor that initializes an empty DocReader.
protected DocReader(Document myDoc)
          Constructor that may be used programatically to wrap a reader around a Lucene Document that was created by a DocWriter.
protected DocReader(Document myDoc, float myScore, ResultDocConfig myConf)
          Constructor that is used by ResultDoc at search time to create a new instance of a DocReader.
 
Method Summary
 Document getDocument()
          Gets the Lucene Document associated with this DocReader.
 SimpleLuceneIndex getIndex()
          Gets the index that was searched over to produce the resulting hit.
 String getQuery()
           
abstract  String getReaderType()
          Gets a String describing the reader type.
 String getScore()
          Gets the Lucene score for the Document, or -1 if none available.
protected  void setDoc(Document myDoc)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

doc

protected Document doc
The Lucene Document that is being read.


score

protected float score
The Lucene score assigned to the Document, or -1 if none available.


conf

protected ResultDocConfig conf
The index that was searched over.

Constructor Detail

DocReader

protected DocReader(Document myDoc,
                    float myScore,
                    ResultDocConfig myConf)
Constructor that is used by ResultDoc at search time to create a new instance of a DocReader.


DocReader

protected DocReader(Document myDoc)
Constructor that may be used programatically to wrap a reader around a Lucene Document that was created by a DocWriter.

See Also:
DocWriter

DocReader

protected DocReader()
Constructor that initializes an empty DocReader.

Method Detail

setDoc

protected void setDoc(Document myDoc)

getReaderType

public abstract String getReaderType()
Gets a String describing the reader type. This may be used in (Struts) beans to determine which type of reader is available for a given search result and thus what data is available for display in the UI. The reader type implies which getter methods are available.

Returns:
The readerType value.

getScore

public String getScore()
Gets the Lucene score for the Document, or -1 if none available.

Returns:
The score or -1 if not available.

getDocument

public Document getDocument()
Gets the Lucene Document associated with this DocReader.

Returns:
A Lucene Document.

getIndex

public SimpleLuceneIndex getIndex()
Gets the index that was searched over to produce the resulting hit.

Returns:
The index.

getQuery

public String getQuery()

DLESE Tools
v1.2