|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectBoostSet
public class BoostSet
Holds a set of boost factors to apply to individual documents in the document set.
Nested Class Summary | |
---|---|
private class |
BoostSet.DocIter
Iterates all the document keys in an index |
private class |
BoostSet.LineIter
Iterates all the lines in a boost file |
Field Summary | |
---|---|
private float[] |
boostByDoc
Set of boost values, one per document ID |
private static WeakHashMap |
cache
Cached data. |
private static float |
DEFAULT_MARKER
Marker for the default value |
private String |
field
Field to find document keys in |
private int |
nWarnings
Number of warnings emitted so far. |
Constructor Summary | |
---|---|
private |
BoostSet(IndexReader indexReader,
File inFile,
String field)
Do not construct directly; use getCachedSet(IndexReader, File, String)
instead. |
Method Summary | |
---|---|
float |
getBoost(int docId,
float defaultBoost)
Get the boost factor associated with the given document, or the default boost value if not found. |
static BoostSet |
getCachedSet(IndexReader indexReader,
File inFile,
String field)
Retrieves BoostSet for a given File from a given reader. |
private void |
warn(String msg)
If less than 10 warnings have been emitted, we print this one out. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static WeakHashMap cache
private String field
private int nWarnings
private float[] boostByDoc
private static float DEFAULT_MARKER
Constructor Detail |
---|
private BoostSet(IndexReader indexReader, File inFile, String field) throws IOException
getCachedSet(IndexReader, File, String)
instead. Constructs a BoostSet by reading a file containing document
key -> boost factor mappings, and correlating it with the keys in the
given index reader.
IOException
Method Detail |
---|
public static BoostSet getCachedSet(IndexReader indexReader, File inFile, String field) throws IOException
indexReader
- Index to correlate the data toinFile
- Which file to readfield
- Field used to key boost values
IOException
public final float getBoost(int docId, float defaultBoost)
docId
- Document ID to look updefaultBoost
- What to return if not found
private void warn(String msg)
msg
- The message to emit
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |