public class DocHitImpl extends DocHit
Snippet
s
if those were requested.Modifier and Type | Field and Description |
---|---|
private int |
chunkCount
Total number of chunks for this document
|
private String |
docKey
Index key for this document
|
private Explanation |
explanation
Explanation of this document's score
|
private FieldSpans |
fieldSpans
Spans per field
|
private FieldSpanSource |
fieldSpanSource
Source of spans.
|
private long |
fileDate
Date the original source XML document was last modified
|
private AttribList |
metaData
Document's meta-data fields (copied from the docInfo chunk)
|
private int |
recordNum
Record number of this document within the main file
|
private SnippetMaker |
snippetMaker
Used to load and format snippets
|
private Snippet[] |
snippets
Array of pre-built snippets
|
private String |
subDocument
Record the subdocument within the main file, if any
|
Constructor and Description |
---|
DocHitImpl(int docNum,
float score)
Construct a document hit.
|
Modifier and Type | Method and Description |
---|---|
Explanation |
explanation()
Retrieve an explanation of this document's score
|
String |
filePath()
Retrieve the original file path as recorded in the index (if any.)
|
(package private) void |
finish(SnippetMaker snippetMaker,
float docScoreNorm)
Called after all hits have been gathered to normalize the scores and
associate a snippetMaker for later use.
|
(package private) void |
finishWithExplain(SnippetMaker snippetMaker,
float docScoreNorm,
Weight weight,
BoostSet boostSet,
BoostSetParams boostParams)
Called after all hits have been gathered to normalize the scores and
associate a snippetMaker for later use.
|
private void |
load()
Read in the document info chunk and record the path, date, etc. that
we find there.
|
private void |
loadMetaField(String name,
String value,
Document docContents,
AttribList metaData,
boolean isTokenized)
Performs all the manipulations and marking for a meta-data field.
|
AttribList |
metaData()
Retrieve a list of all meta-data name/value pairs associated with this
document.
|
int |
nSnippets()
Return the number of snippets available (limited by the max # specified
in the original query.)
|
int |
recordNum()
Retrieve the record number of this document within the main file, or
zero if this is the only record.
|
(package private) void |
setSpanSource(FieldSpanSource src)
Sets the source for spans (to perform deduplication)
|
Snippet |
snippet(int hitNum,
boolean getText)
Retrieve the specified snippet.
|
String |
subDocument()
Retrieve the subdocument name of this section within the main
file, if any.
|
Set |
textTerms()
Fetch a map that can be used to check whether a given term is present
in the original query that produced this hit.
|
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.)
|
private SnippetMaker snippetMaker
private FieldSpanSource fieldSpanSource
private FieldSpans fieldSpans
private Snippet[] snippets
private String docKey
private long fileDate
private int recordNum
private String subDocument
private int chunkCount
private AttribList metaData
private Explanation explanation
DocHitImpl(int docNum, float score)
docNum
- Lucene ID for the document info chunkscore
- Score for this hitvoid setSpanSource(FieldSpanSource src)
void finish(SnippetMaker snippetMaker, float docScoreNorm)
snippetMaker
- Will be used later by snippet() to actually
create the snippets.docScoreNorm
- Multiplied into the document's scorevoid finishWithExplain(SnippetMaker snippetMaker, float docScoreNorm, Weight weight, BoostSet boostSet, BoostSetParams boostParams) throws IOException
snippetMaker
- Will be used later by snippet() to actually
create the snippets.docScoreNorm
- Multiplied into the document's scoreweight
- The query weight that will be used to calculate
an explanation.boostSet
- The boost set used, or null if noneboostParams
- Other boost set parameters (e.g. exponent)IOException
private void load()
private void loadMetaField(String name, String value, Document docContents, AttribList metaData, boolean isTokenized)
name
- Name of the fieldvalue
- Raw string value of the fielddocContents
- Where to get spans frommetaData
- Where to put the resulting dataisTokenized
- true if the field was tokenized and should be
marked.public Set textTerms()
public final String filePath()
public final int recordNum()
public final String subDocument()
subDocument
in class DocHit
public final AttribList metaData()
public final int totalSnippets()
totalSnippets
in class DocHit
public final int nSnippets()
public final Snippet snippet(int hitNum, boolean getText)
public Explanation explanation()
explanation
in class DocHit