Skip to content

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

added flags and administration options to show advanced search and to show search result attributes (for each search result) Administration can be done at ConfigPortal.html

orbiterfe93caac5a0c
diff --git a/defaults/yacy.init b/defaults/yacy.init
index e917a8d39..e90a41628 100644
--- a/defaults/yacy.init
+++ b/defaults/yacy.init
@@ -661,9 +661,9 @@ msgForwardingCmd=/usr/sbin/sendmail
msgForwardingTo=root@localhost
#crawlPause: delay time after specific functions before crawling is resumed
-crawlPause.proxy=100
-crawlPause.localsearch=1000
-crawlPause.remotesearch=500
+crawlPause.proxy=10
+crawlPause.localsearch=50
+crawlPause.remotesearch=10
# Some configuration values for the crawler
crawler.clientTimeout=9000
@@ -692,6 +692,9 @@ indexer.slots = 100
# maximum size of stacker queue
stacker.slots = 2000
+# search options: show advanced options on main search page
+search.options = true
+
# search domains. If set to false then that search is not available
search.text = true
search.image = true
@@ -708,6 +711,14 @@ search.items = 10
# "_top" (top of all frames), "searchresult" (a default custom page name for search results)
search.target = _self
+# search result lines may show additional information for each search hit
+# these information pieces may be switched on or off
+search.result.show.date = true
+search.result.show.size = true
+search.result.show.metadata = true
+search.result.show.parser = true
+search.result.show.pictures = true
+
# specifies if yacy should set it's own referer if no referer URL
# was set by the client.
useYacyReferer = false
diff --git a/htroot/ConfigPortal.html b/htroot/ConfigPortal.html
index 65dabd883..535c298c3 100644
--- a/htroot/ConfigPortal.html
+++ b/htroot/ConfigPortal.html
@@ -36,6 +36,21 @@
<input type="radio" name="publicTopmenu" value="false" #(publicTopmenu)#checked="checked"::#(/publicTopmenu)# />no link to YaCy Menu (admin must navigate to /Status.html manually)
</dd>
+ <dt>Show Advanced Search Options on Search Page?</dt>
+ <dd>
+ <input type="radio" name="search.options" value="true" #(search.options)#::checked="checked"#(/search.options)# />Show Advanced Search Options on index.html&nbsp;
+ <input type="radio" name="search.options" value="false" #(search.options)#checked="checked"::#(/search.options)# />do not show Advanced Search
+ </dd>
+
+ <dt>Show Information Links for each Search Result Entry</dt>
+ <dd>
+ <input type="checkbox" name="search.result.show.date" value="true" #(search.result.show.date)#::checked="checked"#(/search.result.show.date)# />Date&nbsp;
+ <input type="checkbox" name="search.result.show.size" value="true" #(search.result.show.size)#::checked="checked"#(/search.result.show.size)# />Size&nbsp;
+ <input type="checkbox" name="search.result.show.metadata" value="true" #(search.result.show.metadata)#::checked="checked"#(/search.result.show.metadata)# />Metadata&nbsp;
+ <input type="checkbox" name="search.result.show.parser" value="true" #(search.result.show.parser)#::checked="checked"#(/search.result.show.parser)# />Parser&nbsp;
+ <input type="checkbox" name="search.result.show.pictures" value="true" #(search.result.show.pictures)#::checked="checked"#(/search.result.show.pictures)# />Pictures
+ </dd>
+
<dt>Default Pop-Up Page</dt>
<dd>
<input type="radio" name="popup" value="status" #(popupStatus)#::checked="checked"#(/popupStatus)# />Status Page&nbsp;
diff --git a/htroot/ConfigPortal.java b/htroot/ConfigPortal.java
index b1b168f4e..6d6336f00 100644
--- a/htroot/ConfigPortal.java
+++ b/htroot/ConfigPortal.java
@@ -71,6 +71,12 @@ public class ConfigPortal {
sb.setConfig(SwitchboardConstants.INDEX_FORWARD, post.get(SwitchboardConstants.INDEX_FORWARD, ""));
HTTPDFileHandler.indexForward = post.get(SwitchboardConstants.INDEX_FORWARD, "");
sb.setConfig("publicTopmenu", post.get("publicTopmenu", "true"));
+ sb.setConfig("search.options", post.getBoolean("search.options", false) ? "true" : "false");
+ sb.setConfig("search.result.show.date", post.getBoolean("search.result.show.date", false) ? "true" : "false");
+ sb.setConfig("search.result.show.size", post.getBoolean("search.result.show.size", false) ? "true" : "false");
+ sb.setConfig("search.result.show.metadata", post.getBoolean("search.result.show.metadata", false) ? "true" : "false");
+ sb.setConfig("search.result.show.parser", post.getBoolean("search.result.show.parser", false) ? "true" : "false");
+ sb.setConfig("search.result.show.pictures", post.getBoolean("search.result.show.pictures", false) ? "true" : "false");
}
if (post.containsKey("searchpage_default")) {
sb.setConfig(SwitchboardConstants.GREETING, "P2P Web Search");
@@ -89,7 +95,13 @@ public class ConfigPortal {
prop.putHTML(SwitchboardConstants.GREETING_LARGE_IMAGE, sb.getConfig(SwitchboardConstants.GREETING_LARGE_IMAGE, ""));
prop.putHTML(SwitchboardConstants.GREETING_SMALL_IMAGE, sb.getConfig(SwitchboardConstants.GREETING_SMALL_IMAGE, ""));
prop.putHTML(SwitchboardConstants.INDEX_FORWARD, sb.getConfig(SwitchboardConstants.INDEX_FORWARD, ""));
- prop.put("publicTopmenu", sb.getConfig("publicTopmenu", "").equals("true") ? 1 : 0);
+ prop.put("publicTopmenu", sb.getConfigBool("publicTopmenu", false) ? 1 : 0);
+ prop.put("search.options", sb.getConfigBool("search.options", false) ? 1 : 0);
+ prop.put("search.result.show.date", sb.getConfigBool("search.result.show.date", false) ? 1 : 0);
+ prop.put("search.result.show.size", sb.getConfigBool("search.result.show.size", false) ? 1 : 0);
+ prop.put("search.result.show.metadata", sb.getConfigBool("search.result.show.metadata", false) ? 1 : 0);
+ prop.put("search.result.show.parser", sb.getConfigBool("search.result.show.parser", false) ? 1 : 0);
+ prop.put("search.result.show.pictures", sb.getConfigBool("search.result.show.pictures", false) ? 1 : 0);
final String browserPopUpPage = sb.getConfig(SwitchboardConstants.BROWSER_POP_UP_PAGE, "ConfigBasic.html");
prop.put("popupFront", 0);
diff --git a/htroot/env/templates/header.template b/htroot/env/templates/header.template
index afa1092ad..6c17c3f1c 100644
--- a/htroot/env/templates/header.template
+++ b/htroot/env/templates/header.template
@@ -68,7 +68,7 @@
<li class="menugroup" id="menugroupIntegration">
<h3>Search Integration</h3>
<ul class="menu">
- <li><a href="/ConfigLiveSearch.html" class="MenuItemLink">Search Portals</a></li>
+ <li><a href="/ConfigPortal.html" class="MenuItemLink">Search Portals</a></li>
<li><a href="/ConfigAppearance_p.html" class="MenuItemLink lock">Customization</a></li>
</ul>
</li>
diff --git a/htroot/env/templates/submenuPortalIntegration.template b/htroot/env/templates/submenuPortalIntegration.template
index 1204ce906..ee2aaba1f 100644
--- a/htroot/env/templates/submenuPortalIntegration.template
+++ b/htroot/env/templates/submenuPortalIntegration.template
@@ -1,8 +1,8 @@
<div class="SubMenu">
<h3>Search Portal Integration</h3>
<ul class="SubMenu">
- <li><a href="/ConfigLiveSearch.html" class="MenuItemLink">Live Search Anywhere</a></li>
<li><a href="/ConfigPortal.html" class="MenuItemLink">Generic Search Portal</a></li>
+ <li><a href="/ConfigLiveSearch.html" class="MenuItemLink">Live Search Anywhere</a></li>
<li><a href="/ConfigSearchBox.html" class="MenuItemLink">Search Box Anywhere</a></li>
</ul>
</div>
\ No newline at end of file
diff --git a/htroot/index.html b/htroot/index.html
index 7b13c043d..1fcf985b9 100644
--- a/htroot/index.html
+++ b/htroot/index.html
@@ -60,7 +60,7 @@
</div>
#(/searchdomswitches)#
<input type="hidden" name="nav" value="all" />
- #(searchoptions)#
+ #(searchoptions)#::
<input type="hidden" name="maximumRecords" value="#[maximumRecords]#" />
<input type="hidden" name="startRecord" value="0" />
<input type="hidden" name="resource" value="global" />
@@ -69,7 +69,7 @@
<input type="hidden" name="indexof" value="off" />
<input type="hidden" name="meanCount" value="5" />
</fieldset>
- <p><a href="/index.html?searchoptions=1" onclick="this.href='/index.html?searchoptions=1&amp;former='+document.getElementById('searchform').search.value+'&amp;contentdom='+radioValue(document.getElementById('searchform').contentdom)">more options...</a></p>
+ <p><a href="/index.html?searchoptions=2" onclick="this.href='/index.html?searchoptions=2&amp;former='+document.getElementById('searchform').search.value+'&amp;contentdom='+radioValue(document.getElementById('searchform').contentdom)">more options...</a></p>
<p><a href="http://www.yacy-websuche.de/wiki/index.php/En:SearchParameters">advanced parameters</a></p>
::
</fieldset>
diff --git a/htroot/index.java b/htroot/index.java
index d3badf413..4c985ab95 100644
--- a/htroot/index.java
+++ b/htroot/index.java
@@ -64,7 +64,8 @@ public class index {
final boolean global = (post == null) ? true : post.get("resource", "global").equals("global");
- final int searchoptions = (post == null) ? 0 : post.getInt("searchoptions", 0);
+ int searchoptions = (post == null) ? 1 : post.getInt("searchoptions", 1);
+ if (!sb.getConfigBool("search.options", true)) searchoptions = 0;
final String former = (post == null) ? "" : post.get("former", "");
final int count = Math.min(100, (post == null) ? 10 : post.getInt("count", 10));
final int maximumRecords = Integer.parseInt((sb.getConfig(SwitchboardConstants.SEARCH_ITEMS, "10")));
diff --git a/htroot/yacysearchitem.html b/htroot/yacysearchitem.html
index 4b43e8f1b..b1f88a6ed 100644
--- a/htroot/yacysearchitem.html
+++ b/htroot/yacysearchitem.html
@@ -21,7 +21,12 @@
</div>
<p class="snippet"><span class="snippetLoaded" id="h#[urlhash]#">#[description]#</span></p>
<p class="url"><a href="#[link]#" id="url#[urlhash]#" target="#[target]#">#[urlname]#</a></p>
- <p class="urlinfo">#[date]# | #[sizename]# | <a href="api/yacydoc.html?urlhash=#[urlhash]#" onclick="return hs.htmlExpand(this, { objectType: 'ajax'} )">Metadata</a> | <a href="ViewFile.html?urlHash=#[urlhash]#&amp;words=#[words]#&amp">Parser</a> | <a href="yacysearch.html?cat=image&amp;url=#[link]#&amp;query=#[former]#">Pictures</a></p>
+ <p class="urlinfo">
+ #(showDate)#::#[date]##(/showDate)#
+ #(showSize)#::&nbsp;|&nbsp;#[sizename]##(/showSize)#
+ #(showMetadata)#::&nbsp;|&nbsp;<a href="api/yacydoc.html?urlhash=#[urlhash]#" onclick="return hs.htmlExpand(this, { objectType: 'ajax'} )">Metadata</a>#(/showMetadata)#
+ #(showParser)#::&nbsp;|&nbsp;<a href="ViewFile.html?urlHash=#[urlhash]#&amp;words=#[words]#&amp">Parser</a>#(/showParser)#
+ #(showPictures)#::&nbsp;|&nbsp;<a href="yacysearch.html?cat=image&amp;url=#[link]#&amp;query=#[former]#">Pictures</a></p>#(/showPictures)#
</div>
::
#(item)#::<div class="thumbcontainer">
diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.java
index 2d516c3ac..e16eead4f 100644
--- a/htroot/yacysearchitem.java
+++ b/htroot/yacysearchitem.java
@@ -116,6 +116,11 @@ public class yacysearchitem {
}
prop.put("content", 1); // switch on specific content
+ prop.put("content_showDate", sb.getConfigBool("search.result.show.date", true) ? 1 : 0);
+ prop.put("content_showSize", sb.getConfigBool("search.result.show.size", true) ? 1 : 0);
+ prop.put("content_showMetadata", sb.getConfigBool("search.result.show.metadata", true) ? 1 : 0);
+ prop.put("content_showParser", sb.getConfigBool("search.result.show.parser", true) ? 1 : 0);
+ prop.put("content_showPictures", sb.getConfigBool("search.result.show.pictures", true) ? 1 : 0);
prop.put("content_authorized", authenticated ? "1" : "0");
prop.put("content_authorized_recommend", (sb.peers.newsPool.getSpecific(yacyNewsPool.OUTGOING_DB, yacyNewsPool.CATEGORY_SURFTIPP_ADD, "url", result.urlstring()) == null) ? "1" : "0");
prop.putHTML("content_authorized_recommend_deletelink", "/yacysearch.html?query=" + theQuery.queryString.replace(' ', '+') + "&Enter=Search&count=" + theQuery.displayResults() + "&offset=" + (theQuery.neededResults() - theQuery.displayResults()) + "&order=" + crypt.simpleEncode(theQuery.ranking.toExternalString()) + "&resource=local&time=3&deleteref=" + new String(result.hash()) + "&urlmaskfilter=.*");
@@ -126,17 +131,21 @@ public class yacysearchitem {
prop.putXML("content_title-xml", result.title());
prop.putJSON("content_title-json", result.title());
prop.putHTML("content_link", result.urlstring());
+ prop.putHTML("content_showPictures_link", result.urlstring());
prop.putHTML("content_target", target);
if (faviconURL != null && isHtml) sb.loader.loadIfNotExistBackground(faviconURL.toNormalform(true, false), 1024 * 1024 * 10);
prop.putHTML("content_faviconCode", sb.licensedURLs.aquireLicense(faviconURL)); // acquire license for favicon url loading
prop.put("content_urlhash", resulthashString);
+ prop.put("content_showMetadata_urlhash", resulthashString);
+ prop.put("content_showParser_urlhash", resulthashString);
prop.put("content_urlhexhash", yacySeed.b64Hash2hexHash(resulthashString));
prop.putHTML("content_urlname", nxTools.shortenURLString(result.urlname(), urllength));
- prop.put("content_date", GenericFormatter.RFC1123_SHORT_FORMATTER.format(result.modified()));
+ prop.put("content_showDate_date", GenericFormatter.RFC1123_SHORT_FORMATTER.format(result.modified()));
prop.put("content_date822", HeaderFramework.formatRFC1123(result.modified()));
//prop.put("content_ybr", RankingProcess.ybr(result.hash()));
prop.putHTML("content_size", Integer.toString(result.filesize())); // we don't use putNUM here because that number shall be usable as sorting key. To print the size, use 'sizename'
prop.putHTML("content_sizename", sizename(result.filesize()));
+ prop.putHTML("content_showSize_sizename", sizename(result.filesize()));
prop.putHTML("content_host", resultURL.getHost() == null ? "" : resultURL.getHost());
prop.putHTML("content_file", resultURL.getFile());
prop.putHTML("content_path", resultURL.getPath());
@@ -148,7 +157,9 @@ public class yacysearchitem {
String s = ""; for (String t: query[0]) s += "+" + t;
if (s.length() > 0) s = s.substring(1);
prop.putHTML("content_words", s);
+ prop.putHTML("content_showParser_words", s);
prop.putHTML("content_former", theQuery.queryString);
+ prop.putHTML("content_showPictures_former", theQuery.queryString);
final TextSnippet snippet = result.textSnippet();
final String desc = (snippet == null) ? "" : snippet.getLineMarked(theQuery.fullqueryHashes);
prop.put("content_description", desc);
diff --git a/source/de/anomic/server/serverObjects.java b/source/de/anomic/server/serverObjects.java
index 0b553ae5c..d324bb99d 100644
--- a/source/de/anomic/server/serverObjects.java
+++ b/source/de/anomic/server/serverObjects.java
@@ -299,6 +299,13 @@ public class serverObjects extends HashMap<String, String> implements Cloneable
return dflt;
}
}
+
+ public boolean getBoolean(final String key, final boolean dflt) {
+ String s = removeBOM(super.get(key));
+ if (s == null) return dflt;
+ s = s.toLowerCase();
+ return s.equals("true") || s.equals("on") || s.equals("1");
+ }
public boolean hasValue(final String key) {
final String s = super.get(key);
diff --git a/source/net/yacy/kelondro/blob/ArrayStack.java b/source/net/yacy/kelondro/blob/ArrayStack.java
index 87fa765c4..8c17b63ef 100755
--- a/source/net/yacy/kelondro/blob/ArrayStack.java
+++ b/source/net/yacy/kelondro/blob/ArrayStack.java
@@ -269,11 +269,11 @@ public class ArrayStack implements BLOB {
return f;
}
- public synchronized File[] unmountBestMatch(double maxq, long maxResultSize) {
+ public synchronized File[] unmountBestMatch(float maxq, long maxResultSize) {
if (this.blobs.size() < 2) return null;
long l, r;
File lf, rf;
- double min = Double.MAX_VALUE;
+ float min = Float.MAX_VALUE;
File[] bestMatch = new File[2];
maxResultSize = maxResultSize >> 1;
int loopcount = 0;
@@ -285,13 +285,13 @@ public class ArrayStack implements BLOB {
l = 1 + (lf.length() >> 1);
r = 1 + (rf.length() >> 1);
if (l + r > maxResultSize) continue;
- double q = Math.max((double) l, (double) r) / Math.min((double) l, (double) r);
+ float q = Math.max((float) l, (float) r) / Math.min((float) l, (float) r);
if (q < min) {
min = q;
bestMatch[0] = lf;
bestMatch[1] = rf;
}
- if (loopcount > 1000 && min <= maxq && min != Double.MAX_VALUE) break mainloop;
+ if (loopcount > 1000 && min <= maxq && min != Float.MAX_VALUE) break mainloop;
}
}
if (min > maxq) return null;
diff --git a/source/net/yacy/kelondro/rwi/ReferenceContainerArray.java b/source/net/yacy/kelondro/rwi/ReferenceContainerArray.java
index dbdbf251f..5eb655ff4 100644
--- a/source/net/yacy/kelondro/rwi/ReferenceContainerArray.java
+++ b/source/net/yacy/kelondro/rwi/ReferenceContainerArray.java
@@ -317,7 +317,7 @@ public final class ReferenceContainerArray<ReferenceType extends Reference> {
// first try to merge small files that match
while (this.merger.queueLength() < 3 || this.array.entries() >= 50) {
- File[] ff = this.array.unmountBestMatch(2.0, targetFileSize);
+ File[] ff = this.array.unmountBestMatch(2.0f, targetFileSize);
if (ff == null) break;
Log.logInfo("RICELL-shrink1", "unmountBestMatch(2.0, " + targetFileSize + ")");
merger.merge(ff[0], ff[1], this.factory, this.array, this.payloadrow, newContainerBLOBFile());
@@ -335,7 +335,7 @@ public final class ReferenceContainerArray<ReferenceType extends Reference> {
// if there is no small file, then merge matching files up to limit
while (this.merger.queueLength() < 1) {
- File[] ff = this.array.unmountBestMatch(2.0, maxFileSize);
+ File[] ff = this.array.unmountBestMatch(2.0f, maxFileSize);
if (ff == null) break;
Log.logInfo("RICELL-shrink3", "unmountBestMatch(2.0, " + maxFileSize + ")");
merger.merge(ff[0], ff[1], this.factory, this.array, this.payloadrow, newContainerBLOBFile());