org.apache.lucene.codecs
Class BlockTermsReader

java.lang.Object
  extended by org.apache.lucene.index.Fields
      extended by org.apache.lucene.codecs.FieldsProducer
          extended by org.apache.lucene.codecs.BlockTermsReader
All Implemented Interfaces:
Closeable

public class BlockTermsReader
extends FieldsProducer

Handles a terms dict, but decouples all details of doc/freqs/positions reading to an instance of PostingsReaderBase. This class is reusable for codecs that use a different format for docs/freqs/positions (though codecs are also free to make their own terms dict impl).

This class also interacts with an instance of TermsIndexReaderBase, to abstract away the specific implementation of the terms dict index.

WARNING: This API is experimental and might change in incompatible ways in the next release.

Field Summary
protected  long dirOffset
           
 
Fields inherited from class org.apache.lucene.index.Fields
EMPTY_ARRAY
 
Constructor Summary
BlockTermsReader(TermsIndexReaderBase indexReader, Directory dir, FieldInfos fieldInfos, String segment, PostingsReaderBase postingsReader, IOContext context, int termsCacheSize, String segmentSuffix)
           
 
Method Summary
 void close()
           
 FieldsEnum iterator()
          Returns an iterator that will step through all fields names.
protected  void readHeader(IndexInput input)
           
protected  void seekDir(IndexInput input, long dirOffset)
           
 int size()
          Returns the number of terms for all fields, or -1 if this measure isn't stored by the codec.
 Terms terms(String field)
          Get the Terms for this field.
 
Methods inherited from class org.apache.lucene.index.Fields
getUniqueTermCount
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dirOffset

protected long dirOffset
Constructor Detail

BlockTermsReader

public BlockTermsReader(TermsIndexReaderBase indexReader,
                        Directory dir,
                        FieldInfos fieldInfos,
                        String segment,
                        PostingsReaderBase postingsReader,
                        IOContext context,
                        int termsCacheSize,
                        String segmentSuffix)
                 throws IOException
Throws:
IOException
Method Detail

readHeader

protected void readHeader(IndexInput input)
                   throws IOException
Throws:
IOException

seekDir

protected void seekDir(IndexInput input,
                       long dirOffset)
                throws IOException
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Specified by:
close in class FieldsProducer
Throws:
IOException

iterator

public FieldsEnum iterator()
Description copied from class: Fields
Returns an iterator that will step through all fields names. This will not return null.

Specified by:
iterator in class Fields

terms

public Terms terms(String field)
            throws IOException
Description copied from class: Fields
Get the Terms for this field. This will return null if the field does not exist.

Specified by:
terms in class Fields
Throws:
IOException

size

public int size()
Description copied from class: Fields
Returns the number of terms for all fields, or -1 if this measure isn't stored by the codec. Note that, just like other term measures, this measure does not take deleted documents into account.

Specified by:
size in class Fields


Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.