org.apache.lucene.codecs.memory
Class MemoryPostingsFormat

java.lang.Object
  extended by org.apache.lucene.codecs.PostingsFormat
      extended by org.apache.lucene.codecs.memory.MemoryPostingsFormat
All Implemented Interfaces:
NamedSPILoader.NamedSPI

public class MemoryPostingsFormat
extends PostingsFormat

Stores terms & postings (docs, positions, payloads) in RAM, using an FST.

Note that this codec implements advance as a linear scan! This means if you store large fields in here, queries that rely on advance will (AND BooleanQuery, PhraseQuery) will be relatively slow!

NOTE: this codec cannot address more than ~2.1 GB of postings, because the underlying FST uses an int to address the underlying byte[].

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

Field Summary
 
Fields inherited from class org.apache.lucene.codecs.PostingsFormat
EMPTY
 
Constructor Summary
MemoryPostingsFormat()
           
MemoryPostingsFormat(boolean doPackFST, float acceptableOverheadRatio)
           
 
Method Summary
 FieldsConsumer fieldsConsumer(SegmentWriteState state)
          Writes a new segment
 FieldsProducer fieldsProducer(SegmentReadState state)
          Reads a segment.
 String toString()
           
 
Methods inherited from class org.apache.lucene.codecs.PostingsFormat
availablePostingsFormats, forName, getName, reloadPostingsFormats
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MemoryPostingsFormat

public MemoryPostingsFormat()

MemoryPostingsFormat

public MemoryPostingsFormat(boolean doPackFST,
                            float acceptableOverheadRatio)
Method Detail

toString

public String toString()
Overrides:
toString in class PostingsFormat

fieldsConsumer

public FieldsConsumer fieldsConsumer(SegmentWriteState state)
                              throws IOException
Description copied from class: PostingsFormat
Writes a new segment

Specified by:
fieldsConsumer in class PostingsFormat
Throws:
IOException

fieldsProducer

public FieldsProducer fieldsProducer(SegmentReadState state)
                              throws IOException
Description copied from class: PostingsFormat
Reads a segment. NOTE: by the time this call returns, it must hold open any files it will need to use; else, those files may be deleted. Additionally, required files may be deleted during the execution of this call before there is a chance to open them. Under these circumstances an IOException should be thrown by the implementation. IOExceptions are expected and will automatically cause a retry of the segment opening logic with the newly revised segments.

Specified by:
fieldsProducer in class PostingsFormat
Throws:
IOException


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