Hello.
Long time ago, I made writing/reading program by using lucene.
That's version is 2.4.1.
I try to change it(to 4.9.0)
But new version(4.9.0) is slower than old version. (both searching and
writing).
I want to know why it is slower than old version.
and How can i increase speed more than old version.
and if you can, Please check my sample source.
Thank you.
Best Regards.
[2.4.1 version's source]
=========================================================
main class :
----------------------------------------------------------------
String indexPath = "index";
String docsPath = "D:\\logTest\\lucene2.4";
final File docDir = new File(docsPath);
PerFieldAnalyzerWrapper analyzers = new PerFieldAnalyzerWrapper(new
KeywordAnalyzer());
IndexWriter writer = new IndexWriter(docsPath, analyzers);
indexDocs(writer, docDir);
writer.commit();
writer.close();
--------------------------------------------------------------
indexDocs class :
Field fieldTimeKey = new Field(EpoLogWriterCommonVar.FIELD_TIME_SS,
"EMPTY", Field.Store.YES, Field.Index.NOT_ANALYZED);
...
Document doc = new Document();
for (double i = 0; i < 3000000; i++) {
doc = new Document();
// make a new, empty document
fieldTimeKey.setValue("111" + i);
...
doc.add(fieldTimeKey);
...
writer.addDocument(doc);
if (i % 10000 == 0) {
writer.commit();
}
===============================================================
[4.9 version's source]
================================================================
main class :
----------------------------------------------------------------
String indexPath = "index";
String docsPath = "D:\\logTest\\lucene4.0";
final File docDir = new File(docsPath);
Directory dir = FSDirectory.open(docDir);
Analyzer analy = new KeywordAnalyzer();
PerFieldAnalyzerWrapper analyzer = new PerFieldAnalyzerWrapper(analy);
IndexWriterConfig iwc = new IndexWriterConfig(Version.LUCENE_4_9, analyzer);
IndexWriter writer = new IndexWriter(dir, iwc);
indexDocs(writer, docDir);
writer.commit();
writer.close();
--------------------------------------------------------------
indexDocs class :
Document doc = new Document();
StringField fieldTimeKey = new
StringField(EpoLogWriterCommonVar.FIELD_TIME_SS, "EMPTY", Field.Store.YES);
for (double i = 0; i < 3000000; i++) {
doc = new Document();
// make a new, empty document
fieldTimeKey.setStringValue("111" + i);
...
doc.add(fieldTimeKey);
...
writer.addDocument(doc);
if (i % 10000 == 0) {
writer.commit();
}
===============================================================