|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.weborganic.bastille.flint.helpers.MultiSearchResults
public final class MultiSearchResults
A container for search results of a query ran on multiple indexes.
Use this class to serialise Lucene Search results as XML.
Note: the current implementation is a "throw away" object, once the toXML method has been called, this instance is useless.
Constructor Summary | |
---|---|
MultiSearchResults(SearchQuery query,
ScoreDoc[] hits,
int totalHits,
SearchPaging paging,
MultiSearcher searcher,
Map<IndexMaster,IndexSearcher> indexes)
Creates a new SearchResults. |
|
MultiSearchResults(SearchQuery query,
TopFieldDocs fielddocs,
SearchPaging paging,
MultiSearcher searcher,
Map<IndexMaster,IndexSearcher> indexes)
Creates a new SearchResults. |
Method Summary | |
---|---|
Document |
getDocument(int id)
Load a document from the index. |
SearchPaging |
getPaging()
|
ScoreDoc[] |
getScoreDoc()
Return the results. |
int |
getTotalNbOfResults()
Returns the total number of results. |
boolean |
isEmpty()
Indicates whether the search results are empty. |
void |
setTimeZone(int timezoneInMinutes)
Sets the time zone to use when formatting the results as XML. |
void |
terminate()
Release all references to all the searchers used. |
void |
toXML(XMLWriter xml)
Serialises the search results as XML. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MultiSearchResults(SearchQuery query, TopFieldDocs fielddocs, SearchPaging paging, MultiSearcher searcher, Map<IndexMaster,IndexSearcher> indexes) throws IOException, IndexException
fielddocs
- The actual search results from Lucene in TopFieldDocs.paging
- The paging configuration.io
- The IndexIO object, used to release the searcher when terminatedsearcher
- The Lucene searcher.
IndexException
- if the documents could not be retrieved from the Index
IOException
public MultiSearchResults(SearchQuery query, ScoreDoc[] hits, int totalHits, SearchPaging paging, MultiSearcher searcher, Map<IndexMaster,IndexSearcher> indexes) throws IndexException
hits
- The actual search results from Lucene in ScoreDoc.paging
- The paging configuration.io
- The IndexIO object, used to release the searcher when terminatedsearcher
- The Lucene searcher.
IndexException
- if the documents could not be retrieved from the IndexMethod Detail |
---|
public SearchPaging getPaging()
public int getTotalNbOfResults()
public boolean isEmpty()
true
if the results are empty;
false
if there is more than one hit.public void setTimeZone(int timezoneInMinutes)
timezoneInMinutes
- the timezone offset in minutes (difference with GMT)public void toXML(XMLWriter xml) throws IOException
toXML
in interface XMLWritable
xml
- The XML writer.
IOException
- Should there be any I/O exception while writing the XML.public ScoreDoc[] getScoreDoc() throws IndexException
IndexException
public Document getDocument(int id) throws IndexException
id
- the id of the document
IndexException
- if the index is invalidpublic void terminate() throws IndexException
IndexException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |