org.apache.lucene.index
Class LuceneUtils

java.lang.Object
  extended by org.apache.lucene.index.LuceneUtils

public abstract class LuceneUtils
extends Object

Author:
kimchy

Constructor Summary
LuceneUtils()
           
 
Method Summary
static void compoundDirectory(Directory directory, long writeLockTimeout)
          Compunds the directory.
static void copy(Directory src, boolean srcIsCompound, Directory dest, boolean destIsCompound, byte[] buffer)
          Copies one directory contents to the other.
static void copy(Directory src, Directory dest, String name, byte[] buffer)
          Copies over the contents of the name entry from the src directory into the dest directory.
static void copy(IndexInput indexInput, IndexOutput indexOutput, String name, byte[] buffer)
          Copies the contents of the IndexInput into the IndexOutput.
static boolean isCompound(Directory directory)
          Returns true if all the segments of the directory are in compound format.
static boolean isUnCompound(Directory directory)
          Returns true if all the segments of the directory are in un-compound format.
static void unCompoundDirectory(Directory directory, long writeLockTimeout)
          Compunds the directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LuceneUtils

public LuceneUtils()
Method Detail

copy

public static void copy(Directory src,
                        boolean srcIsCompound,
                        Directory dest,
                        boolean destIsCompound,
                        byte[] buffer)
                 throws IOException
Copies one directory contents to the other. Will automatically compound or uncompound the contents of the src directory into the dest directory.

Parameters:
src - The src directory to copy from
srcIsCompound - If the src is in compound format or not
dest - The dest directory to copy to
destIsCompound - If the dest will be in compound format or not
buffer - The buffer to use when copying over
Throws:
IOException

copy

public static void copy(Directory src,
                        Directory dest,
                        String name,
                        byte[] buffer)
                 throws IOException
Copies over the contents of the name entry from the src directory into the dest directory.

Parameters:
src - The src directory to copy from
dest - The dest directory to copy to
name - the name of the entry
buffer - The buffer to use
Throws:
IOException

copy

public static void copy(IndexInput indexInput,
                        IndexOutput indexOutput,
                        String name,
                        byte[] buffer)
                 throws IOException
Copies the contents of the IndexInput into the IndexOutput.

Parameters:
indexInput - The content to copy from
indexOutput - The output to write to
name - The name of the file
buffer - The buffer to use
Throws:
IOException

isCompound

public static boolean isCompound(Directory directory)
                          throws IOException
Returns true if all the segments of the directory are in compound format. Will return true if the index does not exists or there are no segments.

Throws:
IOException

isUnCompound

public static boolean isUnCompound(Directory directory)
                            throws IOException
Returns true if all the segments of the directory are in un-compound format. Will return true if the index does not exists or there are no segments.

Throws:
IOException

compoundDirectory

public static void compoundDirectory(Directory directory,
                                     long writeLockTimeout)
                              throws IOException
Compunds the directory. Only works on segments that have no ".cfs" file that already exists.

Throws:
IOException

unCompoundDirectory

public static void unCompoundDirectory(Directory directory,
                                       long writeLockTimeout)
                                throws IOException
Compunds the directory. Only works on segments that have ".cfs" file that already exists.

Throws:
IOException


Copyright (c) 2004-2006 The Compass Project.