Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

doctype2mime fix, influences metadata conversion between old metadata and solr

Michael Peter Christena1b2c9a67d6f
diff --git a/defaults/httpd.mime b/defaults/httpd.mime
index 2fc577369..9b763ccb5 100644
--- a/defaults/httpd.mime
+++ b/defaults/httpd.mime
@@ -47,6 +47,7 @@ kml = application/vnd.google-earth.kml+xml
lha = application/x-lzh
lzh = application/x-lzh
m4v = video/x-m4v
+md5 = text/plain
mf = application/octet-stream
mov = video/quicktime
mm = application/freemind
diff --git a/source/de/anomic/crawler/retrieval/Response.java b/source/de/anomic/crawler/retrieval/Response.java
index b9c75c845..46e674bee 100644
--- a/source/de/anomic/crawler/retrieval/Response.java
+++ b/source/de/anomic/crawler/retrieval/Response.java
@@ -118,16 +118,22 @@ public class Response {
}
public static String doctype2mime(String ext, char doctype) {
- String mime = Classification.ext2mime(ext);
- int p = mime.indexOf('/');
- if (p < 0) return mime;
- if (doctype == DT_TEXT) return "text" + mime.substring(p);
+ if (doctype == DT_PDFPS) return "application/pdf";
+ if (doctype == DT_HTML) return "text/html";
+ if (doctype == DT_DOC) return "application/msword";
+ if (doctype == DT_FLASH) return "application/x-shockwave-flash";
+ if (doctype == DT_SHARE) return "text/plain";
+ if (doctype == DT_BINARY) return "application/octet-stream";
+ String mime = Classification.ext2mime(ext);
+ int p = mime.indexOf('/');
+ if (p < 0) return mime;
+ if (doctype == DT_TEXT) return "text" + mime.substring(p);
if (doctype == DT_IMAGE) return "image" + mime.substring(p);
if (doctype == DT_AUDIO) return "audio" + mime.substring(p);
if (doctype == DT_MOVIE) return "video" + mime.substring(p);
return mime;
}
-
+
public static final int QUEUE_STATE_FRESH = 0;
public static final int QUEUE_STATE_PARSING = 1;
public static final int QUEUE_STATE_CONDENSING = 2;
diff --git a/source/net/yacy/cora/document/Classification.java b/source/net/yacy/cora/document/Classification.java
index 13afe7018..7afbf7272 100644
--- a/source/net/yacy/cora/document/Classification.java
+++ b/source/net/yacy/cora/document/Classification.java
@@ -184,7 +184,7 @@ public class Classification {
}
public static String ext2mime(final String ext) {
- return mimeTable.getProperty(ext, "application/" + ext);
+ return mimeTable.getProperty(ext, "application/" + (ext == null || ext.length() == 0 ? "octet-stream" : ext));
}
public static String ext2mime(final String ext, final String dfltMime) {