Skip to content

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

*) adding image tag into rss template *) adding a xslt stylesheet so that the rss document can be viewed in a normal webbrowser *) adding pubDate tag to each search item

theli74eb21f62e5e
diff --git a/htroot/index.java b/htroot/index.java
index ce75f2fe2..79818d952 100644
--- a/htroot/index.java
+++ b/htroot/index.java
@@ -244,7 +244,13 @@ public class index {
// return rewrite properties
prop.put("promoteSearchPageGreeting", env.getConfig("promoteSearchPageGreeting", ""));
- return prop;
+
+ // adding some additional properties needed for the rss feed
+ String hostName = (String) header.get("Host","localhost");
+ if (hostName.indexOf(":") == -1) hostName += ":" + env.getConfig("port","8080");
+ prop.put("rssYacyImageURL","http://" + hostName + "/env/grafics/yacy.gif");
+
+ return prop;
}
public static TreeSet cleanQuery(String words) {
diff --git a/htroot/index.rss b/htroot/index.rss
index 8dcdf599d..225fc8e3c 100644
--- a/htroot/index.rss
+++ b/htroot/index.rss
@@ -1,12 +1,18 @@
<?xml version="1.0"?>
+<?xml-stylesheet type='text/xsl' href='/index.xsl' version='1.0'?>
<rss version="2.0" xmlns:yacyTopwords="http://www.yacy.net/yacy/topwords">
<channel>
<title>Search for #[former]#</title>
<description>Search for #[former]#</description>
+ <image>
+ <url>#[rssYacyImageURL]#</url>
+ <title>Search for #[former]#</title>
+ </image>
#{results}#
<item>
<title>#[description]#</title>
<link>#[url]#</link>
+ <pubDate>#[date]#</pubDate>
</item>
#{/results}#
<yacyTopwords:topwords>
diff --git a/httpd.mime b/httpd.mime
index fce0b4c22..f0cf1d6a7 100644
--- a/httpd.mime
+++ b/httpd.mime
@@ -73,6 +73,7 @@ wav = audio/x-wav
xhtml = application/xhtml+xml
xla = application/msexcel
xls = application/msexcel
+xsl = application/xml
xml = application/xml
Z = application/x-compress
zip = application/zip
diff --git a/source/de/anomic/plasma/parser/mimeType/mimeTypeParser.java b/source/de/anomic/plasma/parser/mimeType/mimeTypeParser.java
index cc2d36c10..910ac7f3c 100644
--- a/source/de/anomic/plasma/parser/mimeType/mimeTypeParser.java
+++ b/source/de/anomic/plasma/parser/mimeType/mimeTypeParser.java
@@ -65,7 +65,7 @@ import de.anomic.server.serverFileUtils;
public class mimeTypeParser
extends AbstractParser
implements Parser {
-
+
/**
* a list of mime types that are supported by this parser class
* @see #getSupportedMimeTypes()
@@ -88,10 +88,10 @@ implements Parser {
"xerces.jar"
};
- public mimeTypeParser() {
- super(LIBX_DEPENDENCIES);
- }
-
+ public mimeTypeParser() {
+ super(LIBX_DEPENDENCIES);
+ }
+
public plasmaParserDocument parse(URL location, String mimeType, File sourceFile) throws ParserException {
// determining the mime type of the file ...
@@ -113,6 +113,9 @@ implements Parser {
mimeType = match.getMimeType();
}
+ // to avoid loops we have to test if the mimetype has changed ...
+ if (this.getSupportedMimeTypes().containsKey(mimeType)) return null;
+
plasmaParser theParser = new plasmaParser();
return theParser.parseSource(location,mimeType,sourceFile);
}
@@ -123,8 +126,8 @@ implements Parser {
}
}
- public plasmaParserDocument parse(URL location, String mimeType,
- InputStream source) throws ParserException {
+ public plasmaParserDocument parse(URL location, String mimeType,
+ InputStream source) throws ParserException {
File dstFile = null;
try {
dstFile = File.createTempFile("mimeTypeParser",".tmp");
@@ -136,14 +139,14 @@ implements Parser {
if (dstFile != null) {dstFile.delete();}
}
- }
-
- public java.util.Hashtable getSupportedMimeTypes() {
- return mimeTypeParser.SUPPORTED_MIME_TYPES;
- }
-
- public void reset() {
+ }
+
+ public java.util.Hashtable getSupportedMimeTypes() {
+ return mimeTypeParser.SUPPORTED_MIME_TYPES;
+ }
+
+ public void reset() {
// Nothing todo here at the moment
- }
-
+ }
+
}
diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.java
index d7f83f24d..cab092994 100644
--- a/source/de/anomic/plasma/plasmaSwitchboard.java
+++ b/source/de/anomic/plasma/plasmaSwitchboard.java
@@ -1103,7 +1103,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
prop.put("results_" + i + "_description", descr);
prop.put("results_" + i + "_url", urlstring);
prop.put("results_" + i + "_urlname", urlname);
- prop.put("results_" + i + "_date", dateString(urlentry.moddate()));
+ prop.put("results_" + i + "_date", dateString(urlentry.moddate()));
+ prop.put("results_" + i + "_size", Long.toString(urlentry.size()));
i++;
}
}