Scroogle is not comming back, remove dead code

Conflicts:
	source/net/yacy/search/Switchboard.java
pull/1/head
Roland 'Quix0r' Haeder 13 years ago committed by Michael Peter Christen
parent 7a4dab6d1d
commit af5a597e47

@ -1011,7 +1011,6 @@ about.body =
# search heuristics
heuristic.site = false
heuristic.scroogle = false
heuristic.blekko = false
# colours for generic design

@ -43,20 +43,6 @@
</p>
</fieldset>
</form>
<!--
<form id="HeuristicFormScroogle" method="post" action="ConfigHeuristics_p.html" enctype="multipart/form-data" accept-charset="UTF-8">
<fieldset>
<legend>
<input type="checkbox" name="scroogle_check" id="scroogle" onclick="window.location.href='ConfigHeuristics_p.html?#(scroogle.checked)#scroogle_on=::scroogle_off=#(/scroogle.checked)#'" value="scroogle"#(scroogle.checked)#:: checked="checked"#(/scroogle.checked)# />
<label for="scroogle">scroogle: load external search result list from <a href="http://scroogle.org">scroogle</a></label>
</legend>
<p>
When using this heuristic, then every search request line is used for a call to scroogle.
20 results are taken from scroogle and loaded simultanously, parsed and indexed immediately.
</p>
</fieldset>
</form>
-->
<form id="HeuristicFormBlekko" method="post" action="ConfigHeuristics_p.html" enctype="multipart/form-data" accept-charset="UTF-8">
<fieldset>
<legend>
@ -73,4 +59,4 @@
#%env/templates/footer.template%#
</body>
</html>
</html>

@ -45,14 +45,11 @@ public class ConfigHeuristics_p {
if (post.containsKey("site_on")) sb.setConfig("heuristic.site", true);
if (post.containsKey("site_off")) sb.setConfig("heuristic.site", false);
if (post.containsKey("scroogle_on")) sb.setConfig("heuristic.scroogle", true);
if (post.containsKey("scroogle_off")) sb.setConfig("heuristic.scroogle", false);
if (post.containsKey("blekko_on")) sb.setConfig("heuristic.blekko", true);
if (post.containsKey("blekko_off")) sb.setConfig("heuristic.blekko", false);
}
prop.put("site.checked", sb.getConfigBool("heuristic.site", false) ? 1 : 0);
prop.put("scroogle.checked", sb.getConfigBool("heuristic.scroogle", false) ? 1 : 0);
prop.put("blekko.checked", sb.getConfigBool("heuristic.blekko", false) ? 1 : 0);
return prop;

@ -87,7 +87,6 @@ public class ConfigNetwork_p
if ( !indexReceive ) {
// remove heuristics
sb.setConfig("heuristic.site", false);
sb.setConfig("heuristic.scroogle", false);
sb.setConfig("heuristic.blekko", false);
}
final boolean robinsonmode = "robinson".equals(post.get("network", ""));

@ -1190,7 +1190,6 @@ public final class Switchboard extends serverSwitch
// remove heuristics
setConfig("heuristic.site", false);
setConfig("heuristic.scroogle", false);
setConfig("heuristic.blekko", false);
// relocate
@ -3152,8 +3151,8 @@ public final class Switchboard extends serverSwitch
final Map<MultiProtocolURI, String> links;
searchEvent.getRankingResult().oneFeederStarted();
try {
links = Switchboard.this.loader.loadLinks(url, CacheStrategy.NOCACHE);
try {
links = Switchboard.this.loader.loadLinks(url, CacheStrategy.NOCACHE);
if ( links != null ) {
final Iterator<MultiProtocolURI> i = links.keySet().iterator();
while ( i.hasNext() ) {
@ -3166,59 +3165,7 @@ public final class Switchboard extends serverSwitch
addAllToIndex(url, links, searchEvent, "site");
}
} catch ( final Throwable e ) {
Log.logException(e);
} finally {
searchEvent.getRankingResult().oneFeederTerminated();
}
}
}.start();
}
public final void heuristicScroogle(final SearchEvent searchEvent) {
new Thread() {
@Override
public void run() {
QueryParams query = searchEvent.getQuery();
String queryString = query.queryString(true);
final int meta = queryString.indexOf("heuristic:", 0);
if ( meta >= 0 ) {
final int q = queryString.indexOf(' ', meta);
queryString =
(q >= 0)
? queryString.substring(0, meta) + queryString.substring(q + 1)
: queryString.substring(0, meta);
}
final String urlString =
"http://www.scroogle.org/cgi-bin/nbbw.cgi?Gw="
+ queryString.trim().replaceAll(" ", "+")
+ "&n=2";
final DigestURI url;
try {
url = new DigestURI(MultiProtocolURI.unescape(urlString));
} catch ( final MalformedURLException e1 ) {
Log.logWarning("heuristicScroogle", "url not well-formed: '" + urlString + "'");
return;
}
Map<MultiProtocolURI, String> links = null;
searchEvent.getRankingResult().oneFeederStarted();
try {
links = Switchboard.this.loader.loadLinks(url, CacheStrategy.NOCACHE);
if ( links != null ) {
final Iterator<MultiProtocolURI> i = links.keySet().iterator();
while ( i.hasNext() ) {
if ( i.next().toNormalform(false, false).indexOf("scroogle", 0) >= 0 ) {
i.remove();
}
}
Switchboard.this.log.logInfo("Heuristic: adding "
+ links.size()
+ " links from scroogle");
// add all pages to the index
addAllToIndex(null, links, searchEvent, "scroogle");
}
} catch ( final Throwable e ) {
//Log.logException(e);
Log.logException(e);
} finally {
searchEvent.getRankingResult().oneFeederTerminated();
}

Loading…
Cancel
Save