lucene建立索引時候的用到的一些文件和目錄操作

2021-07-11 00:07:09 字數 768 閱讀 4198

在前邊的文章中多是用的新增乙個document,這裡介紹一下其它的文件操作

1,按照編號刪除

public

void

deletedoc(string indexdir) throws exception

2,根據term來刪除

public

void

deletedocwithterm(string indexdir) throws exception

3,取消刪除

public

void

undeletedoc(string indexdir) throws exception

4,刪除後優化

public

void

mergedoc(string indexdir) throws exception

5,把ramdirectory中的索引合併到fsdirectroy中

public

void

indexoperator(string indexdir) throws exception);

ramwriter.close();

}

6,把索引的內容直接讀入記憶體

ramdirectory ramdir =new ramdirectory(indexdir);

Lucene 建立索引

public class indexer public static string indexdir d luceneindex public static void main string args system.out.println 被索引的文件個數 writer.numdocs catch ...

Lucene索引的建立

lucene索引的建立 1.搜尋引擎之所以檢索速度快其中乙個因素就是對索引的建立。就好像書籍的目錄,可以讓我們迅速定位到內容。這裡引用一張圖說明搜尋過程。從圖中可以很清晰的看到乙個搜尋系統,三個部分 收集資料整理成索引文件,這個過程多是確定你需要檢索的資訊。比如如果你需要檢索圖書館中的書。那麼你可能...

lucene 建立索引與搜尋所用到的相關類

今天繼續看 lucene in action 將簡單地做一下筆記。一 核心索引相關類 1 indexwriter 職責 建立索引或新增lucene結構的記錄 document 到索引中 建立 修改索引而不允許讀取索引。2 directory 職責 lucene所建立的索引位置。此類是個抽象類,其子類...