org.cdlib.xtf.textEngine
Class DocHit

Object
  extended by ScoreDoc
      extended by FieldDoc
          extended by DocHit
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
DocHitImpl

public abstract class DocHit
extends FieldDoc

Represents a query hit at the document level. May contain Snippets if those were requested.

Author:
Martin Haye
See Also:
Serialized Form

Field Summary
 
Fields inherited from class FieldDoc
fields
 
Fields inherited from class ScoreDoc
doc, score
 
Constructor Summary
DocHit(int docNum, float score)
          Construct a document hit.
 
Method Summary
 Explanation explanation()
          Get an explanation of this document's score.
abstract  String filePath()
          Retrieve the original file path as recorded in the index (if any.)
abstract  AttribList metaData()
          Retrieve a list of all meta-data name/value pairs associated with this document.
abstract  int nSnippets()
          Return the number of snippets available (limited by the max # specified in the original query.)
abstract  int recordNum()
          Retrieve this document's record number within the main file, or zero if this is the only record.
abstract  Snippet snippet(int hitNum, boolean getText)
          Retrieve the specified snippet.
abstract  int totalSnippets()
          Return the total number of snippets found for this document (not the number actually returned, which is limited by the max # of snippets specified in the query.)
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocHit

DocHit(int docNum,
       float score)
Construct a document hit. Package-private because these should only be constructed inside the text engine.

Parameters:
docNum - Lucene ID for the document info chunk
score - Score for this hit
Method Detail

filePath

public abstract String filePath()
Retrieve the original file path as recorded in the index (if any.)


recordNum

public abstract int recordNum()
Retrieve this document's record number within the main file, or zero if this is the only record.


metaData

public abstract AttribList metaData()
Retrieve a list of all meta-data name/value pairs associated with this document.


totalSnippets

public abstract int totalSnippets()
Return the total number of snippets found for this document (not the number actually returned, which is limited by the max # of snippets specified in the query.)


nSnippets

public abstract int nSnippets()
Return the number of snippets available (limited by the max # specified in the original query.)


snippet

public abstract Snippet snippet(int hitNum,
                                boolean getText)
Retrieve the specified snippet. In general, crossQuery will set getText to 'true', while dynaXML may set it either way, depending on whether the document result formatter stylesheet references the <snippet> elements in the SearchTree. It's always safe, but not quite as efficient, to assume 'true'.

Parameters:
hitNum - 0..nSnippets()
getText - true to fetch the snippet text in context, false to optionally skip that work and only fetch the rank, score, etc.

explanation

public Explanation explanation()
Get an explanation of this document's score. Only available if requested at query time.