Package org.terrier.realtime.memory
Class MemoryDirectIndex
- java.lang.Object
-
- org.terrier.realtime.memory.MemoryDirectIndex
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,PostingIndex<MemoryPointer>
- Direct Known Subclasses:
MemoryFieldsDirectIndex
public class MemoryDirectIndex extends java.lang.Object implements PostingIndex<MemoryPointer>
This is a DirectIndex structure that is held fully in memory, it is based upon the MemoryInverted class. It does not currently support blocks or fields. In v5.2 it was updated to change the way that termids and frequencies were stored, such that we can generate an ordered list of termids. This means that it will take more memory (+50%) and- Since:
- 4.0
- Author:
- Richard McCreadie
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classMemoryDirectIndex.DirectIteratorDirect index iterator.classMemoryDirectIndex.DocumentPostingList
-
Field Summary
Fields Modifier and Type Field Description protected DocumentIndexdoiprotected gnu.trove.TIntObjectHashMap<MemoryDirectIndex.DocumentPostingList>postings
-
Constructor Summary
Constructors Constructor Description MemoryDirectIndex(DocumentIndex doi)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int ptr, int termid, int freq)Add posting to direct file.voidclose()IterablePostinggetPostings(int pointer)IterablePostinggetPostings(Pointer pointer)Returns the posting iterator given a pointer.PostingIndexInputStreamiterator()Return an iterator over the inverted file.
-
-
-
Field Detail
-
doi
protected DocumentIndex doi
-
postings
protected gnu.trove.TIntObjectHashMap<MemoryDirectIndex.DocumentPostingList> postings
-
-
Constructor Detail
-
MemoryDirectIndex
public MemoryDirectIndex(DocumentIndex doi)
Constructor.
-
-
Method Detail
-
add
public void add(int ptr, int termid, int freq)Add posting to direct file.
-
getPostings
public IterablePosting getPostings(Pointer pointer) throws java.io.IOException
Description copied from interface:PostingIndexReturns the posting iterator given a pointer.- Specified by:
getPostingsin interfacePostingIndex<MemoryPointer>- Returns:
- the posting iterator given a pointer.
- Throws:
java.io.IOException
-
getPostings
public IterablePosting getPostings(int pointer) throws java.io.IOException
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
iterator
public PostingIndexInputStream iterator()
Return an iterator over the inverted file.
-
-