Skip to content

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

- navigation appear at correct position when opengeodb-results are also presented after a search - show an about box if about.headline and about.body is set

orbiter23ab6fbca4ed
diff --git a/defaults/yacy.init b/defaults/yacy.init
index bf0c048d6..a0e1ee316 100644
--- a/defaults/yacy.init
+++ b/defaults/yacy.init
@@ -915,3 +915,8 @@ content.phpbb3.dbuser = notroot
content.phpbb3.dbpw = joshua
content.phpbb3.ppf = 1000
content.phpbb3.dumpfile =
+
+# search engine teaser: an about box in search results
+# this is only shown, if the about.body is filled
+about.headline =
+about.body =
diff --git a/htroot/yacysearch.html b/htroot/yacysearch.html
index 974c3613c..bca85169c 100644
--- a/htroot/yacysearch.html
+++ b/htroot/yacysearch.html
@@ -56,6 +56,7 @@ $(function() {
$("#sidebar2").accordion('activate', false);
$("#sidebar3").accordion({});
$("#sidebar3").accordion('activate', false);
+ $("#sidebarAbout").accordion({});
$("#search").focus();
});
//]]>
@@ -128,9 +129,15 @@ document.getElementById("Enter").value = "search again";
<p>Searching the web with this peer is disabled for unauthorized users. Please <a href="Status.html?login=">log in</a> as administrator to use the search function</p>
#(/num-results)#
+<!-- the search results -->
+<script type="text/javascript">
+var progressbar = new Progressbar(#[results]#, document.getElementById("results"));
+</script>
+<div style="float:left; width:70%;">
+
<!-- show openstreetmap tiles if geoinfo was found -->
#(geoinfo)#
- ::
+ ::
<div class="searchresults">
<h4 class="linktitle">
<img src="http://www.openstreetmap.org/favicon.ico" class="favicon" style="width:16px; height:16px;" alt="" />
@@ -150,11 +157,6 @@ document.getElementById("Enter").value = "search again";
</div>
#(/geoinfo)#
-<!-- the search results -->
-<script type="text/javascript">
-var progressbar = new Progressbar(#[results]#, document.getElementById("results"));
-</script>
-<div style="float:left; width:70%;">
<!-- linklist begin -->
#(resultTable)#::<table width="100%"><tr class="TableHeader"><td width="30%">Media</td><td width="70%">URL</tr>#(/resultTable)#
#{results}#
diff --git a/htroot/yacysearchtrailer.html b/htroot/yacysearchtrailer.html
index 741b0ba3c..e6f868031 100644
--- a/htroot/yacysearchtrailer.html
+++ b/htroot/yacysearchtrailer.html
@@ -1,6 +1,6 @@
<div id="sidebar1" style="float: right; margin-top:5px; width: 220px;">
#(nav-domains)#::
-<h3 style="padding-left:25px;">Domains</h3>
+<h3 style="padding-left:25px;">Domain Navigator</h3>
<div><ul style="padding-left: 0px;">#{element}#
<li>#[url]#</li>
#{/element}#</ul></div>
@@ -9,7 +9,7 @@
<div id="sidebar2" style="float: right; margin-top:5px; width: 220px;">
#(nav-authors)#::
-<h3 style="padding-left:25px;">Authors</h3>
+<h3 style="padding-left:25px;">Author Navigator</h3>
<div><ul style="padding-left: 0px;">#{element}#
<li>#[url]#</li>
#{/element}#</ul></div>
@@ -18,12 +18,21 @@
<div id="sidebar3" style="float: right; margin-top:5px; width: 220px;">
#(nav-topics)#::
-<h3 style="padding-left:25px;">Topics</h3>
+<h3 style="padding-left:25px;">Topic Navigator</h3>
<div><ul style="padding-left: 0px;">#{element}#
<li>#[url]#</li>
#{/element}#</ul></div>
#(/nav-topics)#
</div>
+#(nav-about)#::
+<div id="sidebarAbout" style="float: right; margin-top:5px; width: 220px;">
+<h3 style="padding-left:25px;">#[headline]#</h3>
+<div>
+#[body]#
+</div>
+</div>
+#(/nav-about)#
+
diff --git a/htroot/yacysearchtrailer.java b/htroot/yacysearchtrailer.java
index 950b99cd5..46848e79a 100644
--- a/htroot/yacysearchtrailer.java
+++ b/htroot/yacysearchtrailer.java
@@ -104,7 +104,7 @@ public class yacysearchtrailer {
prop.put("nav-authors_element", authorNavigator.size());
}
- // attach always the topics
+ // topics navigator
ArrayList<NavigatorEntry> topicNavigator = theSearch.getTopicNavigator(10);
if (topicNavigator == null || topicNavigator.size() == 0) {
topicNavigator = new ArrayList<NavigatorEntry>();
@@ -132,6 +132,17 @@ public class yacysearchtrailer {
prop.put("nav-topics_element", i);
}
+ // about box
+ String aboutBody = env.getConfig("about.body", "");
+ String aboutHeadline = env.getConfig("about.headline", "");
+ if (aboutBody.length() == 0 && aboutHeadline.length() == 0) {
+ prop.put("nav-about", 0);
+ } else {
+ prop.put("nav-about", 1);
+ prop.put("nav-about_headline", aboutHeadline);
+ prop.put("nav-about_body", aboutBody);
+ }
+
serverProfiling.update("SEARCH", new ProfilingGraph.searchEvent(theQuery.id(true), SearchEvent.FINALIZATION + "-" + "bottomline", 0, 0), false);
return prop;
diff --git a/source/de/anomic/document/parser/html/ContentScraper.java b/source/de/anomic/document/parser/html/ContentScraper.java
index df42c9295..e1b4f5174 100644
--- a/source/de/anomic/document/parser/html/ContentScraper.java
+++ b/source/de/anomic/document/parser/html/ContentScraper.java
@@ -324,9 +324,9 @@ public class ContentScraper extends AbstractScraper implements Scraper {
public byte[] getText(final String charSet) {
try {
- return content.toString().getBytes(charSet);
+ return content.getBytes(charSet);
} catch (final UnsupportedEncodingException e) {
- return content.toString().getBytes();
+ return content.getBytes();
}
}
diff --git a/source/de/anomic/server/serverCharBuffer.java b/source/de/anomic/server/serverCharBuffer.java
index 735197c75..ed2f815cd 100644
--- a/source/de/anomic/server/serverCharBuffer.java
+++ b/source/de/anomic/server/serverCharBuffer.java
@@ -28,6 +28,7 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
+import java.io.UnsupportedEncodingException;
import java.io.Writer;
import java.util.Properties;
@@ -267,6 +268,18 @@ public final class serverCharBuffer extends Writer {
System.arraycopy(buffer, offset + start, tmp, 0, end - start);
return tmp;
}
+
+ public byte[] getBytes(String charset) throws UnsupportedEncodingException {
+ return new String(buffer, offset, length).getBytes(charset);
+ }
+
+ public byte[] getBytes() {
+ try {
+ return getBytes("UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ return null;
+ }
+ }
public serverCharBuffer trim(final int start) {
// the end value is outside (+1) of the wanted target array