lucene写索引的函数调用关系

函数的调用构成一棵树,同等深度的为兄弟子树,更深的为更浅的后代。

IndexWriter.addDocument
 DocumentsWriter.updateDocument
  DocFieldProcessorPerThread.processDocument
   StoredFieldsWriterPerThread.addField
    FieldWriter.writeField
     RAMOutputStream.writeVInt
      RAMOutputStream.writeByte
       //这里把要写的内容放入缓冲区
        currentBuffer[bufferPosition++] = b;
     RAMOutputStream.writeByte
     RAMOutputStream.writeString
   DocInverterPerField.processFields

IndexWriter.commit
 IndexWriter.commitInternal
  IndexWriter.prepareCommit
   IndexWriter.doFlush
    DocumentsWriter.flush
     DocFieldProcessor.flush
      StoreFieldWriter.finish
      StoreFieldWriter.close
       IOUtils.close
        FSDirectory.close
         FSDirectory.flush
          FSDirectory.flushBuffer
           //这里最终写入磁盘文件
             RandomAccessFile.write
    IndexWriter.add(SegmentInfo)
    BufferedDeletesStream.prune(SegmentInfos)
    IndexWriter.clearFlushPending
   IndexWriter.commit(SegmentInfos)
   SegmentInfos.files(Directory)
   IndexWriter.startCommit(SegmentInfos)
  IndexWriter.finishCommit
 IndexWriter.closeInternal
  IndexWriter.close



    
  

 

你可能感兴趣的:(Lucene,磁盘)