Class FSDirectory
Base class for Directory implementations that store index files in the file system. There are currently three core subclasses:
Unfortunately, because of system peculiarities, there is no single overall best implementation. Therefore, we've added the Open(IO.DirectoryInfo) method, to allow Lucene to choose the best FSDirectory implementation given your environment, and the known limitations of each implementation. For users who have no reason to prefer a specific implementation, it's best to simply use Open(IO.DirectoryInfo) . For all others, you should instantiate the desired implementation directly.
The locking implementation is by default NativeFSLockFactory , but can be changed by passing in a custom LockFactory instance.
Inherited Members
Namespace:
Assembly: Lucene.Net.NetCore.dll
Syntax
public abstract class FSDirectory : Directory
Constructors
Name | Description |
---|---|
FSDirectory(IO.DirectoryInfo, LockFactory) | Create a new FSDirectory for the named location (ctor for subclasses). |
Fields
Name | Description |
---|---|
DEFAULT_READ_CHUNK_SIZE | Default read chunk size. This is a conditional
default: on 32bit JVMs, it defaults to 100 MB. On
64bit JVMs, it's |
internalDirectory | The underlying filesystem directory |
Properties
Name | Description |
---|---|
Directory | |
ReadChunkSize | The maximum number of bytes to read at once from the underlying file during ReadBytes(Byte[], Int32, Int32). |
Methods
Name | Description |
---|---|
DeleteFile(String) | Removes an existing file in the directory. |
Dispose(Boolean) | |
FileExists(String) | Returns true iff a file with the given name exists. |
FileLength(String) | Returns the length in bytes of a file in the directory. |
FileModified(IO.FileInfo, String) | Returns the time the named file was last modified. |
FileModified(String) | Returns the time the named file was last modified. |
GetLockId() | |
InitOutput(String) | Initializes the directory to create a new file with the given name.
This method should be used in |
ListAll() | Lists all files (not subdirectories) in the directory. |
ListAll(IO.DirectoryInfo) | Lists all files (not subdirectories) in the
directory. This method never returns null (throws
|
Open(IO.DirectoryInfo) | Creates an FSDirectory instance, trying to pick the best implementation given the current environment. The directory returned uses the NativeFSLockFactory. Currently this returns SimpleFSDirectory as NIOFSDirectory is currently not supported. NOTE: this method may suddenly change which implementation is returned from release to release, in the event that higher performance defaults become possible; if the precise implementation is important to your application, please instantiate it directly, instead. On 64 bit systems, it may also good to return MMapDirectory, but this is disabled because of officially missing unmap support in Java. For optimal performance you should consider using this implementation on 64 bit JVMs. See above |
Open(IO.DirectoryInfo, LockFactory) | Just like Open(IO.DirectoryInfo), but allows you to also specify a custom LockFactory. |
Open(String) | Creates an FSDirectory instance, trying to pick the best implementation given the current environment. The directory returned uses the NativeFSLockFactory. Currently this returns SimpleFSDirectory as NIOFSDirectory is currently not supported. NOTE: this method may suddenly change which implementation is returned from release to release, in the event that higher performance defaults become possible; if the precise implementation is important to your application, please instantiate it directly, instead. On 64 bit systems, it may also good to return MMapDirectory, but this is disabled because of officially missing unmap support in Java. For optimal performance you should consider using this implementation on 64 bit JVMs. See above |
OpenInput(String) | |
Sync(String) | |
ToString() | For debug output. |
TouchFile(String) | Set the modified time of an existing file to now. |