From faad86986597c7da8b6d85a173ffa372f93c9914 Mon Sep 17 00:00:00 2001 From: hydrox Date: Wed, 7 Feb 2007 11:20:31 +0000 Subject: [PATCH] *) added peer-search to Network.html git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3347 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/Network.html | 6 ++++++ htroot/Network.java | 17 +++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/htroot/Network.html b/htroot/Network.html index 6ea87f6045..8a67892ce9 100644 --- a/htroot/Network.html +++ b/htroot/Network.html @@ -30,6 +30,12 @@

Manually contacting Peer

no remote #[peertype]# peer for this list known

::

Showing #[num]# entries from a total of #[total]# peers.

+
+
+ Search for a peername (RegExp allowed): + +
+
diff --git a/htroot/Network.java b/htroot/Network.java index c386c0a5af..29ce8a9bd4 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.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 @@ record = yacyCore.newsPool.get(yacyNewsPool.INCOMING_DB, c); 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 @@ record = yacyCore.newsPool.get(yacyNewsPool.INCOMING_DB, c); 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 @@ record = yacyCore.newsPool.get(yacyNewsPool.INCOMING_DB, c); } 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;
send Message/
show Profile/
edit Wiki