degu.searcher.ejb
Class DeguHit

java.lang.Object
  extended by degu.searcher.ejb.DeguHit
All Implemented Interfaces:
java.io.Serializable

public class DeguHit
extends java.lang.Object
implements java.io.Serializable

Reimplements Lucene's Hit class (any references to Lucene's Hits are omitted). This is because Lucene's Hit class is not actually serializable, although it implements Serializable. This class must be serializable since it is supposed to get wired.

See Also:
Serialized Form

Field Summary
private  org.apache.lucene.document.Document doc
           
private  java.lang.String[] hitContext
           
private  int hitId
           
private  int hitNumber
           
private  float score
           
 
Constructor Summary
DeguHit(org.apache.lucene.document.Document luceneDoc, int hitId, int hitNumber, float score, java.lang.String[] hitContext)
          ctor
 
Method Summary
 java.lang.String get(java.lang.String name)
          Returns the string value of the field with the given name if any exist in this document, or null.
 float getBoost()
          Returns the boost factor for this hit on any field of the underlying document.
 org.apache.lucene.document.Document getDocument()
          Returns document for this hit.
 java.lang.String getHitContext(int nr)
          Returns the nr-th highlighted context
 java.lang.String[] getHitContexts()
          Returns the highlighted contexts if any available or null
 int getHitId()
           
 int getHitNumber()
           
 int getIntScore()
          Yet another score representation.
 int getScaledIntScore()
          Yet another relevance measure.
 float getScore()
          Returns score for this hit.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

doc

private org.apache.lucene.document.Document doc

hitNumber

private int hitNumber

hitId

private int hitId

score

private float score

hitContext

private java.lang.String[] hitContext
Constructor Detail

DeguHit

public DeguHit(org.apache.lucene.document.Document luceneDoc,
               int hitId,
               int hitNumber,
               float score,
               java.lang.String[] hitContext)
ctor

Parameters:
luceneDoc - Lucene Document
hitId - the hit id, typically obtained from hits.id(hitNumber);
hitNumber - the hit number
score - score of this hit, typically obtained from hits.score(hitNumber);
hitContext - highlighted context of this hit
Method Detail

getHitContexts

public java.lang.String[] getHitContexts()
Returns the highlighted contexts if any available or null

Returns:

getHitContext

public java.lang.String getHitContext(int nr)
Returns the nr-th highlighted context

Parameters:
nr -
Returns:

getDocument

public org.apache.lucene.document.Document getDocument()
                                                throws java.io.IOException
Returns document for this hit.

Throws:
java.io.IOException
See Also:
Hits.doc(int)

getScore

public float getScore()
               throws java.io.IOException
Returns score for this hit.

Throws:
java.io.IOException
See Also:
Hits.score(int)

getBoost

public float getBoost()
               throws java.io.IOException
Returns the boost factor for this hit on any field of the underlying document.

Throws:
java.io.IOException
See Also:
Document.getBoost()

get

public java.lang.String get(java.lang.String name)
                     throws java.io.IOException
Returns the string value of the field with the given name if any exist in this document, or null. If multiple fields exist with this name, this method returns the first value added. If only binary fields with this name exist, returns null.

Throws:
java.io.IOException
See Also:
Document.get(String)

getHitId

public int getHitId()

getHitNumber

public int getHitNumber()

getIntScore

public int getIntScore()
Yet another score representation. The float value of getScore() is simply mapped to an integer value, which ranges from 1 to 10

Returns:

getScaledIntScore

public int getScaledIntScore()
Yet another relevance measure. 0.9 .. 1.0 of the original score value is mapped to 1..5. Everything below 0.9 is just 1.

Returns: