Skip to content

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

*) added peer-search to Network.html

hydroxfaad86986597
diff --git a/htroot/Network.html b/htroot/Network.html
index 6ea87f604..8a67892ce 100644
--- a/htroot/Network.html
+++ b/htroot/Network.html
@@ -30,6 +30,12 @@
<p>no remote #[peertype]# peer for this list known</p>
::
<p>Showing #[num]# entries from a total of #[total]# peers.</p>
+ <form action="Network.html?page=#[page]#" method="get" enctype="multipart/form-data" accept-charset="UTF-8">
+ <fieldset>
+ Search for a peername (RegExp allowed):
+ <input type="text" name="match" value="#[searchpattern]#" /><input type="hidden" name="page" value="#[page]#" /><input type="submit" name="search" value="Search" />
+ </fieldset>
+ </form>
<table class="networkTable" border="0" cellpadding="2" cellspacing="1">
<tr class="TableHeader" valign="bottom">
<td>send&nbsp;<strong>M</strong>essage/<br />show&nbsp;<strong>P</strong>rofile/<br />edit&nbsp;<strong>W</strong>iki<br />&nbsp;</td>
diff --git a/htroot/Network.java b/htroot/Network.java
index c386c0a5a..29ce8a9bd 100644
--- a/htroot/Network.java
+++ b/htroot/Network.java
@@ -7,7 +7,7 @@
//
// $LastChangedDate$
// $LastChangedRevision$
-// $LastChangedBy: $
+// $LastChangedBy$
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -51,6 +51,8 @@ import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import de.anomic.http.httpHeader;
import de.anomic.http.httpc;
@@ -294,9 +296,19 @@ public class Network {
int PPM;
double QPM;
long myValue=0, nextValue=0, prevValue=0, nextPPM=0, myPPM=0;
+ Pattern peerSearchPattern = null;
+ if(post.containsKey("search")) {
+ peerSearchPattern = Pattern.compile(post.get("match", ""));
+ }
while (e.hasMoreElements() && conCount < maxCount) {
seed = (yacySeed) e.nextElement();
if (seed != null) {
+ if(post.containsKey("search")) {
+ Matcher m = peerSearchPattern.matcher (seed.getName());
+ if (!m.find ()) {
+ continue;
+ }
+ }
prop.put(STR_TABLE_LIST + conCount + "_updatedProfile", 0);
prop.put(STR_TABLE_LIST + conCount + "_updatedWikiPage", 0);
prop.put(STR_TABLE_LIST + conCount + "_updatedBlog", 0);
@@ -452,7 +464,7 @@ public class Network {
prop.put("table_total", ((page == 1) && (iAmActive)) ? (size + 1) : size );
prop.put("table_complete", ((complete)? 1 : 0) );
- if( (!post.containsKey("order") && !post.containsKey("sort")) && page==1){
+ if( (!post.containsKey("order") && !post.containsKey("sort") && !post.containsKey("search")) && page==1){
int percent=(int)((float)(myValue-prevValue)/(float)(nextValue-prevValue)*100);
long indexdiff=nextValue-myValue;
long ppmdiff=myPPM-nextPPM;
@@ -476,6 +488,7 @@ public class Network {
}
prop.put("page", page);
prop.put("table_page", page);
+ prop.put("table_searchpattern", post.get("match", ""));
switch (page) {
case 1 : prop.put("table_peertype", "senior/principal"); break;
case 2 : prop.put("table_peertype", "senior/principal"); break;