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(String) method (or one of its overloads), 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(String) (or one of its overloads). 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.
Inheritance
System.Object
FSDirectory
Assembly: Lucene.Net.dll
Syntax
public abstract class FSDirectory : BaseDirectory
Constructors
|
Improve this Doc
View Source
FSDirectory(DirectoryInfo)
Declaration
protected FSDirectory(DirectoryInfo dir)
Parameters
Type |
Name |
Description |
DirectoryInfo |
dir |
|
|
Improve this Doc
View Source
FSDirectory(DirectoryInfo, LockFactory)
Create a new FSDirectory for the named location (ctor for subclasses).
Declaration
protected FSDirectory(DirectoryInfo path, LockFactory lockFactory)
Parameters
Type |
Name |
Description |
DirectoryInfo |
path |
the path of the directory
|
LockFactory |
lockFactory |
the lock factory to use, or null for the default
(NativeFSLockFactory);
|
Fields
|
Improve this Doc
View Source
DEFAULT_READ_CHUNK_SIZE
Default read chunk size: 8192 bytes (this is the size up to which the runtime
does not allocate additional arrays while reading/writing)
Declaration
public const int DEFAULT_READ_CHUNK_SIZE = null
Field Value
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
m_directory
Declaration
protected readonly DirectoryInfo m_directory
Field Value
Type |
Description |
DirectoryInfo |
|
Properties
|
Improve this Doc
View Source
Directory
the underlying filesystem directory
Declaration
public virtual DirectoryInfo Directory { get; }
Property Value
Type |
Description |
DirectoryInfo |
|
|
Improve this Doc
View Source
ReadChunkSize
this setting has no effect anymore.
Declaration
public int ReadChunkSize { get; set; }
Property Value
Type |
Description |
System.Int32 |
|
Methods
|
Improve this Doc
View Source
CreateOutput(String, IOContext)
Creates an IndexOutput for the file with the given name.
Declaration
public override IndexOutput CreateOutput(string name, IOContext context)
Parameters
Type |
Name |
Description |
System.String |
name |
|
IOContext |
context |
|
Returns
Overrides
|
Improve this Doc
View Source
DeleteFile(String)
Removes an existing file in the directory.
Declaration
public override void DeleteFile(string name)
Parameters
Type |
Name |
Description |
System.String |
name |
|
Overrides
|
Improve this Doc
View Source
Dispose(Boolean)
Closes the store to future operations.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type |
Name |
Description |
System.Boolean |
disposing |
|
Overrides
|
Improve this Doc
View Source
EnsureCanWrite(String)
Declaration
protected virtual void EnsureCanWrite(string name)
Parameters
Type |
Name |
Description |
System.String |
name |
|
|
Improve this Doc
View Source
FileExists(String)
Returns true iff a file with the given name exists.
Declaration
public override bool FileExists(string name)
Parameters
Type |
Name |
Description |
System.String |
name |
|
Returns
Type |
Description |
System.Boolean |
|
Overrides
|
Improve this Doc
View Source
FileLength(String)
Returns the length in bytes of a file in the directory.
Declaration
public override long FileLength(string name)
Parameters
Type |
Name |
Description |
System.String |
name |
|
Returns
Type |
Description |
System.Int64 |
|
Overrides
|
Improve this Doc
View Source
GetLockID()
Declaration
public override string GetLockID()
Returns
Type |
Description |
System.String |
|
Overrides
|
Improve this Doc
View Source
ListAll()
Lists all files (not subdirectories) in the
directory.
Declaration
public override string[] ListAll()
Returns
Type |
Description |
System.String[] |
|
Overrides
See Also
|
Improve this Doc
View Source
ListAll(DirectoryInfo)
Lists all files (not subdirectories) in the
directory. This method never returns null
(throws
instead).
Declaration
public static string[] ListAll(DirectoryInfo dir)
Parameters
Type |
Name |
Description |
DirectoryInfo |
dir |
|
Returns
Type |
Description |
System.String[] |
|
|
Improve this Doc
View Source
OnIndexOutputClosed(FSDirectory.FSIndexOutput)
Declaration
protected virtual void OnIndexOutputClosed(FSDirectory.FSIndexOutput io)
Parameters
|
Improve this Doc
View Source
Open(DirectoryInfo)
Creates an FSDirectory instance, trying to pick the
best implementation given the current environment.
The directory returned uses the NativeFSLockFactory.
Currently this returns MMapDirectory for most Solaris
and Windows 64-bit runtimes, NIOFSDirectory for other
non-Windows runtimes, and SimpleFSDirectory for other
runtimes on Windows. It is highly recommended that you consult the
implementation's documentation for your platform before
using this method.
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. For optimal performance you should consider using
MMapDirectory on 64 bit runtimes.
See FSDirectory.
Declaration
public static FSDirectory Open(DirectoryInfo path)
Parameters
Type |
Name |
Description |
DirectoryInfo |
path |
|
Returns
|
Improve this Doc
View Source
Open(DirectoryInfo, LockFactory)
Declaration
public static FSDirectory Open(DirectoryInfo path, LockFactory lockFactory)
Parameters
Type |
Name |
Description |
DirectoryInfo |
path |
|
LockFactory |
lockFactory |
|
Returns
|
Improve this Doc
View Source
Open(String)
Declaration
public static FSDirectory Open(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
The path (to a directory) to open
|
Returns
|
Improve this Doc
View Source
Open(String, LockFactory)
Declaration
public static FSDirectory Open(string path, LockFactory lockFactory)
Parameters
Type |
Name |
Description |
System.String |
path |
The path (to a directory) to open
|
LockFactory |
lockFactory |
|
Returns
|
Improve this Doc
View Source
SetLockFactory(LockFactory)
Declaration
public override void SetLockFactory(LockFactory lockFactory)
Parameters
Overrides
|
Improve this Doc
View Source
Sync(ICollection<String>)
Declaration
public override void Sync(ICollection<string> names)
Parameters
Type |
Name |
Description |
ICollection<System.String> |
names |
|
Overrides
|
Improve this Doc
View Source
ToString()
Declaration
public override string ToString()
Returns
Type |
Description |
System.String |
|
Overrides
See Also