Quantcast
Channel: 진성주(Sungju Jin) » Lucene
Viewing all articles
Browse latest Browse all 10

Lucene IndexWriter Debugging

$
0
0

루씬인액션 2판을 읽다가 Debugging Indexing 이라는 내용이 있어서 테스트를 해보았다.

사용법은 IndexWriter에서 setInfoStream으로 PrintStream 만 설정해주면 된다.

IndexWriter가 인덱싱을 진행하면서 나오는 정보들을 보여준다.

아래코드에서는 일반적인 Syteam.out 으로 설정해두었다.

루씬 인덱스의 기본구조를 어느정도 파악하고 있어야지 도움이 될듯하지만, 아무것도 출력안되는 것보단 나으니…

사용코드

 IndexWriter writer = new IndexWriter(
 new NIOFSDirectory(indexDir),
 new StandardAnalyzer(Version.LUCENE_29),
 true,
 IndexWriter.MaxFieldLength.UNLIMITED);
 writer.setUseCompoundFile(false);
 writer.setInfoStream(System.out);
 

출력결과

 FD [main]: setInfoStream deletionPolicy=org.apache.lucene.index.KeepOnlyLastCommitDeletionPolicy@67006d75
 IW 0 [main]: setInfoStream: dir=org.apache.lucene.store.NIOFSDirectory@D:Index autoCommit=false mergePolicy=org.apache.lucene.index.LogByteSizeMergePolicy@4d125127 mergeScheduler=org.apache.lucene.index.ConcurrentMergeScheduler@6d8dfef8 ramBufferSizeMB=16.0 maxBufferedDocs=-1 maxBuffereDeleteTerms=-1 maxFieldLength=2147483647 index=
 IW 0 [main]: optimize: index now
 IW 0 [main]:   flush: segment=_0 docStoreSegment=_0 docStoreOffset=0 flushDocs=true flushDeletes=true flushDocStores=false numDocs=12 numBufDelTerms=0
 IW 0 [main]:   index before flush
 IW 0 [main]: DW: flush postings as segment _0 numDocs=12
 IW 0 [main]: DW:   oldRAMSize=14365696 newFlushedSize=2919140 docs/MB=4.31 new/old=20.32%
 IFD [main]: now checkpoint "segments_1" [1 segments ; isCommit = false]
 IFD [main]: now checkpoint "segments_1" [1 segments ; isCommit = false]
 IW 0 [main]: LMP: findMerges: 1 segments
 IW 0 [main]: LMP:   level 6.2247195 to 6.4652586: 1 segments
 IW 0 [main]: CMS: now merge
 IW 0 [main]: CMS:   index: _0:C12->_0
 IW 0 [main]: CMS:   no more merges pending; now return
 IW 0 [main]: CMS: now merge
 IW 0 [main]: CMS:   index: _0:C12->_0
 IW 0 [main]: CMS:   no more merges pending; now return
 IW 0 [main]: now flush at close
 IW 0 [main]:   flush: segment=null docStoreSegment=_0 docStoreOffset=12 flushDocs=false flushDeletes=true flushDocStores=true numDocs=0 numBufDelTerms=0
 IW 0 [main]:   index before flush _0:C12->_0
 IW 0 [main]:   flush shared docStore segment _0
 IW 0 [main]: DW: closeDocStore: 2 files to flush to segment _0 numDocs=12
 IW 0 [main]: CMS: now merge
 IW 0 [main]: CMS:   index: _0:C12->_0
 IW 0 [main]: CMS:   no more merges pending; now return
 IW 0 [main]: now call final commit()
 IW 0 [main]: startCommit(): start sizeInBytes=0
 IW 0 [main]: startCommit index=_0:C12->_0 changeCount=3
 IW 0 [main]: now sync _0.nrm
 IW 0 [main]: now sync _0.tis
 IW 0 [main]: now sync _0.fnm
 IW 0 [main]: now sync _0.tii
 IW 0 [main]: now sync _0.frq
 IW 0 [main]: now sync _0.fdx
 IW 0 [main]: now sync _0.prx
 IW 0 [main]: now sync _0.fdt
 IW 0 [main]: done all syncs
 IW 0 [main]: commit: pendingCommit != null
 IW 0 [main]: commit: wrote segments file "segments_2"
 IFD [main]: now checkpoint "segments_2" [1 segments ; isCommit = true]
 IFD [main]: deleteCommits: now decRef commit "segments_1"
 IFD [main]: delete "segments_1"
 IW 0 [main]: commit: done
 IW 0 [main]: at close: _0:C12->_0
 Indexing 12 files took 4751 milliseconds


Viewing all articles
Browse latest Browse all 10