Lucene.Net
3.0.3
Lucene.Net is a .NET port of the Java Lucene Indexing Library
|
A Directory is a flat list of files. Files may be written once, when they are created. Once a file is created it may only be opened for read, or deleted. Random access is permitted both when reading and writing. More...
Inherits IDisposable.
Inherited by Lucene.Net.Store.FileSwitchDirectory, Lucene.Net.Store.FSDirectory, and Lucene.Net.Store.RAMDirectory.
Public Member Functions | |
abstract System.String[] | ListAll () |
Returns an array of strings, one for each file in the directory. | |
abstract bool | FileExists (System.String name) |
Returns true iff a file with the given name exists. | |
abstract long | FileModified (System.String name) |
Returns the time the named file was last modified. | |
abstract void | TouchFile (System.String name) |
Set the modified time of an existing file to now. | |
abstract void | DeleteFile (System.String name) |
Removes an existing file in the directory. | |
abstract long | FileLength (System.String name) |
Returns the length of a file in the directory. | |
abstract IndexOutput | CreateOutput (System.String name) |
Creates a new, empty file in the directory with the given name. Returns a stream writing this file. | |
virtual void | Sync (System.String name) |
Ensure that any writes to this file are moved to stable storage. Lucene uses this to properly commit changes to the index, to prevent a machine/OS crash from corrupting the index. | |
abstract IndexInput | OpenInput (System.String name) |
Returns a stream reading an existing file. | |
virtual IndexInput | OpenInput (System.String name, int bufferSize) |
Returns a stream reading an existing file, with the specified read buffer size. The particular Directory implementation may ignore the buffer size. Currently the only Directory implementations that respect this parameter are FSDirectory and Lucene.Net.Index.CompoundFileReader | |
virtual Lock | MakeLock (System.String name) |
Construct a Lock. | |
virtual void | ClearLock (System.String name) |
Attempt to clear (forcefully unlock and remove) the specified lock. Only call this at a time when you are certain this lock is no longer in use. | |
void | Close () |
void | Dispose () |
Closes the store. | |
virtual void | SetLockFactory (LockFactory lockFactory) |
Set the LockFactory that this Directory instance should use for its locking implementation. Each * instance of LockFactory should only be used for one directory (ie, do not share a single instance across multiple Directories). | |
virtual string | GetLockId () |
Return a string identifier that uniquely differentiates this Directory instance from other Directory instances. This ID should be the same if two Directory instances (even in different JVMs and/or on different machines) are considered "the same index". This is how locking "scopes" to the right index. | |
override string | ToString () |
void | EnsureOpen () |
<throws> AlreadyClosedException if this Directory is closed </throws> | |
Static Public Member Functions | |
static void | Copy (Directory src, Directory dest, bool closeDirSrc) |
Copy contents of a directory src to a directory dest. If a file in src already exists in dest then the one in dest will be blindly overwritten. | |
Protected Member Functions | |
abstract void | Dispose (bool disposing) |
Properties | |
virtual LockFactory | LockFactory [get] |
Get the LockFactory that this Directory instance is using for its locking implementation. Note that this may be null for Directory implementations that provide their own locking implementation. | |
bool | isOpen_ForNUnit [get] |
A Directory is a flat list of files. Files may be written once, when they are created. Once a file is created it may only be opened for read, or deleted. Random access is permitted both when reading and writing.
Java's i/o APIs not used directly, but rather all i/o is through this API. This permits things such as:
Directory locking is implemented by an instance of LockFactory , and can be changed for each Directory instance using SetLockFactory.
Definition at line 42 of file Directory.cs.
|
virtual |
Attempt to clear (forcefully unlock and remove) the specified lock. Only call this at a time when you are certain this lock is no longer in use.
name | name of the lock to be cleared. |
Definition at line 114 of file Directory.cs.
void Lucene.Net.Store.Directory.Close | ( | ) |
Definition at line 123 of file Directory.cs.
|
static |
Copy contents of a directory src to a directory dest. If a file in src already exists in dest then the one in dest will be blindly overwritten.
NOTE: the source directory cannot change while this method is running. Otherwise the results are undefined and you could easily hit a FileNotFoundException.
NOTE: this method only copies files that look like index files (ie, have extensions matching the known extensions of index files).
src | source directory |
dest | destination directory |
closeDirSrc | if true , call Close() method on source directory |
<throws> IOException </throws>
Definition at line 201 of file Directory.cs.
|
pure virtual |
Creates a new, empty file in the directory with the given name. Returns a stream writing this file.
Implemented in Lucene.Net.Store.MMapDirectory, Lucene.Net.Store.RAMDirectory, Lucene.Net.Store.FileSwitchDirectory, and Lucene.Net.Store.SimpleFSDirectory.
|
pure virtual |
Removes an existing file in the directory.
Implemented in Lucene.Net.Store.FSDirectory, Lucene.Net.Store.RAMDirectory, and Lucene.Net.Store.FileSwitchDirectory.
void Lucene.Net.Store.Directory.Dispose | ( | ) |
Closes the store.
Definition at line 129 of file Directory.cs.
|
protectedpure virtual |
Implemented in Lucene.Net.Store.FSDirectory, Lucene.Net.Store.RAMDirectory, and Lucene.Net.Store.FileSwitchDirectory.
void Lucene.Net.Store.Directory.EnsureOpen | ( | ) |
<throws> AlreadyClosedException if this Directory is closed </throws>
Definition at line 253 of file Directory.cs.
|
pure virtual |
Returns true iff a file with the given name exists.
Implemented in Lucene.Net.Store.FSDirectory, Lucene.Net.Store.FileSwitchDirectory, and Lucene.Net.Store.RAMDirectory.
|
pure virtual |
Returns the length of a file in the directory.
Implemented in Lucene.Net.Store.FSDirectory, Lucene.Net.Store.RAMDirectory, and Lucene.Net.Store.FileSwitchDirectory.
|
pure virtual |
Returns the time the named file was last modified.
Implemented in Lucene.Net.Store.FSDirectory, Lucene.Net.Store.FileSwitchDirectory, and Lucene.Net.Store.RAMDirectory.
|
virtual |
Return a string identifier that uniquely differentiates this Directory instance from other Directory instances. This ID should be the same if two Directory instances (even in different JVMs and/or on different machines) are considered "the same index". This is how locking "scopes" to the right index.
Reimplemented in Lucene.Net.Store.FSDirectory.
Definition at line 170 of file Directory.cs.
|
pure virtual |
Returns an array of strings, one for each file in the directory.
System.IO.IOException |
Implemented in Lucene.Net.Store.FSDirectory, Lucene.Net.Store.FileSwitchDirectory, and Lucene.Net.Store.RAMDirectory.
|
virtual |
Construct a Lock.
name | the name of the lock file |
Definition at line 104 of file Directory.cs.
|
pure virtual |
Returns a stream reading an existing file.
Implemented in Lucene.Net.Store.FSDirectory, Lucene.Net.Store.RAMDirectory, and Lucene.Net.Store.FileSwitchDirectory.
|
virtual |
Returns a stream reading an existing file, with the specified read buffer size. The particular Directory implementation may ignore the buffer size. Currently the only Directory implementations that respect this parameter are FSDirectory and Lucene.Net.Index.CompoundFileReader
Reimplemented in Lucene.Net.Store.MMapDirectory, and Lucene.Net.Store.SimpleFSDirectory.
Definition at line 96 of file Directory.cs.
|
virtual |
Set the LockFactory that this Directory instance should use for its locking implementation. Each * instance of LockFactory should only be used for one directory (ie, do not share a single instance across multiple Directories).
lockFactory | instance of LockFactory. |
Definition at line 145 of file Directory.cs.
|
virtual |
Ensure that any writes to this file are moved to stable storage. Lucene uses this to properly commit changes to the index, to prevent a machine/OS crash from corrupting the index.
Reimplemented in Lucene.Net.Store.FSDirectory, and Lucene.Net.Store.FileSwitchDirectory.
Definition at line 82 of file Directory.cs.
override string Lucene.Net.Store.Directory.ToString | ( | ) |
Definition at line 175 of file Directory.cs.
|
pure virtual |
Set the modified time of an existing file to now.
Implemented in Lucene.Net.Store.FSDirectory, Lucene.Net.Store.FileSwitchDirectory, and Lucene.Net.Store.RAMDirectory.
|
get |
Definition at line 260 of file Directory.cs.
|
get |
Get the LockFactory that this Directory instance is using for its locking implementation. Note that this may be null for Directory implementations that provide their own locking implementation.
Definition at line 158 of file Directory.cs.