public class XtfDocNumMap extends Object implements DocNumMap
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
XtfDocNumMap(IndexReader reader,
int chunkSize,
int chunkOverlap)
Make a map for the given reader.
|
Modifier and Type | Method and Description |
---|---|
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.
|
private IndexReader reader
private int chunkSize
private int chunkOverlap
private int nDocs
private int[] docNums
private int prevNum
private int low
private int high
public XtfDocNumMap(IndexReader reader, int chunkSize, int chunkOverlap) throws IOException
IOException
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)
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.