|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectXtfDocNumMap
public class XtfDocNumMap
Used to map chunk indexes to the corresponding document index, and vice-versa. Only performs the load when necessary (typically dynaXML uses the DocNumMap, while crossQuery doesn't.)
Field Summary | |
---|---|
private int |
chunkOverlap
Number of words one chunk overlaps with the next |
private int |
chunkSize
Max number of words in a chunk |
private int[] |
docNums
Array of indexes, one for each docInfo chunk |
private int |
high
Used in binary searching |
private int |
low
Used in binary searching |
private int |
nDocs
Total number of docInfo chunks found |
private int |
prevNum
Caches result of previous scan, used for speed |
private IndexReader |
reader
Where to get the data from |
Constructor Summary | |
---|---|
XtfDocNumMap(IndexReader reader,
int chunkSize,
int chunkOverlap)
Make a map for the given reader. |
Method Summary | |
---|---|
int |
getChunkOverlap()
Get the number of words one chunk overlaps with the next |
int |
getChunkSize()
Get the max number of words per chunk |
int |
getDocCount()
Return a count of the number of documents (not chunks) in the index. |
int |
getDocNum(int chunkNumber)
Given a chunk number, return the corresponding document number that it is part of. |
int |
getFirstChunk(int docNum)
Given a document number, this method returns the number of its first chunk. |
int |
getLastChunk(int docNum)
Given a document number, this method returns the number of its last chunk. |
private void |
load()
|
private void |
scan(int num)
Perform a binary search looking for the given number. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private IndexReader reader
private int chunkSize
private int chunkOverlap
private int nDocs
private int[] docNums
private int prevNum
private int low
private int high
Constructor Detail |
---|
public XtfDocNumMap(IndexReader reader, int chunkSize, int chunkOverlap) throws IOException
IOException
Method Detail |
---|
private void load()
public int getChunkSize()
getChunkSize
in interface DocNumMap
public int getChunkOverlap()
getChunkOverlap
in interface DocNumMap
public final int getDocCount()
getDocCount
in interface DocNumMap
public final int getDocNum(int chunkNumber)
getDocNum
in interface DocNumMap
chunkNumber
- Chunk number to translate
public final int getFirstChunk(int docNum)
getFirstChunk
in interface DocNumMap
public final int getLastChunk(int docNum)
getLastChunk
in interface DocNumMap
private void scan(int num)
num
- The number to look for.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |