it.unimi.di.mg4j.index
Class AbstractBitStreamIndexWriter

java.lang.Object
  extended by it.unimi.di.mg4j.index.AbstractBitStreamIndexWriter
All Implemented Interfaces:
IndexWriter
Direct Known Subclasses:
BitStreamHPIndexWriter, BitStreamIndexWriter

public abstract class AbstractBitStreamIndexWriter
extends Object
implements IndexWriter

An abstract bitstream-based index writer, providing common variables and a basic printStats(PrintStream) implementation.

Compression flags

Implementing subclasses need to know the compression method that they should use to write frequencies, pointers, payloads, counts and positions (and whether to write any of them). This information is passed to the constructor using a suitable flag map (see CompressionFlags).

Since:
1.2
Author:
Sebastiano Vigna

Field Summary
 long bitsForCounts
          The number of bits written for counts.
 long bitsForFrequencies
          The number of bits written for frequencies.
 long bitsForPayloads
          The number of bits written for payloads.
 long bitsForPointers
          The number of bits written for document pointers.
 long bitsForPositions
          The number of bits written for positions.
protected  CompressionFlags.Coding countCoding
          The coding for counts.
protected  int currentTerm
          The current term.
 Map<CompressionFlags.Component,CompressionFlags.Coding> flags
          The flag map.
protected  CompressionFlags.Coding frequencyCoding
          The coding for frequencies.
protected  boolean hasCounts
          Whether this index contains counts.
protected  boolean hasPayloads
          Whether this index contains payloads.
protected  boolean hasPositions
          Whether this index contains positions.
protected  int numberOfDocuments
          The number of documents of the collection to be indexed.
protected  long numberOfOccurrences
          The number of indexed occurrences.
protected  long numberOfPostings
          The number of indexed postings (pairs term/document).
protected  CompressionFlags.Coding pointerCoding
          The coding for pointers.
protected  CompressionFlags.Coding positionCoding
          The coding for positions.
 
Constructor Summary
AbstractBitStreamIndexWriter(int numberOfDocuments, Map<CompressionFlags.Component,CompressionFlags.Coding> flags)
           
 
Method Summary
 void printStats(PrintStream stats)
          Writes to the given print stream statistical information about the index just built.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface it.unimi.di.mg4j.index.IndexWriter
close, newDocumentRecord, newInvertedList, properties, writeDocumentPointer, writeDocumentPositions, writeFrequency, writePayload, writePositionCount, writtenBits
 

Field Detail

numberOfDocuments

protected final int numberOfDocuments
The number of documents of the collection to be indexed.


flags

public Map<CompressionFlags.Component,CompressionFlags.Coding> flags
The flag map.


frequencyCoding

protected CompressionFlags.Coding frequencyCoding
The coding for frequencies.


pointerCoding

protected CompressionFlags.Coding pointerCoding
The coding for pointers.


countCoding

protected CompressionFlags.Coding countCoding
The coding for counts.


positionCoding

protected CompressionFlags.Coding positionCoding
The coding for positions.


hasPayloads

protected final boolean hasPayloads
Whether this index contains payloads.


hasCounts

protected final boolean hasCounts
Whether this index contains counts.


hasPositions

protected final boolean hasPositions
Whether this index contains positions.


numberOfPostings

protected long numberOfPostings
The number of indexed postings (pairs term/document).


numberOfOccurrences

protected long numberOfOccurrences
The number of indexed occurrences.


currentTerm

protected int currentTerm
The current term.


bitsForFrequencies

public long bitsForFrequencies
The number of bits written for frequencies.


bitsForPointers

public long bitsForPointers
The number of bits written for document pointers.


bitsForCounts

public long bitsForCounts
The number of bits written for counts.


bitsForPayloads

public long bitsForPayloads
The number of bits written for payloads.


bitsForPositions

public long bitsForPositions
The number of bits written for positions.

Constructor Detail

AbstractBitStreamIndexWriter

public AbstractBitStreamIndexWriter(int numberOfDocuments,
                                    Map<CompressionFlags.Component,CompressionFlags.Coding> flags)
Method Detail

printStats

public void printStats(PrintStream stats)
Description copied from interface: IndexWriter
Writes to the given print stream statistical information about the index just built. This method must be called after IndexWriter.close().

Specified by:
printStats in interface IndexWriter
Parameters:
stats - a print stream where statistical information will be written.