public abstract class DocReader
extends java.lang.Object
Document
s
that are returned from a search. All concrete DocReader classes must implement a default no-argument
constructor so that they may be created automatically by the factory ResultDoc.getDocReader()
. In addition, the index writer corresponding to the concrete
reader must implement the DocWriter.getReaderClass()
method.SimpleLuceneIndex
,
ResultDoc
Modifier and Type | Field and Description |
---|---|
protected ResultDocConfig |
conf
The index that was searched over.
|
protected org.apache.lucene.document.Document |
doc
The Lucene Document that is being read.
|
protected ResultDoc |
resultDoc |
protected float |
score
The Lucene score assigned to the Document, or -1 if none available.
|
Modifier | Constructor and Description |
---|---|
protected |
DocReader()
Constructor that initializes an empty DocReader.
|
protected |
DocReader(org.apache.lucene.document.Document myDoc)
Constructor that may be used programatically to wrap a reader around a Lucene
Document that was created by a DocWriter . |
Modifier and Type | Method and Description |
---|---|
void |
doInit(org.apache.lucene.document.Document myDoc,
ResultDoc resultDoc,
float myScore,
ResultDocConfig myConf)
Called by
ResultDoc at search time to initialize a new instance of a
DocReader. |
java.lang.Object |
getAttribute(java.lang.String key)
Gets an attribute that has been previously set using
SimpleLuceneIndex.setAttribute(String,Object) . |
DocumentMap |
getDocMap()
Gets a
DocumentMap of all field/values contained in the Lucene Document . |
org.apache.lucene.document.Document |
getDocument()
Gets the Lucene
Document associated with this DocReader. |
SimpleLuceneIndex |
getIndex()
Gets the index that was searched over to produce the resulting hit.
|
LazyDocumentMap |
getLazyDocMap()
Gets a
LazyDocumentMap of all field/values contained in the Lucene Document . |
java.lang.String |
getQuery()
Gets the query that was used in the search.
|
abstract java.lang.String |
getReaderType()
Gets a String describing the reader type.
|
RepositoryManager |
getRepositoryManager()
Gets the RepositoryManager associated with this DocReader or null if not available.
|
java.lang.String |
getScore()
Gets the Lucene score for the
Document , or -1 if none available. |
abstract void |
init()
An init method that may be used by concrete classes to initialize variables and resources as needed.
|
protected void |
setDoc(org.apache.lucene.document.Document myDoc)
Sets the Lucene Document that is being read by this DocReader.
|
protected org.apache.lucene.document.Document doc
protected float score
protected ResultDocConfig conf
protected ResultDoc resultDoc
protected DocReader(org.apache.lucene.document.Document myDoc)
Document
that was created by a DocWriter
.myDoc
- Gets the Lucene Document that is being read by this DocReader.DocWriter
protected DocReader()
public abstract java.lang.String getReaderType()
public abstract void init()
public final void doInit(org.apache.lucene.document.Document myDoc, ResultDoc resultDoc, float myScore, ResultDocConfig myConf)
ResultDoc
at search time to initialize a new instance of a
DocReader.myDoc
- The Lucene DocumentmyScore
- The Lucene score asigned to this hitmyConf
- The config available to the doc readerpublic DocumentMap getDocMap()
DocumentMap
of all field/values contained in the Lucene Document
. The text values in each field is stored in the Map as Strings. For
example getDocMap.get("title") returns the text that was indexed and stored under the field name "title"
for this Document.Example that uses JSTL inside a JSP page (assumes result is an instance of ResultDoc):
The title is: ${result.docMap["title"]}
DocumentMap
public LazyDocumentMap getLazyDocMap()
LazyDocumentMap
of all field/values contained in the Lucene Document
. The text values in each field is stored in the Map as Strings. For
example getDocMap.get("title") returns the text that was indexed and stored under the field name "title"
for this Document.Example that uses JSTL inside a JSP page (assumes result is an instance of ResultDoc):
The title is: ${result.docMap["title"]}
DocumentMap
protected void setDoc(org.apache.lucene.document.Document myDoc)
myDoc
- The new doc valuepublic java.lang.String getScore()
Document
, or -1 if none available.public org.apache.lucene.document.Document getDocument()
Document
associated with this DocReader.Document
.public SimpleLuceneIndex getIndex()
public java.lang.Object getAttribute(java.lang.String key)
SimpleLuceneIndex.setAttribute(String,Object)
.key
- The key for the attributeSimpleLuceneIndex.setAttribute(String,Object)
public RepositoryManager getRepositoryManager()
public java.lang.String getQuery()