com.sun.labs.minion.indexer.partition
Class CachedDocumentVectorLengths
java.lang.Object
com.sun.labs.minion.indexer.partition.DocumentVectorLengths
com.sun.labs.minion.indexer.partition.CachedDocumentVectorLengths
public class CachedDocumentVectorLengths
- extends DocumentVectorLengths
|
Method Summary |
float |
getVectorLength(int docID)
Gets the length of a document associated with this partition. |
float |
getVectorLength(int docID,
int fieldID)
Gets the length of a document associated with this partition. |
void |
normalize(int[] docs,
float[] scores,
int p,
float qw,
int fieldID)
Normalizes a set of document scores all in one go. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CachedDocumentVectorLengths
public CachedDocumentVectorLengths(DiskPartition part,
boolean adjustStats)
throws java.io.IOException
- Throws:
java.io.IOException
getVectorLength
public float getVectorLength(int docID)
- Description copied from class:
DocumentVectorLengths
- Gets the length of a document associated with this partition. This
will be used at query and classification time. Note that our buffer
uses 0 based indexing, so we need to subtract one from the document
ID!
- Overrides:
getVectorLength in class DocumentVectorLengths
- Parameters:
docID - the ID of the document whose vector length we wish to
retrieve.
- Returns:
- the vector length of the document with the given ID
getVectorLength
public float getVectorLength(int docID,
int fieldID)
- Description copied from class:
DocumentVectorLengths
- Gets the length of a document associated with this partition. This
will be used at query and classification time. Note that our buffer
uses 0 based indexing, so we need to subtract one from the document
ID!
- Overrides:
getVectorLength in class DocumentVectorLengths
- Parameters:
docID - the ID of the document whose vector length we wish to
retrieve.fieldID - the ID of the field for which we're looking for the length.
A field ID of -1 is interpreted as a request for the length using all
vectored fields. If this field was not vectored, then a length of 1 is returned, so that
dividing weights by document lengths won't cause problems.
- Returns:
- the length of the vector for the given ID and vectored field
normalize
public void normalize(int[] docs,
float[] scores,
int p,
float qw,
int fieldID)
- Normalizes a set of document scores all in one go.
- Overrides:
normalize in class DocumentVectorLengths
- Parameters:
docs - the document IDs to normalizescores - the document scoresp - the number of document IDs and scores in the arrayqw - the query weight to use for normalizationfieldID - the ID of the field that the scores were computed from and that
should be used for normalization.