Lucene目錄


Directory類表示索引的儲存位置,並通常是檔案的列表。這些檔案被稱為索引檔案。索引檔案通常建立一次,然後用於讀操作或可以被刪除。

類宣告

以下是org.apache.lucene.store.Directory類的宣告:

public abstract class Directory
   extends Object
      implements Closeable

欄位

以下是org.apache.lucene.store.Directory類的欄位:

  • protected boolean isOpen

  • protected LockFactory lockFactory -- 持有LockFactory範例(工具鎖定此目錄範例)。

類別建構函式

S.N. 建構函式和說明
1 Directory() 

類方法

S.N. 方法 & 描述
1 void clearLock(String name)
嘗試清除(強行解鎖和刪除)指定的鎖
2 abstract void close()
關閉儲存
3 static void copy(Directory src, Directory dest, boolean closeDirSrc)
不推薦使用。應要求被替換複製(目錄,字串,字串)為每個需要複製的檔案。可以使用下面的程式碼:
 IndexFileNameFilter filter = IndexFileNameFilter.getFilter();
 for (String file : src.listAll()) {
   if (filter.accept(null, file)) {
     src.copy(dest, file, file);
   }
 }
4 void copy(Directory to, String src, String dest)
複製檔案到目錄src下的新檔案名dest
5 abstract IndexOutput createOutput(String name)
建立在給定名稱的目錄中一個新的空檔案
6 abstract void deleteFile(String name)
刪除目錄中的現有檔案
7 protected void ensureOpen() 
8 abstract boolean fileExists(String name)
當且僅當給定名稱的檔案存在,則返回true
9 abstract long fileLength(String name)
返回目錄中的檔案的長度
10 abstract long fileModified(String name)
不推薦使用
11 LockFactory getLockFactory()
獲取此目錄範例使用其鎖定實現LockFactory
12 String getLockID()
返回一個字串識別符號,它唯一來自其他目錄情況下,這種區別Directory範例
13 abstract String[] listAll()
返回字串陣列,一個用於在目錄中的每個檔案
14 Lock makeLock(String name)
構造一個鎖
15 abstract IndexInput openInput(String name)
返回流中讀取現有的檔案
16 IndexInput openInput(String name, int bufferSize)
返回流中讀取現有的檔案,用指定讀快取的大小
17 void setLockFactory(LockFactory lockFactory)
設定LockFactory這個指南範例應該用於其鎖定的實現
18 void sync(Collection<String> names)
確保任何寫入這些檔案移動到穩定的儲存
19 void sync(String name)
不推薦使用。使用同步(集合)來代替。為了便於移植,可以改變程式碼呼叫sync(Collections.singleton(name))
20 String toString() 
21 abstract void touchFile(String name)
不推薦使用。Lucene從未使用這個API;它將在4被移除。0.

方法繼承

這個類從以下類繼承的方法:

  • java.lang.Object