IndexWriter.addIndexes解析

來源:互聯網
上載者:User

標籤:lucene   源碼   

SegmentInfo包含除了delCount和delGen之外的段其他資訊
SegmentInfoPerCommit既包含SegmentInfo,也包含delCount和delGen資訊。
SegmentInfos是SegmentInfoPerCommit的集合,此外還包含counter,generation,user data資訊。
addIndexes(Directory...)操作過程:
1.flush(false, true),不觸發merge,但應用刪除(apply deletes);
2.對於輸入的directory,逐一拷貝到新directory中,其中注意對lucene3xstorefiles的處理,lucene3xstorefiles貌似可以是多個段共用的,所以如果有共用的,可以不拷貝。具體把segment拷貝的函數是copySegmentAsIs。
3.最後把段加入現有的segmentInfos中,同時調用checkpoint,視為一個檢查點(相應計數值增加)。不會刪除舊的檔案。
addIndexes(IndexReader...)的邏輯不同:
將所有reader做一次合并,合并之後檢查是否做cfs合并,是要建一個cfs檔案(createCompoundFile),最後寫入si檔案,加入infos,checkpoint。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.