implemented interactive link deletion of search results.

next steps: attach voting and restrict to administrator
to see the deletion button, move the mouse pointer to the left of a search result

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1172 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 20 years ago
parent 6d0f7e6988
commit 8f1f2daa5e

@ -60,7 +60,6 @@ import de.anomic.http.httpRemoteProxyConfig;
import de.anomic.http.httpd; import de.anomic.http.httpd;
import de.anomic.http.httpdProxyHandler; import de.anomic.http.httpdProxyHandler;
import de.anomic.plasma.plasmaParser; import de.anomic.plasma.plasmaParser;
import de.anomic.plasma.plasmaParserConfig;
import de.anomic.plasma.plasmaSwitchboard; import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.server.serverCodings; import de.anomic.server.serverCodings;
import de.anomic.server.serverCore; import de.anomic.server.serverCore;

@ -7,6 +7,14 @@
</head> </head>
<body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0"> <body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0">
#%env/templates/header.template%# #%env/templates/header.template%#
<SCRIPT LANGUAGE="JavaScript">
picEmpty = new Image(11, 11);
picEmpty.src = "/env/grafics/empty.gif";
picMinus = new Image(11, 11);
picMinus.src = "/env/grafics/minus.gif";
</SCRIPT>
<br> <br>
<center><h2><font size="2" face="Helvetica, Arial" color="#212942"><img src="/env/grafics/kaskelix.png" align="middle" alt="YaCy logo Kaskelix"><br>P2P WEB SEARCH</font></h2></center><br> <center><h2><font size="2" face="Helvetica, Arial" color="#212942"><img src="/env/grafics/kaskelix.png" align="middle" alt="YaCy logo Kaskelix"><br>P2P WEB SEARCH</font></h2></center><br>
<center>#[promoteSearchPageGreeting]#</center><br> <center>#[promoteSearchPageGreeting]#</center><br>
@ -109,10 +117,13 @@ from 'late' peers.
#{results}# #{results}#
<!-- link begin --> <!-- link begin -->
<p><b>#[description]#</b><br> <p>
#(snippet)#::<i>#[text]#</i><br>#(/snippet)# <a href="#[delete]#" onMouseover="document.minus_#[urlhexhash]#.src=picMinus.src" onMouseout="document.minus_#[urlhexhash]#.src=picEmpty.src">
<a href="#[url]#">#[urlname]#</a><br> <img src="/env/grafics/empty.gif" name="minus_#[urlhexhash]#"></a>&nbsp;<b>#[description]#</b><br>
#[date]# | YBR-#[ybr]# | <a href="ViewFile.html?urlHash=#[urlhash]#&words=#[words]#">Info</a><br></p> #(snippet)#::<img src="/env/grafics/empty.gif">&nbsp;<i>#[text]#</i><br>#(/snippet)#
<img src="/env/grafics/empty.gif">&nbsp;<a href="#[url]#">#[urlname]#</a><br>
<img src="/env/grafics/empty.gif">&nbsp;#[date]# | YBR-#[ybr]# | <a href="ViewFile.html?urlHash=#[urlhash]#&words=#[words]#">Info</a><br>
</p>
<!-- link end --> <!-- link end -->
#{/results}# #{/results}#

