Terrier IR Platform
2.2.1

uk.ac.gla.terrier.structures
Class DirectIndex

java.lang.Object
  extended by uk.ac.gla.terrier.structures.DirectIndex
All Implemented Interfaces:
Closeable
Direct Known Subclasses:
BlockDirectIndex

public class DirectIndex
extends java.lang.Object
implements Closeable

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

Version:
$Revision: 1.37 $
Author:
Douglas Johnson, Vassilis Plachouras, Craig Macdonald

Constructor Summary
DirectIndex(DocumentIndex docIndex)
          Constructs an instance of the direct index with the given document index, and a default name for the underlying direct file.
DirectIndex(DocumentIndex docIndex, java.lang.String filename)
          Constructs an instance of the direct index with the given document index and a non-default name for the underlying direct file.
DirectIndex(DocumentIndex docIndex, java.lang.String path, java.lang.String prefix)
           
 
Method Summary
 void close()
          Closes the underlying bitfile compressed file.
 int[][] getTerms(int docid)
          Returns a two dimensional array containing the term ids and the term frequencies for the given document.
 void print()
          Prints out the direct index file.
 void reOpenLegacyBitFile()
          forces the data structure to reopen the underlying bitfile using the legacy implementation of BitFile (OldBitFile)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirectIndex

public DirectIndex(DocumentIndex docIndex)
Constructs an instance of the direct index with the given document index, and a default name for the underlying direct file.

Parameters:
docIndex - The document index to be used.

DirectIndex

public DirectIndex(DocumentIndex docIndex,
                   java.lang.String path,
                   java.lang.String prefix)

DirectIndex

public DirectIndex(DocumentIndex docIndex,
                   java.lang.String filename)
Constructs an instance of the direct index with the given document index and a non-default name for the underlying direct file.

Parameters:
docIndex - The document index to be used
filename - the non-default filename used for the underlying direct file.
Method Detail

reOpenLegacyBitFile

public void reOpenLegacyBitFile()
                         throws java.io.IOException
forces the data structure to reopen the underlying bitfile using the legacy implementation of BitFile (OldBitFile)

Throws:
java.io.IOException

getTerms

public int[][] getTerms(int docid)
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].

print

public void print()
Prints out the direct index file.


close

public void close()
Closes the underlying bitfile compressed file.

Specified by:
close in interface Closeable

Terrier IR Platform
2.2.1

Terrier Information Retrieval Platform 2.2.1. Copyright 2004-2008 University of Glasgow