Apache Nutch is an extensible and scalable web crawler
NUTCH-662: Upgrade Nutch to use Lucene 2.4
Dennis Kubes92c62720e162
diff --git a/CHANGES.txt b/CHANGES.txtindex f28ba36f6..b970d36cc 100644--- a/CHANGES.txt+++ b/CHANGES.txt@@ -283,7 +283,9 @@ Unreleased changes (1.0-dev)104. NUTCH-640 - confusing description "set it to Integer.MAX_VALUE".(dogacan)-++105. NUTCH-662 - Upgrade Nutch to use Lucene 2.4. (kubes)+Release 0.9 - 2007-04-021. Changed log4j confiquration to log to stdout on commandlinediff --git a/lib/lucene-core-2.3.0.jar b/lib/lucene-core-2.3.0.jardeleted file mode 100755index 78cfdea29..000000000Binary files a/lib/lucene-core-2.3.0.jar and /dev/null differdiff --git a/lib/lucene-core-2.4.0.jar b/lib/lucene-core-2.4.0.jarnew file mode 100644index 000000000..440d76865Binary files /dev/null and b/lib/lucene-core-2.4.0.jar differdiff --git a/lib/lucene-misc-2.3.0.jar b/lib/lucene-misc-2.3.0.jardeleted file mode 100755index b3c354500..000000000Binary files a/lib/lucene-misc-2.3.0.jar and /dev/null differdiff --git a/lib/lucene-misc-2.4.0.jar b/lib/lucene-misc-2.4.0.jarnew file mode 100644index 000000000..ad09f57a1Binary files /dev/null and b/lib/lucene-misc-2.4.0.jar differdiff --git a/src/java/org/apache/nutch/indexer/DeleteDuplicates.java b/src/java/org/apache/nutch/indexer/DeleteDuplicates.javaindex 6bc2512ab..dedc0864b 100644--- a/src/java/org/apache/nutch/indexer/DeleteDuplicates.java+++ b/src/java/org/apache/nutch/indexer/DeleteDuplicates.java@@ -145,10 +145,11 @@ public class DeleteDuplicates extends Configured/** Return each index as a split. */public InputSplit[] getSplits(JobConf job, int numSplits)throws IOException {- Path[] files = listPaths(job);+ FileStatus[] files = listStatus(job);InputSplit[] splits = new InputSplit[files.length];for (int i = 0; i < files.length; i++) {- splits[i] = new FileSplit(files[i], 0, INDEX_LENGTH, (String[])null);+ FileStatus cur = files[i];+ splits[i] = new FileSplit(cur.getPath(), 0, INDEX_LENGTH, (String[])null);}return splits;}diff --git a/src/java/org/apache/nutch/indexer/FsDirectory.java b/src/java/org/apache/nutch/indexer/FsDirectory.javaindex 78bab0b1a..1f56d6c22 100644--- a/src/java/org/apache/nutch/indexer/FsDirectory.java+++ b/src/java/org/apache/nutch/indexer/FsDirectory.java@@ -18,6 +18,8 @@package org.apache.nutch.indexer;import java.io.*;+import java.util.Random;+import org.apache.lucene.store.*;import org.apache.nutch.util.HadoopFSUtil;import org.apache.hadoop.fs.*;@@ -207,30 +209,45 @@ public class FsDirectory extends Directory {private class DfsIndexOutput extends BufferedIndexOutput {private FSDataOutputStream out;+ private RandomAccessFile local;+ private File localFile;public DfsIndexOutput(Path path, int ioFileBufferSize) throws IOException {++ // create a temporary local file and set it to delete on exit+ String randStr = Integer.toString(new Random().nextInt(Integer.MAX_VALUE));+ localFile = File.createTempFile("index_" + randStr, ".tmp");+ localFile.deleteOnExit();+ local = new RandomAccessFile(localFile, "rw");+out = fs.create(path);}public void flushBuffer(byte[] b, int offset, int size) throws IOException {- out.write(b, offset, size);+ local.write(b, offset, size);}public void close() throws IOException {super.close();++ // transfer to dfs from local+ byte[] buffer = new byte[4096];+ local.seek(0);+ int read = -1;+ while ((read = local.read(buffer)) != -1) {+ out.write(buffer, 0, read);+ }out.close();+ local.close();}public void seek(long pos) throws IOException {- throw new UnsupportedOperationException();+ super.seek(pos);+ local.seek(pos);}public long length() throws IOException {- return out.getPos();- }-- protected void finalize() throws IOException {- out.close(); // close the file+ return local.length();}}diff --git a/src/plugin/lib-lucene-analyzers/lib/lucene-analyzers-2.3.0.jar b/src/plugin/lib-lucene-analyzers/lib/lucene-analyzers-2.3.0.jardeleted file mode 100755index f2d7206f4..000000000Binary files a/src/plugin/lib-lucene-analyzers/lib/lucene-analyzers-2.3.0.jar and /dev/null differdiff --git a/src/plugin/lib-lucene-analyzers/lib/lucene-analyzers-2.4.0.jar b/src/plugin/lib-lucene-analyzers/lib/lucene-analyzers-2.4.0.jarnew file mode 100644index 000000000..f915f4444Binary files /dev/null and b/src/plugin/lib-lucene-analyzers/lib/lucene-analyzers-2.4.0.jar differdiff --git a/src/plugin/lib-lucene-analyzers/plugin.xml b/src/plugin/lib-lucene-analyzers/plugin.xmlindex b37438073..0477f1d93 100644--- a/src/plugin/lib-lucene-analyzers/plugin.xml+++ b/src/plugin/lib-lucene-analyzers/plugin.xml@@ -25,11 +25,11 @@<pluginid="lib-lucene-analyzers"name="Lucene Analysers"- version="2.3.0"+ version="2.4.0"provider-name="org.apache.lucene"><runtime>- <library name="lucene-analyzers-2.3.0.jar">+ <library name="lucene-analyzers-2.4.0.jar"><export name="*"/></library></runtime>