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 class
MemoryDirectIndex.DirectIterator
Direct index iterator.class
MemoryDirectIndex.DocumentPostingList
-
Field Summary
Fields Modifier and Type Field Description protected DocumentIndex
doi
protected 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 void
add(int ptr, int termid, int freq)
Add posting to direct file.void
close()
IterablePosting
getPostings(int pointer)
IterablePosting
getPostings(Pointer pointer)
Returns the posting iterator given a pointer.PostingIndexInputStream
iterator()
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:PostingIndex
Returns the posting iterator given a pointer.- Specified by:
getPostings
in 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:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
iterator
public PostingIndexInputStream iterator()
Return an iterator over the inverted file.
-
-