Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
- de-serialized the pdf parser - added fail callback for file indexer
orbitercee7a05ff25d
diff --git a/source/de/anomic/document/parser/pdfParser.java b/source/de/anomic/document/parser/pdfParser.javaindex a391ab44b..bb446a4da 100644--- a/source/de/anomic/document/parser/pdfParser.java+++ b/source/de/anomic/document/parser/pdfParser.java@@ -109,7 +109,6 @@ public class pdfParser extends AbstractParser implements Idiom {checkInterruption();// creating a text stripper- synchronized (SUPPORTED_MIME_TYPES) {final PDFTextStripper stripper = new PDFTextStripper();theDocument = parser.getPDDocument();@@ -182,7 +181,6 @@ public class pdfParser extends AbstractParser implements Idiom {}return theDoc;- }}catch (final Exception e) {if (e instanceof InterruptedException) throw (InterruptedException) e;diff --git a/source/de/anomic/search/DocumentIndex.java b/source/de/anomic/search/DocumentIndex.javaindex c2ceaa52c..727c406e4 100644--- a/source/de/anomic/search/DocumentIndex.java+++ b/source/de/anomic/search/DocumentIndex.java@@ -77,12 +77,20 @@ public class DocumentIndex extends Segment {class Worker extends Thread {public void run() {File f;+ URIMetadataRow resultRow;try {while ((f = queue.take()) != poison) try {- add(f);- if (callback != null) callback.commitIndex(f);+ resultRow = add(f);+ if (callback != null) {+ if (resultRow == null) {+ callback.fail(f, "result is null");+ } else {+ callback.commit(f, resultRow);+ }+ }} catch (IOException e) {if (e.getMessage().indexOf("cannot parse") < 0) e.printStackTrace();+ callback.fail(f, e.getMessage());}} catch (InterruptedException e) {}}@@ -229,7 +237,8 @@ public class DocumentIndex extends Segment {}public interface CallbackListener {- public void commitIndex(File f);+ public void commit(File f, URIMetadataRow resultRow);+ public void fail(File f, String failReason);}public static void main(String[] args) {@@ -245,9 +254,12 @@ public class DocumentIndex extends Segment {File segmentPath = new File(args[0]);System.out.println("using index files at " + segmentPath.getAbsolutePath());CallbackListener callback = new CallbackListener() {- public void commitIndex(File f) {+ public void commit(File f, URIMetadataRow resultRow) {System.out.println("indexed: " + f.toString());}+ public void fail(File f, String failReason) {+ System.out.println("not indexed " + f.toString() + ": " + failReason);+ }};try {if (args[1].equals("add")) {