lucene in action has a instance about explaining indexwriter's
MergeFactor,MaxMergeDocs parameter on 2.7.1. Because of lucene's edition,
imodified it just like this:
public class IndexTuningDemo {
        
        public static void main(String[] args) throws Exception {
                int docsInIndex = Integer.parseInt(args[0]);
                
                Directory dir = FSDirectory.getDirectory(
                                System.getProperty("java.io.tmpdir","tmp")+
                                
System.getProperty("file.separator")+"index-dir");
                Analyzer analyzer = new SimpleAnalyzer();
                IndexWriter writer = new IndexWriter(dir,analyzer,true);
                
                writer.setMergeFactor(Integer.parseInt(args[1]));
                writer.setMaxMergeDocs(Integer.parseInt(args[2]));
                writer.setInfoStream(System.out);
                
                System.out.println("Merge factor: "+writer.getMergeFactor());
                System.out.println("Max merge docs: "+writer.getMaxMergeDocs());
                
                long start = System.currentTimeMillis();
                for (int i = 0; i < docsInIndex ; i++){
                        Document doc = new Document();
                        doc.add(new
Field("fieldname","Bibamus",Field.Store.YES,Field.Index.TOKENIZED));
                        writer.addDocument(doc);
                }
                writer.close();
                long stop = System.currentTimeMillis();
                System.out.println("Time: "+(stop-start)+" ms");
        }
}

but the result which came from the program isn't like the books says,but
like this(i omit a part of it because it is so much many line):
[EMAIL PROTECTED] main:   DecRef "_2r.cfs":
pre-decr count is 2
[EMAIL PROTECTED] main:   DecRef "_2s.cfs":
pre-decr count is 2
[EMAIL PROTECTED] main:   DecRef
"segments_5o": pre-decr count is 1
[EMAIL PROTECTED] main: delete "segments_5o"
[EMAIL PROTECTED] main: now checkpoint
"segments_5q" [isCommit = true]
[EMAIL PROTECTED] main:   IncRef "_a.cfs":
pre-incr count is 1
[EMAIL PROTECTED] main:   IncRef "_l.cfs":
pre-incr count is 1
[EMAIL PROTECTED] main:   IncRef "_w.cfs":
pre-incr count is 1
…………
[EMAIL PROTECTED] main:   DecRef
"segments_67": pre-decr count is 1
[EMAIL PROTECTED] main: delete "segments_67"
Time: 4156 ms

i don't know what it is meaning! i would appreciate that if some one could
explain it. thanks.
-- 
View this message in context: 
http://www.nabble.com/the-question-about-the-example-of-lucene-in-action-tp16671486p16671486.html
Sent from the Lucene - General mailing list archive at Nabble.com.

Reply via email to