You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@lucene.apache.org by oibook13 <wh...@Gmail.com> on 2008/04/14 09:19:36 UTC
the question about the example of lucene in action
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):
org.apache.lucene.index.IndexFileDeleter@18558d2 main: DecRef "_2r.cfs":
pre-decr count is 2
org.apache.lucene.index.IndexFileDeleter@18558d2 main: DecRef "_2s.cfs":
pre-decr count is 2
org.apache.lucene.index.IndexFileDeleter@18558d2 main: DecRef
"segments_5o": pre-decr count is 1
org.apache.lucene.index.IndexFileDeleter@18558d2 main: delete "segments_5o"
org.apache.lucene.index.IndexFileDeleter@18558d2 main: now checkpoint
"segments_5q" [isCommit = true]
org.apache.lucene.index.IndexFileDeleter@18558d2 main: IncRef "_a.cfs":
pre-incr count is 1
org.apache.lucene.index.IndexFileDeleter@18558d2 main: IncRef "_l.cfs":
pre-incr count is 1
org.apache.lucene.index.IndexFileDeleter@18558d2 main: IncRef "_w.cfs":
pre-incr count is 1
…………
org.apache.lucene.index.IndexFileDeleter@18558d2 main: DecRef
"segments_67": pre-decr count is 1
org.apache.lucene.index.IndexFileDeleter@18558d2 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.
Re: the question about the example of lucene in action
Posted by oibook13 <wh...@Gmail.com>.
that accounts for it. thanks for your detailed explanations.
Michael McCandless-2 wrote:
>
>
> This question actually belongs on the java-user@lucene.apache.org
> (instead of general). It will get more attention there.
>
> Lucene now logs quite a bit more detail than just segment merges to
> that infoStream. This particular snippet is the detailing which
> files are being incref'd & decref'd; this is used to decide what
> files can safely be deleted. Lines that have "merge" or "merging"
> will tell you when merges are taking place.
>
> Mike
>
--
View this message in context: http://www.nabble.com/the-question-about-the-example-of-lucene-in-action-tp16671486p16721012.html
Sent from the Lucene - General mailing list archive at Nabble.com.
Re: the question about the example of lucene in action
Posted by Michael McCandless <lu...@mikemccandless.com>.
This question actually belongs on the java-user@lucene.apache.org
(instead of general). It will get more attention there.
Lucene now logs quite a bit more detail than just segment merges to
that infoStream. This particular snippet is the detailing which
files are being incref'd & decref'd; this is used to decide what
files can safely be deleted. Lines that have "merge" or "merging"
will tell you when merges are taking place.
Mike
oibook13 wrote:
>
> 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):
> org.apache.lucene.index.IndexFileDeleter@18558d2 main: DecRef
> "_2r.cfs":
> pre-decr count is 2
> org.apache.lucene.index.IndexFileDeleter@18558d2 main: DecRef
> "_2s.cfs":
> pre-decr count is 2
> org.apache.lucene.index.IndexFileDeleter@18558d2 main: DecRef
> "segments_5o": pre-decr count is 1
> org.apache.lucene.index.IndexFileDeleter@18558d2 main: delete
> "segments_5o"
> org.apache.lucene.index.IndexFileDeleter@18558d2 main: now checkpoint
> "segments_5q" [isCommit = true]
> org.apache.lucene.index.IndexFileDeleter@18558d2 main: IncRef
> "_a.cfs":
> pre-incr count is 1
> org.apache.lucene.index.IndexFileDeleter@18558d2 main: IncRef
> "_l.cfs":
> pre-incr count is 1
> org.apache.lucene.index.IndexFileDeleter@18558d2 main: IncRef
> "_w.cfs":
> pre-incr count is 1
> …………
> org.apache.lucene.index.IndexFileDeleter@18558d2 main: DecRef
> "segments_67": pre-decr count is 1
> org.apache.lucene.index.IndexFileDeleter@18558d2 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.
>