org.terrier.structures
Class DirectIndexInputStream

java.lang.Object
  extended by org.terrier.structures.BitPostingIndexInputStream
      extended by org.terrier.structures.DirectIndexInputStream
All Implemented Interfaces:
java.io.Closeable, java.util.Iterator<IterablePosting>, PostingIndexInputStream, Skipable
Direct Known Subclasses:
BlockDirectIndexInputStream

public class DirectIndexInputStream
extends BitPostingIndexInputStream

This class reads the direct index structure, sequentially, as an input stream.

Author:
Douglas Johnson, Vassilis Plachouras, Craig Macdonald
See Also:
DirectIndex

Field Summary
 
Fields inherited from class org.terrier.structures.BitPostingIndexInputStream
currentEntryCount, currentFile, currentPointer, doi, entriesSkipped, fieldCount, file, fileCount, index, logger, pointerList, postingConstructor, postingIteratorClass, structureName
 
Constructor Summary
  DirectIndexInputStream(Index index, java.lang.String structureName)
          Constructs an instance of the class with
  DirectIndexInputStream(Index index, java.lang.String structureName, java.lang.Class<? extends IterablePosting> postingIterator)
          Constructs an instance of the class with
protected DirectIndexInputStream(Index _index, java.lang.String structureName, java.util.Iterator<? extends BitIndexPointer> _pointerList, java.lang.Class<? extends IterablePosting> _postingIteratorClass)
           
 
Method Summary
protected  DocumentIndex getDocumentIndex(BitIndexPointer pointer)
           
 int[][] getNextTerms()
          One call returns all the data for one document - [0][] is term ids, [1][] is frequency, [2][] is fields.
 int[][] getNextTerms(BitIndexPointer pointer)
          Get the terms for the next document at the pointer specified
 
Methods inherited from class org.terrier.structures.BitPostingIndexInputStream
_next, close, getCurrentPointer, getEntriesSkipped, getFilename, getFilename, getNextPostings, getNumberOfCurrentPostings, getPos, hasNext, loadPostingIterator, next, print, remove, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirectIndexInputStream

protected DirectIndexInputStream(Index _index,
                                 java.lang.String structureName,
                                 java.util.Iterator<? extends BitIndexPointer> _pointerList,
                                 java.lang.Class<? extends IterablePosting> _postingIteratorClass)
                          throws java.io.IOException
Throws:
java.io.IOException

DirectIndexInputStream

public DirectIndexInputStream(Index index,
                              java.lang.String structureName,
                              java.lang.Class<? extends IterablePosting> postingIterator)
                       throws java.io.IOException
Constructs an instance of the class with

Parameters:
index -
structureName -
postingIterator -
Throws:
java.io.IOException

DirectIndexInputStream

public DirectIndexInputStream(Index index,
                              java.lang.String structureName)
                       throws java.io.IOException
Constructs an instance of the class with

Parameters:
index -
structureName -
Throws:
java.io.IOException
Method Detail

getNextTerms

public int[][] getNextTerms()
                     throws java.io.IOException
One call returns all the data for one document - [0][] is term ids, [1][] is frequency, [2][] is fields. The size of [0,1,2][] is how many unique terms occur in each document. Between calls, use getDocumentsSkipped() to keep track of what docid you're currently processing.

Returns:
int[][] the two dimensional array containing the term ids, fields
Throws:
java.io.IOException - if an I/O error occurs

getNextTerms

public int[][] getNextTerms(BitIndexPointer pointer)
                     throws java.io.IOException
Get the terms for the next document at the pointer specified

Throws:
java.io.IOException

getDocumentIndex

protected DocumentIndex getDocumentIndex(BitIndexPointer pointer)
Overrides:
getDocumentIndex in class BitPostingIndexInputStream


Terrier 3.5. Copyright © 2004-2011 University of Glasgow