|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mycore.services.fieldquery.MCRResults
public class MCRResults
This class represents the results of a query performed by MCRSearcher. Searchers add the hits using the addHit() method. Clients can get the hits, sort the entries and do merge/and/or operations on two different result sets. Searches may add the same hit (hit with the same ID) more than once. If the hit already is contained in the result set, the data of both objects is merged.
MCRHit| Field Summary | |
|---|---|
protected ArrayList<MCRHit> |
hits
The list of MCRHit objects |
protected HashMap<String,MCRHit> |
map
A map containing MCRHit IDs used for and/or operations on two different MCRResult objects |
| Constructor Summary | |
|---|---|
MCRResults()
Creates a new, empty MCRResults. |
|
| Method Summary | |
|---|---|
void |
addHit(MCRHit hit)
Adds a hit. |
Element |
buildXML()
Returns a XML element containing all hits and their data |
Element |
buildXML(int min,
int max)
Returns a XML element containing hits and their data |
void |
cutResults(int maxResults)
Cuts the result list to the given maximum size, if more hits are present. |
MCRHit |
getHit(int i)
Gets a single MCRHit. |
protected MCRHit |
getHit(String key)
Returns the MCRHit with the given key, if it is in this results. |
String |
getID()
Returns the unique ID of this result set |
int |
getNumHits()
Returns the number of hits currently in this results |
static MCRResults |
intersect(MCRResults... others)
Does a logical and of this results hits and other results hits. |
boolean |
isReadonly()
returns false if addHit(MCRHit) and merge(Document, String) are safe operations. |
boolean |
isSorted()
Returns true if this result list is currently sorted |
Iterator<MCRHit> |
iterator()
|
protected int |
merge(Document doc,
String hostAlias)
Merges the hits from a remote query to this results |
void |
setHostConnection(String host,
String msg)
Set the state of the connection of a host alias. |
void |
setSorted(boolean value)
The searcher must set this to true, if the hits already have been added in sorted order. |
void |
sortBy(List<MCRSortBy> sortByList)
Sorts this results by the given sort criteria. |
String |
toString()
|
static MCRResults |
union(MCRResults... others)
Adds all hits of another result list that are not yet in this result list. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected ArrayList<MCRHit> hits
protected HashMap<String,MCRHit> map
| Constructor Detail |
|---|
public MCRResults()
| Method Detail |
|---|
public String getID()
public void addHit(MCRHit hit)
hit - the MCRHit to addpublic MCRHit getHit(int i)
i - the position of the hit.
protected MCRHit getHit(String key)
key - the key of the hit
public int getNumHits()
public void cutResults(int maxResults)
maxResults - the number of results to be leftpublic void setSorted(boolean value)
value - true, if sorted, false otherwisepublic boolean isSorted()
public void sortBy(List<MCRSortBy> sortByList)
sortByList - a List of MCRSortBy objects
public Element buildXML(int min,
int max)
min - the position of the first hit to include in outputmax - the position of the last hit to include in output
public Element buildXML()
protected int merge(Document doc,
String hostAlias)
doc - the results from the remote query as XML documenthostAlias - the alias of the host where the hits come from
public String toString()
toString in class Objectpublic static MCRResults intersect(MCRResults... others)
other - the other result listspublic static MCRResults union(MCRResults... others)
other - the other result listspublic Iterator<MCRHit> iterator()
iterator in interface Iterable<MCRHit>
public void setHostConnection(String host,
String msg)
host - the host aliasmsg - the exception message of the connection or an empty stringpublic boolean isReadonly()
addHit(MCRHit) and merge(Document, String) are safe operations.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||