Apache Lucene.Net 2.1 Class Library API

Lucene.Net.Store Namespace

Namespace hierarchy

Classes

Class Description
BufferedIndexInput Base implementation class for buffered {@link IndexInput}.
BufferedIndexOutput Base implementation class for buffered {@link IndexOutput}.
Directory  
FSDirectory Straightforward implementation of {@link Directory} as a directory of files. Locking implementation is by default the {@link SimpleFSLockFactory}, but can be changed either by passing in a {@link LockFactory} instance to
getDirectory
, or specifying the LockFactory class by setting
Lucene.Net.Store.FSDirectoryLockFactoryClass
Java system property, or by calling {@link #setLockFactory} after creating the Directory.

Directories are cached, so that, for a given canonical path, the same FSDirectory instance will always be returned by

getDirectory
. This permits synchronization on directories.

FSIndexInput  
IndexInput Abstract base class for input from a file in a {@link Directory}. A random-access input stream. Used for all Lucene index input operations.
IndexOutput Abstract base class for output to a file in a Directory. A random-access output stream. Used for all Lucene index output operations.
Lock  
Lock.With Utility class for executing code with exclusive access.
LockFactory Base class for Locking implementation. {@link Directory} uses instances of this class to implement locking.
MMapDirectory  
NativeFSLockFactory Implements {@link LockFactory} using native OS file locks (available through java.nio.*). Note that for certain filesystems native locks are possible but must be explicity configured and enabled (and may be disabled by default). For example, for NFS servers there sometimes must be a separate lockd process running, and other configuration may be required such as running the server in kernel mode. Other filesystems may not even support native OS locks in which case you must use a different {@link LockFactory} implementation.

The advantage of this lock factory over {@link SimpleFSLockFactory} is that the locks should be "correct", whereas {@link SimpleFSLockFactory} uses java.io.File.createNewFile which has warnings about not using it for locking. Furthermore, if the JVM crashes, the OS will free any held locks, whereas {@link SimpleFSLockFactory} will keep the locks held, requiring manual removal before re-running Lucene.

Note that, unlike {@link SimpleFSLockFactory}, the existence of leftover lock files in the filesystem on exiting the JVM is fine because the OS will free the locks held against these files even though the files still remain.

Native locks file names have the substring "-n-", which you can use to differentiate them from lock files created by {@link SimpleFSLockFactory}.

NoLockFactory Use this {@link LockFactory} to disable locking entirely. This LockFactory is used when you call {@link FSDirectory#setDisableLocks}. Only one instance of this lock is created. You should call {@link #GetNoLockFactory()} to get the instance.
RAMDirectory A memory-resident {@link Directory} implementation. Locking implementation is by default the {@link SingleInstanceLockFactory} but can be changed with {@link #setLockFactory}.
RAMFile  
RAMOutputStream A memory-resident {@link IndexOutput} implementation.
SimpleFSLockFactory Implements {@link LockFactory} using {@link File#createNewFile()}. This is currently the default LockFactory used for {@link FSDirectory} if no LockFactory instance is otherwise provided. Note that there are known problems with this locking implementation on NFS.
SingleInstanceLockFactory Implements {@link LockFactory} for a single in-process instance, meaning all locking will take place through this one instance. Only use this {@link LockFactory} when you are certain all IndexReaders and IndexWriters for a given index are running against a single shared in-process Directory instance. This is currently the default locking for RAMDirectory.