org.egothor.core.query
Class Hit

java.lang.Object
  extended by org.egothor.core.Hit
      extended by org.egothor.core.query.Hit

public class Hit
extends Hit

The Hit class represents a document returned as a result of a query. Because there is no need to retrieve metadata of a document when the hit is not judged as a hit by the hit list generated (a document may be a hit, but the ResultList may not allow it in, either because it is full, or the similarity is too low), a strategy of metadata on request is implemented.

Author:
Leo Galambos

Field Summary
 Barrel barrel
          The Barrel containing this Hit.
 long uid
          The unique ID of the document that is a Hit in a barrel.
 
Fields inherited from class org.egothor.core.Hit
sim
 
Constructor Summary
Hit(Hit hit)
          Constructor for the Hit object
Hit(long uid, Barrel barrel, int sim)
          Constructor for the Hit object.
 
Method Summary
protected  void fastCloneTo(Hit h)
          Prepare a new copy of this object without calling new method.
 DocumentData getMeta()
          Return the metadata of the document that constitutes this Hit.
 boolean lessThan(Hit with)
          Compare this Hit with the given Hit.
 
Methods inherited from class org.egothor.core.Hit
setMeta
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

uid

public transient long uid
The unique ID of the document that is a Hit in a barrel.


barrel

public transient Barrel barrel
The Barrel containing this Hit.

Constructor Detail

Hit

public Hit(long uid,
           Barrel barrel,
           int sim)
Constructor for the Hit object.

Parameters:
uid - the unique ID of the hit document
barrel - the Barrel containing the document
sim - the calculated similarity of the hit

Hit

public Hit(Hit hit)
Constructor for the Hit object

Parameters:
hit - Description of the Parameter
Method Detail

getMeta

public DocumentData getMeta()
Return the metadata of the document that constitutes this Hit.

Overrides:
getMeta in class Hit
Returns:
the metadata of the document

lessThan

public boolean lessThan(Hit with)
Compare this Hit with the given Hit. The ordering key is a similarity value.

Parameters:
with - the Hit to compare with this one
Returns:
-1, if the similarity of this Hit is less than that of the supplied Hit, 0 if the similarities are the same, or 1 if the similarity of this Hit is greater than that of the supplied Hit, or if the supplied Object is null

fastCloneTo

protected void fastCloneTo(Hit h)
Prepare a new copy of this object without calling new method.

Parameters:
h - the new Hit object