org.terrier.structures
Class DirectIndex

java.lang.Object
  extended by org.terrier.structures.BitPostingIndex
      extended by org.terrier.structures.DirectIndex
All Implemented Interfaces:
java.io.Closeable, PostingIndex<BitIndexPointer>
Direct Known Subclasses:
BlockDirectIndex

public class DirectIndex
extends BitPostingIndex

A class that implements the direct index and saves information about whether a term appears in one of the specified fields.

Author:
Douglas Johnson, Vassilis Plachouras, Craig Macdonald

Field Summary
protected  DocumentIndex docIndex
          The document index employed for retrieving the document offsets.
protected static org.apache.log4j.Logger logger
          The logger used for the Lexicon
 
Fields inherited from class org.terrier.structures.BitPostingIndex
fieldCount, file, index, postingConstructor, postingImplementation
 
Constructor Summary
DirectIndex(Index index, java.lang.String structureName)
          Constructs an instance of the class with the given index, using the specified structure name.
DirectIndex(Index index, java.lang.String structureName, java.lang.Class<? extends IterablePosting> postingClass)
          Constructs an instance of the class with
 
Method Summary
 int[][] getTerms(BitIndexPointer pointer)
          Get the terms for the document at the specified bit index pointer.
 int[][] getTerms(int docid)
          Returns a two dimensional array containing the term ids and the term frequencies for the given document.
static void main(java.lang.String[] args)
          main
 
Methods inherited from class org.terrier.structures.BitPostingIndex
close, getPostings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final org.apache.log4j.Logger logger
The logger used for the Lexicon


docIndex

protected DocumentIndex docIndex
The document index employed for retrieving the document offsets.

Constructor Detail

DirectIndex

public DirectIndex(Index index,
                   java.lang.String structureName)
            throws java.io.IOException
Constructs an instance of the class with the given index, using the specified structure name.

Parameters:
index - The index to be used
structureName - the name of this direct index
Throws:
java.io.IOException

DirectIndex

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

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

getTerms

public int[][] getTerms(int docid)
                 throws java.io.IOException
Returns a two dimensional array containing the term ids and the term frequencies for the given document.

Parameters:
docid - the document identifier of the document which terms we retrieve.
Returns:
int[][] the two dimensional [n][3] array containing the term ids, frequencies and field scores. If the given document identifier is not found in the document index, then the method returns null. If fields are not used, then the dimension of the returned array are [n][2].
Throws:
java.io.IOException

getTerms

public int[][] getTerms(BitIndexPointer pointer)
                 throws java.io.IOException
Get the terms for the document at the specified bit index pointer. See getTerms(int docid) for the return specification.

Throws:
java.io.IOException

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
main

Parameters:
args -
Throws:
java.lang.Exception


Terrier 3.5. Copyright © 2004-2011 University of Glasgow