|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mycore.services.fieldquery.MCRHit
public class MCRHit
Represents a single result hit of a query. The hit has an ID which is the MCRObjectID of the document that matched the query. The hit may have MCRFieldValue objects set for sorting data or representing hit metadata like score or rank. If the same hit (hit with same ID) is in different result sets A and B, the data of the hit objects is merged. The hit sort data is copied from one of the hits that contains sort data. There is only on sort data set for each hit. The hit metadata of both hits is preserved and copied from both hits, so there can be multiple metadata sets from different searches for the same hit.
MCRResults| Field Summary | |
|---|---|
static String |
LOCAL
Identifies a hit that comes from the local server |
(package private) static Logger |
LOGGER
logger |
| Constructor Summary | |
|---|---|
MCRHit(String id)
Creates a new result hit with the given object ID |
|
| Method Summary | |
|---|---|
void |
addMetaData(MCRFieldValue value)
Adds hit metadata like score or rank |
void |
addSortData(MCRFieldValue fieldValue)
Adds data for sorting this hit |
Element |
buildXML()
Creates a XML representation of this hit and its sort data and meta data |
(package private) int |
compareTo(MCRFieldDef field,
MCRHit other)
Compares this hit with another hit by comparing the value of the given search field. |
String |
getHost()
Returns the alias of the host where this hit comes from |
String |
getID()
Returns the ID of the object that matched the query |
String |
getKey()
Returns a combination of ID and host alias to be used as key |
List<MCRFieldValue> |
getMetaData()
|
List<MCRFieldValue> |
getSortData()
|
(package private) boolean |
hasSortData()
Returns true if this MCRHit has any sort data added |
void |
merge(MCRHit other)
Merges the data of a MCRHit object with the same ID to the data of this MCRHit object. |
(package private) static MCRHit |
parseXML(Element xml,
String hostAlias)
Parses a XML representation of a hit and its sort data and meta data |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
static Logger LOGGER
public static final String LOCAL
| Constructor Detail |
|---|
public MCRHit(String id)
id - the ID of the object that matched the query| Method Detail |
|---|
public String getID()
public String getHost()
public String getKey()
public void addMetaData(MCRFieldValue value)
value - the value of the metadata fieldpublic void addSortData(MCRFieldValue fieldValue)
fieldValue - the value of a sortable search fieldboolean hasSortData()
public List<MCRFieldValue> getSortData()
public List<MCRFieldValue> getMetaData()
int compareTo(MCRFieldDef field,
MCRHit other)
field - the field to compareother - the other hit to compare with
MCRResults.sortBy(List)public void merge(MCRHit other)
other - the other hitpublic Element buildXML()
static MCRHit parseXML(Element xml,
String hostAlias)
xml - the XML elementhostAlias - the remote host alias
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||