@ -135,6 +135,12 @@ public class index {
kelondroMSetTools.excludeDestructive(query, plasmaSwitchboard.stopwords); kelondroMSetTools.excludeDestructive(query, plasmaSwitchboard.stopwords);
} }
// if a minus-button was hit, remove a special reference first
if (post.containsKey("deleteref")) {
final String delHash = (String) post.get("deleteref", "");
sb.removeReferences(delHash, query);
}
// prepare search order // prepare search order
final String order = (String) post.get("order", ""); final String order = (String) post.get("order", "");
final int count = Integer.parseInt((String) post.get("count", "10")); final int count = Integer.parseInt((String) post.get("count", "10"));
@ -185,7 +191,7 @@ public class index {
if (((String) post.get("search", "")).length() < 3) { if (((String) post.get("search", "")).length() < 3) {
prop.put("num-results", 2); // no results - at least 3 chars prop.put("num-results", 2); // no results - at least 3 chars
} else { } else {
prop.put("num-results", 1);//no results prop.put("num-results", 1); //no results
} }
} else { } else {
final int linkcount = Integer.parseInt(prop.get("linkcount", "0")); final int linkcount = Integer.parseInt(prop.get("linkcount", "0"));

@ -51,6 +51,7 @@ import de.anomic.htmlFilter.htmlFilterContentScraper;
import de.anomic.http.httpHeader; import de.anomic.http.httpHeader;
import de.anomic.plasma.plasmaCrawlLURL; import de.anomic.plasma.plasmaCrawlLURL;
import de.anomic.plasma.plasmaSwitchboard; import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.plasma.plasmaURL;
import de.anomic.server.serverObjects; import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch; import de.anomic.server.serverSwitch;
import de.anomic.tools.crypt; import de.anomic.tools.crypt;
@ -242,7 +243,7 @@ public final class crawlOrder {
// case where we have already the url loaded; // case where we have already the url loaded;
reason = reasonString; reason = reasonString;
// send lurl-Entry as response // send lurl-Entry as response
plasmaCrawlLURL.Entry entry = switchboard.urlPool.loadedURL.getEntry(plasmaCrawlLURL.urlHash(url)); plasmaCrawlLURL.Entry entry = switchboard.urlPool.loadedURL.getEntry(plasmaURL.urlHash(url));
if (entry != null) { if (entry != null) {
response = "double"; response = "double";
switchboard.urlPool.loadedURL.notifyGCrawl(entry.hash(), iam, youare); switchboard.urlPool.loadedURL.notifyGCrawl(entry.hash(), iam, youare);

@ -63,9 +63,9 @@ import java.net.InetAddress;
import java.net.ServerSocket; import java.net.ServerSocket;
import java.net.Socket; import java.net.Socket;
import java.text.DateFormat; import java.text.DateFormat;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.GregorianCalendar;
import java.util.Properties; import java.util.Properties;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.util.TimeZone; import java.util.TimeZone;
@ -1618,7 +1618,7 @@ cd ..
private void get(String fileDest, String fileName) throws IOException { private void get(String fileDest, String fileName) throws IOException {
// store time for statistics // store time for statistics
long start = GregorianCalendar.getInstance(GMTTimeZone).getTime().getTime(); long start = Calendar.getInstance(GMTTimeZone).getTime().getTime();
// prepare data channel // prepare data channel
if (DataSocketPassiveMode) createPassiveDataPort(); else createActiveDataPort(); if (DataSocketPassiveMode) createPassiveDataPort(); else createActiveDataPort();
@ -1674,7 +1674,7 @@ cd ..
//if (!success) throw new IOException(reply); //if (!success) throw new IOException(reply);
// write statistics // write statistics
long stop = GregorianCalendar.getInstance(GMTTimeZone).getTime().getTime(); long stop = Calendar.getInstance(GMTTimeZone).getTime().getTime();
out.print("---- downloaded " + out.print("---- downloaded " +
((length < 2048) ? length + " bytes" : ((int) length / 1024) + " kbytes") + ((length < 2048) ? length + " bytes" : ((int) length / 1024) + " kbytes") +
" in " + " in " +

@ -46,15 +46,15 @@ import java.util.Set;
import java.util.TreeSet; import java.util.TreeSet;
import java.util.Iterator; import java.util.Iterator;
import de.anomic.htmlFilter.htmlFilterContentScraper; import de.anomic.htmlFilter.htmlFilterAbstractScraper;
import de.anomic.kelondro.kelondroMSetTools; import de.anomic.kelondro.kelondroMSetTools;
import de.anomic.server.serverByteBuffer; import de.anomic.server.serverByteBuffer;
public final class plasmaSearchQuery { public final class plasmaSearchQuery {
public static final String ORDER_QUALITY = "quality"; public static final String ORDER_QUALITY = "Quality";
public static final String ORDER_DATE = "date"; public static final String ORDER_DATE = "Date";
public static final String ORDER_YBR = "ybr"; public static final String ORDER_YBR = "YBR";
public static final int SEARCHDOM_LOCAL = 0; public static final int SEARCHDOM_LOCAL = 0;
public static final int SEARCHDOM_GROUPDHT = 1; public static final int SEARCHDOM_GROUPDHT = 1;
@ -102,6 +102,10 @@ public final class plasmaSearchQuery {
this.domMaxTargets = -1; this.domMaxTargets = -1;
} }
public String orderString() {
return order[0] + "-" + order[1] + "-" + order[2];
}
public static Set words2hashes(String[] words) { public static Set words2hashes(String[] words) {
TreeSet hashes = new TreeSet(); TreeSet hashes = new TreeSet();
for (int i = 0; i < words.length; i++) hashes.add(plasmaWordIndexEntry.word2hash(words[i])); for (int i = 0; i < words.length; i++) hashes.add(plasmaWordIndexEntry.word2hash(words[i]));
@ -117,7 +121,7 @@ public final class plasmaSearchQuery {
public static TreeSet cleanQuery(String words) { public static TreeSet cleanQuery(String words) {
// convert Umlaute // convert Umlaute
words = htmlFilterContentScraper.convertUmlaute(new serverByteBuffer(words.getBytes())).toString(); words = htmlFilterAbstractScraper.convertUmlaute(new serverByteBuffer(words.getBytes())).toString();
// remove funny symbols // remove funny symbols
final String seps = "' .,:/-&"; final String seps = "' .,:/-&";
@ -135,6 +139,32 @@ public final class plasmaSearchQuery {
return query; return query;
} }
public int size() {
return queryHashes.size();
}
public String words(String separator) {
StringBuffer result = new StringBuffer(8 * queryWords.size());
Iterator i = queryWords.iterator();
if (i.hasNext()) result.append((String) i.next());
while (i.hasNext()) {
result.append(separator);
result.append((String) i.next());
}
return result.toString();
}
public String hashes(String separator) {
StringBuffer result = new StringBuffer(8 * queryHashes.size());
Iterator i = queryHashes.iterator();
if (i.hasNext()) result.append((String) i.next());
while (i.hasNext()) {
result.append(separator);
result.append((String) i.next());
}
return result.toString();
}
public void filterOut(Set blueList) { public void filterOut(Set blueList) {
// filter out words that appear in this set // filter out words that appear in this set
Iterator it = queryWords.iterator(); Iterator it = queryWords.iterator();

@ -1558,7 +1558,6 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
if (date == null) return ""; else return DateFormatter.format(date); if (date == null) return ""; else return DateFormatter.format(date);
} }
//public serverObjects searchFromLocal(Set querywords, String order1, String order2, int count, boolean global, long time /*milliseconds*/, String urlmask) {
public serverObjects searchFromLocal(plasmaSearchQuery query) { public serverObjects searchFromLocal(plasmaSearchQuery query) {
// tell all threads to do nothing for a specific time // tell all threads to do nothing for a specific time
@ -1607,6 +1606,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
String host, hash, address, descr = ""; String host, hash, address, descr = "";
yacySeed seed; yacySeed seed;
plasmaSnippetCache.result snippet; plasmaSnippetCache.result snippet;
String formerSearch = query.words(" ");
long targetTime = timestamp + query.maximumTime; long targetTime = timestamp + query.maximumTime;
if (targetTime < System.currentTimeMillis()) targetTime = System.currentTimeMillis() + 5000; if (targetTime < System.currentTimeMillis()) targetTime = System.currentTimeMillis() + 5000;
while ((acc.hasMoreElements()) && (i < query.wantedResults) && (System.currentTimeMillis() < targetTime)) { while ((acc.hasMoreElements()) && (i < query.wantedResults) && (System.currentTimeMillis() < targetTime)) {
@ -1652,9 +1652,11 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
if (snippet.source == plasmaSnippetCache.ERROR_NO_MATCH) { if (snippet.source == plasmaSnippetCache.ERROR_NO_MATCH) {
// suppress line: there is no match in that resource // suppress line: there is no match in that resource
} else { } else {
prop.put("results_" + i + "_delete", "/index.html?search=" + formerSearch + "&Enter=Search&count=" + query.wantedResults + "&order=" + query.orderString() + "&resource=local&time=3&deleteref=" + urlhash + "&urlmaskfilter=.*");
prop.put("results_" + i + "_description", descr); prop.put("results_" + i + "_description", descr);
prop.put("results_" + i + "_url", urlstring); prop.put("results_" + i + "_url", urlstring);
prop.put("results_" + i + "_urlhash", urlhash); prop.put("results_" + i + "_urlhash", urlhash);
prop.put("results_" + i + "_urlhexhash", yacySeed.b64Hash2hexHash(urlhash));
prop.put("results_" + i + "_urlname", nxTools.cutUrlText(urlname, 120)); prop.put("results_" + i + "_urlname", nxTools.cutUrlText(urlname, 120));
prop.put("results_" + i + "_date", dateString(urlentry.moddate())); prop.put("results_" + i + "_date", dateString(urlentry.moddate()));
prop.put("results_" + i + "_ybr", plasmaSearchPreOrder.ybr(urlentry.hash())); prop.put("results_" + i + "_ybr", plasmaSearchPreOrder.ybr(urlentry.hash()));

@ -189,7 +189,7 @@ public final class plasmaWordIndexEntry {
// ** hier fehlt noch als Attribut: <Wortposition im Text>, damit 'nearby' getrackt werden kann ** // ** hier fehlt noch als Attribut: <Wortposition im Text>, damit 'nearby' getrackt werden kann **
if ((language == null) || (language.length() != plasmaCrawlLURL.urlLanguageLength)) language = "uk"; if ((language == null) || (language.length() != plasmaURL.urlLanguageLength)) language = "uk";
this.urlHash = urlHash; this.urlHash = urlHash;
this.count = count; this.count = count;
this.posintext = posintext; this.posintext = posintext;

@ -69,7 +69,7 @@ public final class serverDate {
//private final static String[] month = {"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"}; //private final static String[] month = {"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
// find out time zone and DST offset // find out time zone and DST offset
private static Calendar thisCalendar = GregorianCalendar.getInstance(); private static Calendar thisCalendar = Calendar.getInstance();
//private static long zoneOffsetHours = thisCalendar.get(Calendar.ZONE_OFFSET); //private static long zoneOffsetHours = thisCalendar.get(Calendar.ZONE_OFFSET);
//private static long DSTOffsetHours = thisCalendar.get(Calendar.DST_OFFSET); //private static long DSTOffsetHours = thisCalendar.get(Calendar.DST_OFFSET);
//private static long offsetHours = zoneOffsetHours + DSTOffsetHours; // this must be subtracted from current Date().getTime() to produce a GMT Time //private static long offsetHours = zoneOffsetHours + DSTOffsetHours; // this must be subtracted from current Date().getTime() to produce a GMT Time

Loading…
Cancel
Save