|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.labs.minion.indexer.postings.IDPostings
public class IDPostings
A postings class for ID only postings. These will be used for things like the bigram tables used for wildcard expansion and for saved field values.
The structure of the encoded data is as follows:
| Nested Class Summary | |
|---|---|
class |
IDPostings.IDIterator
|
| Field Summary | |
|---|---|
protected int |
curr
The ID we're collecting the frequency for. |
protected int |
dataStart
The position in the compressed representation where the data starts. |
protected int[] |
ids
The uncompressed postings. |
protected int |
lastID
The last ID in this postings list. |
protected static MinionLog |
log
|
protected static java.lang.String |
logTag
|
protected int |
nIDs
The number of IDs in the postings. |
protected int |
nSkips
The number of skips in the skip table. |
protected Buffer |
post
The compressed postings. |
protected int |
prevID
The previous ID encountered during indexing. |
protected int[] |
skipID
The IDs in the skip table. |
protected int[] |
skipPos
The positions in the skip table. |
protected int |
skipSize
The number of documents in a skip. |
| Constructor Summary | |
|---|---|
IDPostings()
Makes a postings entry that is useful during indexing. |
|
IDPostings(ReadableBuffer b)
Makes a postings entry that is useful during querying. |
|
IDPostings(ReadableBuffer b,
int offset,
int size)
Makes a postings entry that is useful during querying. |
|
| Method Summary | |
|---|---|
void |
add(Occurrence o)
Adds an occurrence to the postings list. |
protected void |
addSkip(int id,
int pos)
Adds a skip to the skip table. |
void |
append(Postings p,
int start)
Appends another set of postings to this one. |
void |
append(Postings p,
int start,
int[] idMap)
Appends another set of postings to this one, removing any data associated with deleted documents. |
protected int |
encode(int id)
Encodes the data for a single ID. |
void |
finish()
Finishes off the encoding by adding any data that we collected for the last document. |
WriteableBuffer[] |
getBuffers()
Gets a number of WriteableBuffers whose contents
represent the postings. |
int |
getLastID()
Gets the last ID in the postings list. |
int |
getMaxFDT()
Gets the maximum frequency in the postings associated with this entry. |
int |
getN()
Gets the number of IDs in the postings list. |
int |
getTotalOccurrences()
Gets the total number of occurrences in this postings list, which is always the number of postings, since we don't encode any frequencies. |
PostingsIterator |
iterator(PostingsIteratorFeatures features)
Gets an iterator for the postings. |
void |
merge(MergeablePostings mp,
int[] map)
Merges another set of postings with this set of postings. |
protected void |
recodeID(int currID,
int prevID,
PostingsIterator pi)
Re-encodes the data from another postings onto this one. |
void |
remap(int[] idMap)
Remaps the IDs in this postings list according to the given old-to-new ID map. |
void |
setSkipSize(int size)
Sets the skip size. |
int |
size()
Gets the size of the postings, in bytes. |
protected void |
skip(ReadableBuffer b)
Skips a set of postings from another postings entry. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Buffer post
protected int[] ids
protected int curr
protected int prevID
protected int nIDs
protected int lastID
protected int[] skipID
protected int[] skipPos
protected int nSkips
protected int dataStart
protected int skipSize
protected static MinionLog log
protected static java.lang.String logTag
| Constructor Detail |
|---|
public IDPostings()
public IDPostings(ReadableBuffer b)
b - the data read from a postings file.
public IDPostings(ReadableBuffer b,
int offset,
int size)
b - The buffer containing the postings.offset - The offset in the buffer where our postings data
starts.size - The size of the data in our postings.| Method Detail |
|---|
protected void addSkip(int id,
int pos)
id - The ID that the skip is pointing to.pos - The position in the postings to skip to.protected int encode(int id)
public void setSkipSize(int size)
setSkipSize in interface Postingspublic void add(Occurrence o)
add in interface Postingso - The occurrence.public int getN()
Postings
getN in interface Postingspublic int getLastID()
Postings
getLastID in interface Postingspublic int getMaxFDT()
getMaxFDT in interface Postingspublic int getTotalOccurrences()
getTotalOccurrences in interface Postingspublic void finish()
finish in interface Postingspublic int size()
size in interface Postingspublic WriteableBuffer[] getBuffers()
WriteableBuffers whose contents
represent the postings. These buffers can then be written out.
The format is as follows:
NumIDs:LastID:NumSkipEntries[:skipID:skipPos]*:
getBuffers in interface PostingsByteBuffer containing the encoded postings
data.public void remap(int[] idMap)
This is tricky, because we can't assume that the remapped IDs will maintain the order of the IDs, even if the IDs have changed. Thus, we need to uncompres all of the IDs and then put them back together.
remap in interface PostingsidMap - A map from the IDs currently in use in the postings to
new IDs.
public void append(Postings p,
int start)
append in interface Postingsp - The postings to append. Implementers can safely assume
that the postings being passed in are of the same class as the
implementing class.start - The new starting document ID for the partition
that the entry was drawn from.
protected void recodeID(int currID,
int prevID,
PostingsIterator pi)
currID - The current IDprevID - The previous ID.pi - An iterator for the other postings list.protected void skip(ReadableBuffer b)
public void append(Postings p,
int start,
int[] idMap)
append in interface Postingsp - The postings to append. Implementers can safely assume
that the postings being passed in are of the same class as the
implementing class.start - The new starting document ID for the partition
that the entry was drawn from.idMap - A map from old IDs in the given postings to new IDs
with gaps removed for deleted data. If this is null, then there are
no deleted documents.
public void merge(MergeablePostings mp,
int[] map)
MergeablePostings
merge in interface MergeablePostingsmp - the postings to merge into these postings.map - a map from IDs in the postings to IDs in the merged space.public PostingsIterator iterator(PostingsIteratorFeatures features)
iterator in interface Postingsfeatures - A set of features that the iterator must support.
null will be returned.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||