Lucene索引庫的維護

2021-09-25 11:53:12 字數 537 閱讀 3439

公共**提取,下面的例子會用到的方法:

//提取公共**:獲得indexwrite物件

public indexwriter getindexwriter() throws ioexception

和建立索引庫一樣

@test

public void addindex() throws ioexception

@test

public void deleteindex() throws ioexception

@test

public void deleteindexbyquery() throws ioexception

原理是先刪除後新增(刪除後該id位置為空,最後新增乙個document,獲得新id)

@test

public void updateindex() throws ioexception

Lucene專題 索引庫維護

是否分析 是否對域的內容進行分詞處理。前提是我們要對域的內容進行查詢。是否索引 將field分析後的詞或整個field值進行索引,只有索引方可搜尋到。比如 商品名稱 商品簡介分析後進行索引,訂單號 身份證號不用分析但也要索引,這些將來都要作為查詢條件。是否儲存 將field值儲存在文件中,儲存在文件...

Lucene索引庫的維護功能實現

向索引庫中新增document物件。第一步 先建立乙個indexwriter物件 第二步 建立乙個document物件 第三步 把document物件寫入索引庫 第四步 關閉indexwriter。新增索引 test public void adddocument throws exception ...

Lucene索引維護 四

新增索引 test public void adddocument throws exception 2.1 刪除全部 test public void testindexdeleteall throws exception說明 將索引目錄的索引資訊全部刪除,直接徹底刪除,無法恢復。2.2 根據條件...