|
DLESE Tools v1.6.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.dlese.dpc.index.ResultDoc
public class ResultDoc
A factory container for a hit that is returned from a SimpleLuceneIndex
search. This factory uses the class name provided in the DocWriter.getReaderClass()
method to return the DocReader
bean that is best suited to read the type of index Document
that was returned by the search. Also provides access to a DocumentMap
for reading the fields in the lucene Document. This container also
provides acces to the Document
, the score rank and the document number.
Example that uses JSTL inside a JSP page (assumes result is an instance of ResultDoc and that the DocReader has a method named getFormattedDate()):
The title is: ${result.docMap["title"]}.
The date is: ${result.docReader.formattedDate}.
SimpleLuceneIndex
,
DocReader
,
DocumentMap
,
Serialized FormConstructor Summary | |
---|---|
ResultDoc(org.apache.lucene.document.Document doc)
Constructs a ResultDoc using the Document provided. |
|
ResultDoc(org.apache.lucene.document.Document d,
ResultDocConfig c)
Constructor for the ResultDoc that is used by the SimpleLuceneIndex class
during search result hit list compilation to create a ResultDocCollection . |
|
ResultDoc(ResultDocConfig c,
int dn,
float s)
Constructor for the ResultDoc that is used by the SimpleLuceneIndex class
during search result hit list compilation to create a ResultDocCollection . |
Method Summary | |
---|---|
int |
compareTo(Object obj)
Compares two ResultDocs for sorting by score. |
Object |
getAttribute(String key)
Gets an attribute that has been previously set using SimpleLuceneIndex.setAttribute(String,Object) . |
String |
getComparatorField(String field)
Deprecated. Sorting should now be done by supplying a Sort object at
search time. Sorting on returned ResultDocs is less efficient and may cause OutOfMemory errors on large
result sets. |
static String |
getDateStamp()
Gets a datestamp of the current time formatted for display with logs and output. |
DocumentMap |
getDocMap()
Gets a DocumentMap of all field/values contained in the Lucene Document . |
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. |
org.apache.lucene.document.Document |
getDocument()
Gets the Lucene Document associated with this ResultDoc. |
SimpleLuceneIndex |
getIndex()
Gets the index that was searched over. |
LazyDocumentMap |
getLazyDocMap()
Gets a LazyDocumentMap of all field/values contained in the Lucene
Document . |
String |
getQuery()
Gets the query that was used in the search. |
String |
getReaderClass()
Gets the readerClass attribute of the ResultDoc object |
float |
getScore()
Gets the score assigned to this ResultDoc by the Lucene engine. |
static void |
setDebug(boolean db)
Sets the debug attribute of the SimpleLuceneIndex object |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ResultDoc(ResultDocConfig c, int dn, float s)
SimpleLuceneIndex
class
during search result hit list compilation to create a ResultDocCollection
.
c
- The configuration for this ResultDocdn
- The Lucene document number for the Document
associated with
this ResultDoc.s
- The rank assigned to this result by the Lucene search engine.public ResultDoc(org.apache.lucene.document.Document d, ResultDocConfig c)
SimpleLuceneIndex
class
during search result hit list compilation to create a ResultDocCollection
.
d
- A Lucene Document
used to populate this ResultDoc.c
- The configuration for this ResultDocpublic ResultDoc(org.apache.lucene.document.Document doc)
Document
provided. Use this
constructor to wrap a Document
inside a ResultDoc.
doc
- A Lucene Document
used to populate this ResultDoc.Method Detail |
---|
public final DocReader getDocReader()
DocReader
used to read the specific Document
type that is returned in a search. Remember that all concrete
DocReader classes must have a default constructor with no arguments.
DocReader
public 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
public final String getDoctype()
public final String getReaderClass()
public final org.apache.lucene.document.Document getDocument()
Document
associated with this ResultDoc. If the index
has changed since the search was conducted, this method may return an empty or incorrect Document. It is
therefore best to read all Documents as soon as possible after a search if the index is being
concurrently modified.
Document
associated with this ResultDoc.public final String getComparatorField(String field)
Sort
object at
search time. Sorting on returned ResultDocs is less efficient and may cause OutOfMemory errors on large
result sets.
LuceneFieldComparator
for sorting. Note that it is not possible to
re-sort a single set of ResultDocs. To re-sort, first do a fresh search, then a fresh sort over the new
ResultDocs using the differnt field.
field
- The field name used for sorting
LuceneFieldComparator
public final SimpleLuceneIndex getIndex()
public Object getAttribute(String key)
SimpleLuceneIndex.setAttribute(String,Object)
.
key
- The key for the attribute
SimpleLuceneIndex.setAttribute(String,Object)
public final String getQuery()
public final float getScore()
public final int compareTo(Object obj)
compareTo
in interface Comparable
obj
- A ResultDoc to compare with this one.
public static final String getDateStamp()
public static void setDebug(boolean db)
db
- The new debug value
|
DLESE Tools v1.6.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |