org.apache.hadoop.contrib.index.lucene
Class ShardWriter

java.lang.Object
  extended by org.apache.hadoop.contrib.index.lucene.ShardWriter

public class ShardWriter
extends Object

The initial version of an index is stored in the perm dir. Index files created by newer versions are written to a temp dir on the local FS. After successfully creating the new version in the temp dir, the shard writer moves the new files to the perm dir and deletes the temp dir in close().


Constructor Summary
ShardWriter(FileSystem fs, Shard shard, String tempDir, IndexUpdateConfiguration iconf)
          Constructor
 
Method Summary
 void close()
          Close the shard writer.
 void process(IntermediateForm form)
          Process an intermediate form by carrying out, on the Lucene instance of the shard, the deletes and the inserts (a ram index) in the form.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ShardWriter

public ShardWriter(FileSystem fs,
                   Shard shard,
                   String tempDir,
                   IndexUpdateConfiguration iconf)
            throws IOException
Constructor

Parameters:
fs -
shard -
tempDir -
iconf -
Throws:
IOException
Method Detail

process

public void process(IntermediateForm form)
             throws IOException
Process an intermediate form by carrying out, on the Lucene instance of the shard, the deletes and the inserts (a ram index) in the form.

Parameters:
form - the intermediate form containing deletes and a ram index
Throws:
IOException

close

public void close()
           throws IOException
Close the shard writer. Optimize the Lucene instance of the shard before closing if necessary, and copy the files created in the temp directory to the permanent directory after closing.

Throws:
IOException

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009 The Apache Software Foundation