pavel 发表于 2013-1-28 19:37:10

Lucene-2.2.0 源代码阅读学习(12)

<div class="cnt">接着昨天学习的Lucene-2.2.0 源代码阅读学习(11)继续学习。
IndexWriter的一个构造器,定义如下所示:
public IndexWriter(String path, Analyzer a, boolean create)
       throws CorruptIndexException, LockObtainFailedException, IOException {
    init(FSDirectory.getDirectory(path), a, create, true, null, true);
}
已经知道,init方法的复杂性和重要性。对init方法所涉及到的有用的相关类进行系统地学习。
init方法的声明是这样的:
private void init(Directory d, Analyzer a, final boolean create, boolean closeDir, IndexDeletionPolicy deletionPolicy, boolean autoCommit)
首先看一下Directory这个类的继承关系,如图所示:
http://hiphotos.baidu.com/shirdrn/pic/item/f92312efddb4edfece1b3ed2.jpg
页: [1]
查看完整版本: Lucene-2.2.0 源代码阅读学习(12)