CLucene - a full-featured, c++ search engine
API Documentation
#include <FSDirectory.h>
Public Member Functions | |
~FSDirectory () | |
Destructor - only call this if you are sure the directory is not being used anymore. | |
void | list (std::vector< std::string > *names) const |
Get a list of strings, one for each file in the directory. | |
bool | fileExists (const char *name) const |
Returns true iff a file with the given name exists. | |
const char * | getDirName () const |
Returns the text name of the directory. | |
int64_t | fileModified (const char *name) const |
Returns the time the named file was last modified. | |
int64_t | fileLength (const char *name) const |
Returns the length in bytes of a file in the directory. | |
IndexInput * | openInput (const char *name) |
Returns a stream reading an existing file. | |
IndexInput * | openInput (const char *name, int32_t bufferSize) |
IndexInput * | openMMapFile (const char *name, int32_t bufferSize=LUCENE_STREAM_BUFFER_SIZE) |
void | renameFile (const char *from, const char *to) |
Renames an existing file in the directory. | |
void | touchFile (const char *name) |
Set the modified time of an existing file to now. | |
IndexOutput * | createOutput (const char *name) |
Creates a new, empty file in the directory with the given name. | |
void | close () |
Decrease the ref-count to the directory by one. | |
void | setUseMMap (bool value) |
If MMap is available, this can disable use of mmap reading. | |
bool | getUseMMap () const |
Gets whether the directory is using MMap for inputstreams. | |
TCHAR * | toString () const |
const char * | getDirectoryType () const |
Static Public Member Functions | |
static FSDirectory * | getDirectory (const char *file, const bool create, LockFactory *lockFactory=NULL) |
Returns the directory instance for the named location. | |
static int64_t | fileModified (const char *dir, const char *name) |
Returns the time the named file was last modified. | |
static const char * | DirectoryType () |
static void | setDisableLocks (bool doDisableLocks) |
Set whether Lucene's use of lock files is disabled. | |
static bool | getDisableLocks () |
Returns whether Lucene's use of lock files is disabled. | |
Protected Member Functions | |
FSDirectory (const char *path, const bool createDir, LockFactory *lockFactory=NULL) | |
bool | doDeleteFile (const char *name) |
Removes an existing file in the directory. | |
Friends | |
class | FSDirectory::FSIndexOutput |
class | FSDirectory::FSIndexInput |
If the system property 'disableLuceneLocks' has the String value of "true", lock creation will be disabled.
lucene::store::FSDirectory::FSDirectory | ( | const char * | path, | |
const bool | createDir, | |||
LockFactory * | lockFactory = NULL | |||
) | [protected] |
lucene::store::FSDirectory::~FSDirectory | ( | ) |
Destructor - only call this if you are sure the directory is not being used anymore.
Otherwise use the ref-counting facilities of _CLDECDELETE
bool lucene::store::FSDirectory::doDeleteFile | ( | const char * | name | ) | [protected, virtual] |
void lucene::store::FSDirectory::list | ( | std::vector< std::string > * | names | ) | const [virtual] |
bool lucene::store::FSDirectory::fileExists | ( | const char * | name | ) | const [virtual] |
const char* lucene::store::FSDirectory::getDirName | ( | ) | const |
Returns the text name of the directory.
returns reference
static FSDirectory* lucene::store::FSDirectory::getDirectory | ( | const char * | file, | |
const bool | create, | |||
LockFactory * | lockFactory = NULL | |||
) | [static] |
Returns the directory instance for the named location.
Do not delete this instance, only use close, otherwise other instances will lose this instance.
Directories are cached, so that, for a given canonical path, the same FSDirectory instance will always be returned. This permits synchronization on directories.
file | the path to the directory. | |
create | if true, create, or erase any existing contents. |
int64_t lucene::store::FSDirectory::fileModified | ( | const char * | name | ) | const [virtual] |
static int64_t lucene::store::FSDirectory::fileModified | ( | const char * | dir, | |
const char * | name | |||
) | [static] |
Returns the time the named file was last modified.
int64_t lucene::store::FSDirectory::fileLength | ( | const char * | name | ) | const [virtual] |
IndexInput* lucene::store::FSDirectory::openInput | ( | const char * | name | ) | [virtual] |
IndexInput* lucene::store::FSDirectory::openInput | ( | const char * | name, | |
int32_t | bufferSize | |||
) | [virtual] |
Reimplemented from lucene::store::Directory.
IndexInput* lucene::store::FSDirectory::openMMapFile | ( | const char * | name, | |
int32_t | bufferSize = LUCENE_STREAM_BUFFER_SIZE | |||
) |
void lucene::store::FSDirectory::renameFile | ( | const char * | from, | |
const char * | to | |||
) | [virtual] |
void lucene::store::FSDirectory::touchFile | ( | const char * | name | ) | [virtual] |
IndexOutput* lucene::store::FSDirectory::createOutput | ( | const char * | name | ) | [virtual] |
Creates a new, empty file in the directory with the given name.
Returns a stream writing this file.
Implements lucene::store::Directory.
void lucene::store::FSDirectory::close | ( | ) | [virtual] |
Decrease the ref-count to the directory by one.
If the object is no longer needed, then the object is removed from the directory pool.
Implements lucene::store::Directory.
void lucene::store::FSDirectory::setUseMMap | ( | bool | value | ) | [inline] |
If MMap is available, this can disable use of mmap reading.
bool lucene::store::FSDirectory::getUseMMap | ( | ) | const [inline] |
Gets whether the directory is using MMap for inputstreams.
TCHAR* lucene::store::FSDirectory::toString | ( | ) | const [virtual] |
Implements lucene::store::Directory.
static const char* lucene::store::FSDirectory::DirectoryType | ( | ) | [inline, static] |
const char* lucene::store::FSDirectory::getDirectoryType | ( | ) | const [inline, virtual] |
Implements lucene::store::Directory.
static void lucene::store::FSDirectory::setDisableLocks | ( | bool | doDisableLocks | ) | [inline, static] |
Set whether Lucene's use of lock files is disabled.
By default, lock files are enabled. They should only be disabled if the index is on a read-only medium like a CD-ROM.
static bool lucene::store::FSDirectory::getDisableLocks | ( | ) | [inline, static] |
Returns whether Lucene's use of lock files is disabled.
friend class FSDirectory::FSIndexOutput [friend] |
friend class FSDirectory::FSIndexInput [friend] |