Mailing List Archive

r3879 - trunk/devel/benchmarks/indexers
Author: creamyg
Date: 2008-09-17 20:03:04 -0700 (Wed, 17 Sep 2008)
New Revision: 3879

Modified:
trunk/devel/benchmarks/indexers/LuceneIndexer.java
Log:
Update Lucene indexing benchmark app for Java 1.5 and Lucene 2.3.2.


Modified: trunk/devel/benchmarks/indexers/LuceneIndexer.java
===================================================================
--- trunk/devel/benchmarks/indexers/LuceneIndexer.java 2008-09-18 03:01:28 UTC (rev 3878)
+++ trunk/devel/benchmarks/indexers/LuceneIndexer.java 2008-09-18 03:03:04 UTC (rev 3879)
@@ -2,6 +2,7 @@
import org.apache.lucene.analysis.WhitespaceAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
+import org.apache.lucene.store.FSDirectory;

import java.io.File;
import java.io.BufferedReader;
@@ -26,9 +27,8 @@

public static void main (String[] args) throws Exception {
// verify that we're running from the right directory
- String curDir = new File(".").getCanonicalPath();
- if (!curDir.endsWith("benchmarks"))
- throw new Exception("Must be run from benchmarks/ ");
+ if (!corpusDir.exists())
+ throw new Exception("Can't find 'extracted_corpus' directory");

// assemble the sorted list of article files
fileList = buildFileList();
@@ -79,7 +79,7 @@
// Return a lexically sorted list of all article files from all subdirs.
static String[] buildFileList () throws Exception {
File[] articleDirs = corpusDir.listFiles();
- Vector filePaths = new Vector();
+ Vector<String> filePaths = new Vector<String>();
for (int i = 0; i < articleDirs.length; i++) {
File[] articles = articleDirs[i].listFiles();
for (int j = 0; j < articles.length; j++) {
@@ -96,9 +96,10 @@
// Initialize an IndexWriter
static IndexWriter initWriter (int count) throws Exception {
boolean create = count > 0 ? false : true;
- IndexWriter writer = new IndexWriter(indexDir,
- new WhitespaceAnalyzer(), create);
- writer.setMaxBufferedDocs(1000);
+ FSDirectory directory = FSDirectory.getDirectory(indexDir);
+ IndexWriter writer = new IndexWriter(directory, true,
+ new WhitespaceAnalyzer(), create);
+ // writer.setMaxBufferedDocs(1000);
writer.setUseCompoundFile(false);

return writer;


_______________________________________________
kinosearch-commits mailing list
kinosearch-commits@rectangular.com
http://www.rectangular.com/mailman/listinfo/kinosearch-commits