com.sun.labs.minion.indexer.partition
Class CachedDocumentVectorLengths

java.lang.Object
  extended by com.sun.labs.minion.indexer.partition.DocumentVectorLengths
      extended by com.sun.labs.minion.indexer.partition.CachedDocumentVectorLengths

public class CachedDocumentVectorLengths
extends DocumentVectorLengths


Field Summary
 
Fields inherited from class com.sun.labs.minion.indexer.partition.DocumentVectorLengths
BUFF_SIZE, fieldLens, logTag, part, raf, vecLens, vlFile
 
Constructor Summary
CachedDocumentVectorLengths(DiskPartition part, boolean adjustStats)
           
 
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 com.sun.labs.minion.indexer.partition.DocumentVectorLengths
calculateLengths, close
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachedDocumentVectorLengths

public CachedDocumentVectorLengths(DiskPartition part,
                                   boolean adjustStats)
                            throws java.io.IOException
Throws:
java.io.IOException
Method Detail

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 normalize
scores - the document scores
p - the number of document IDs and scores in the array
qw - the query weight to use for normalization
fieldID - the ID of the field that the scores were computed from and that should be used for normalization.