DLESE Tools
v1.2

org.dlese.dpc.index
Class ResultDoc

java.lang.Object
  extended byorg.dlese.dpc.index.ResultDoc
All Implemented Interfaces:
Comparable, Serializable

public class ResultDoc
extends Object
implements Comparable, Serializable

A container for a hit that is returned from a SimpleLuceneIndex search.

Author:
John Weatherley
See Also:
DocReader, Serialized Form

Constructor Summary
ResultDoc(Document doc)
          Constructs a ResultDoc using the Document provided.
ResultDoc(ResultDocConfig conf, int docNum, float s)
          Constructor for the ResultDoc that is used by the SimpleLuceneIndex class during search result hit list compilation.
 
Method Summary
 int compareTo(Object obj)
          Compares two ResultDocs for sorting by score.
 DocReader getDocReader()
          Gets the DocReader used to read the specific Document type that is returned in a search.
 String getDoctype()
          Gets the doctype for this ResultDoc.
 Document getDocument()
          Gets the Lucene Document associated with this ResultDoc.
 SimpleLuceneIndex getIndex()
          Gets the index that was searched over.
 String getQuery()
           
 String getReaderClass()
          Gets the readerClass attribute of the ResultDoc object
 float getScore()
          Gets the score assigned to this ResultDoc by the Lucene engine.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResultDoc

public ResultDoc(ResultDocConfig conf,
                 int docNum,
                 float s)
Constructor for the ResultDoc that is used by the SimpleLuceneIndex class during search result hit list compilation.

Parameters:
docNum - The Lucene document number for the Document associated with this ResultDoc.
s - The rank assigned to this result by the Lucene search engine.

ResultDoc

public ResultDoc(Document doc)
Constructs a ResultDoc using the Document provided. Use this constructor to wrap a Document inside a ResultDoc.

Parameters:
doc - A Lucene Document used to populate this ResultDoc.
Method Detail

getDocReader

public final DocReader getDocReader()
Gets the DocReader used to read the specific Document type that is returned in a search.

Returns:
The docReader value
See Also:
DocReader

getDoctype

public final String getDoctype()
Gets the doctype for this ResultDoc. Assumes there is a stored field in the Lucene document named 'doctype' that contains the docytype name such as "dlese_ims" or "adn."

Returns:
The doctype value

getReaderClass

public final String getReaderClass()
Gets the readerClass attribute of the ResultDoc object

Returns:
The readerClass value

getDocument

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

Returns:
The Document associated with this ResultDoc.

getIndex

public final SimpleLuceneIndex getIndex()
Gets the index that was searched over.

Returns:
The index.

getQuery

public final String getQuery()

getScore

public final float getScore()
Gets the score assigned to this ResultDoc by the Lucene engine.

Returns:
The score.

compareTo

public final int compareTo(Object obj)
Compares two ResultDocs for sorting by score.

Specified by:
compareTo in interface Comparable
Parameters:
obj - A ResultDoc to compare with this one.
Returns:
Negative is less-than, positive if greater-than or zero if equal.

DLESE Tools
v1.2