
- Lucene - Home
- Lucene - Overview
- Lucene - Environment Setup
- Lucene - First Application
- Lucene - Indexing Classes
- Lucene - Searching Classes
- Lucene - Indexing Process
- Lucene - Search Operation
- Lucene - Sorting
Lucene - Indexing Operations
- Lucene - Indexing Operations
- Lucene - Add Document
- Lucene - Update Document
- Lucene - Delete Document
- Lucene - Field Options
Lucene - Query Programming
- Lucene - Query Programming
- Lucene - TermQuery
- Lucene - TermRangeQuery
- Lucene - PrefixQuery
- Lucene - BooleanQuery
- Lucene - PhraseQuery
- Lucene - WildCardQuery
- Lucene - FuzzyQuery
- Lucene - MatchAllDocsQuery
- Lucene - MatchNoDocsQuery
- Lucene - RegexpQuery
Lucene - Analysis
- Lucene - Analysis
- Lucene - WhitespaceAnalyzer
- Lucene - SimpleAnalyzer
- Lucene - StopAnalyzer
- Lucene - StandardAnalyzer
- Lucene - KeywordAnalyzer
- Lucene - CustomAnalyzer
- Lucene - EnglishAnalyzer
- Lucene - FrenchAnalyzer
- Lucene - SpanishAnalyzer
Lucene - Resources
Lucene - Directory Class
This class represents the storage location of the indexes and generally it is a list of files. These files are called index files. Index files are normally created once and then used for read operation or can be deleted.
Class declaration
Following is the declaration for org.apache.lucene.store.Directory class −
public abstract class Directory extends Object implements Closeable
Class Constructors
Following table shows the class constructors for Directory −
S.No. | Constructor & Description |
---|---|
1 |
Directory() Constructs a new Directory. |
Class Methods
S.No. | Method & Description |
---|---|
1 |
long addDocument(Iterable<? extends IndexableField> doc) Adds a document to this index. |
2 |
abstract void close() Closes the directory. |
3 |
void copyFrom(Directory from, String src, String dest, IOContext context) Copies an existing src file from directory from to a non-existent file dest in this directory. |
4 |
abstract IndexOutput createOutput(String name, IOContext context) Creates a new, empty file in the directory and returns an IndexOutput instance for appending data to this file. |
5 |
abstract IndexOutput createTempOutput(String prefix, String suffix, IOContext context) Creates a new, empty, temporary file in the directory and returns an IndexOutput instance for appending data to this file. |
6 |
abstract void deleteFile(String name) Removes an existing file in the directory. |
7 |
protected void ensureOpen() Ensures this directory is still open. |
8 |
abstract long fileLength(String name) Returns the byte length of a file in the directory. |
9 |
abstract Set<String> getPendingDeletions() Returns a set of files currently pending deletion in this directory. |
10 |
protected static String getTempFileName(String prefix, String suffix, long counter) Creates a file name for a temporary file. |
11 |
abstract String[] listAll() Returns names of all files stored in this directory. |
12 |
abstract Lock obtainLock(String name) Acquires and returns a Lock for a file with the given name. |
13 |
ChecksumIndexInput openChecksumInput(String name) Opens a checksum-computing stream for reading an existing file. |
14 |
abstract IndexInput openInput(String name, IOContext context) Opens a stream for reading an existing file. |
15 |
abstract void rename(String source, String dest) Renames source file to dest file where dest must not already exist in the directory. |
16 |
abstract void sync(Collection<String> names) Ensures that any writes to these files are moved to stable storage (made durable). |
17 |
abstract void syncMetaData() Ensures that directory metadata, such as recent file renames, are moved to stable storage. |
18 |
String toString() String representation. |
Methods Inherited
This class inherits methods from the following classes −
- java.lang.Object