From 164603b946f29ae4ebddcd67b04c18dc6fac619b Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Thu, 30 May 2013 12:47:22 +0200 Subject: [PATCH] cleanup --- htroot/IndexControlRWIs_p.java | 7 ++-- source/net/yacy/peers/Protocol.java | 43 ++-------------------- source/net/yacy/search/index/Fulltext.java | 11 ------ 3 files changed, 6 insertions(+), 55 deletions(-) diff --git a/htroot/IndexControlRWIs_p.java b/htroot/IndexControlRWIs_p.java index 934c0e5d6..804fc5d56 100644 --- a/htroot/IndexControlRWIs_p.java +++ b/htroot/IndexControlRWIs_p.java @@ -128,7 +128,7 @@ public class IndexControlRWIs_p { if ( post.containsKey("keystringsearch") ) { prop.put("keyhash", keyhash); - final SearchEvent theSearch = genSearchresult(prop, sb, segment, keyhash, null); + final SearchEvent theSearch = genSearchresult(prop, sb, keyhash, null); if (theSearch.local_rwi_available.get() == 0) { prop.put("searchresult", 1); prop.putHTML("searchresult_word", keystring); @@ -139,7 +139,7 @@ public class IndexControlRWIs_p { if ( keystring.isEmpty() || !ByteBuffer.equals(Word.word2hash(keystring), keyhash) ) { prop.put("keystring", "<" + errmsg + ">"); } - final SearchEvent theSearch = genSearchresult(prop, sb, segment, keyhash, null); + final SearchEvent theSearch = genSearchresult(prop, sb, keyhash, null); if (theSearch.local_rwi_available.get() == 0) { prop.put("searchresult", 2); prop.putHTML("searchresult_wordhash", ASCII.String(keyhash)); @@ -235,7 +235,7 @@ public class IndexControlRWIs_p { } final Bitfield flags = compileFlags(post); final int count = (post.get("lines", "all").equals("all")) ? -1 : post.getInt("lines", -1); - final SearchEvent theSearch = genSearchresult(prop, sb, segment, keyhash, flags); + final SearchEvent theSearch = genSearchresult(prop, sb, keyhash, flags); genURLList(prop, keyhash, keystring, theSearch, flags, count); } @@ -638,7 +638,6 @@ public class IndexControlRWIs_p { public static SearchEvent genSearchresult( final serverObjects prop, final Switchboard sb, - final Segment segment, final byte[] keyhash, final Bitfield filter) { diff --git a/source/net/yacy/peers/Protocol.java b/source/net/yacy/peers/Protocol.java index a62790478..e6ad99424 100644 --- a/source/net/yacy/peers/Protocol.java +++ b/source/net/yacy/peers/Protocol.java @@ -486,45 +486,6 @@ public final class Protocol { } } - /** - * check the status of a remote peer - * This method is a bit deprecated since we do not use it any more because of high CPU load during url count computation - * @param target - * @return an array of two long: [0] is the count of urls, [1] is a magic - */ - public static long[] queryUrlCount(final Seed target) { - if (target == null) return new long[] {-1, -1}; - - // prepare request - final String salt = crypt.randomSalt(); - - // send request - try { - final Map parts = basicRequestParts(Switchboard.getSwitchboard(), target.hash, salt); - parts.put("object", UTF8.StringBody("lurlcount")); - parts.put("ttl", UTF8.StringBody("0")); - parts.put("env", UTF8.StringBody("")); - final byte[] content = postToFile(target, "query.html", parts, 6000); - final Map result = FileUtils.table(content); - - if (result == null || result.isEmpty()) return new long[] {-1, -1}; - final String resp = result.get("response"); - if (resp == null) return new long[] {-1, -1}; - String magic = result.get("magic"); - if (magic == null) magic = "0"; - try { - return new long[] {Long.parseLong(resp), Long.parseLong(magic)}; - } catch ( final NumberFormatException e ) { - return new long[] {-1, -1}; - } - } catch ( final IOException e ) { - if ( Network.log.isFine() ) { - Network.log.logFine("yacyClient.queryUrlCount error asking peer '" + target.getName() + "':" + e.toString()); - } - return new long[] {-1, -1}; - } - } - public static RSSFeed queryRemoteCrawlURLs( final SeedDB seedDB, final Seed target, @@ -898,7 +859,7 @@ public final class Protocol { public int availableCount; // number of returned LURL's for this search public int totalCount; // public Map indexcount; // - public long searchtime; // time that the peer actually spent to create the result + //public long searchtime; // time that the peer actually spent to create the result public String[] references; // search hints, the top-words public List links; // LURLs of search public Map indexabstract; // index abstracts, a collection of url-hashes per word @@ -987,6 +948,7 @@ public final class Protocol { if ( resultMap == null || resultMap.isEmpty() ) { throw new IOException("resultMap is NULL"); } + /* try { this.searchtime = Integer.parseInt(resultMap.get("searchtime")); } catch ( final NumberFormatException e ) { @@ -995,6 +957,7 @@ public final class Protocol { + ", map = " + resultMap.toString()); } + */ try { this.totalCount = Integer.parseInt(resultMap.get("joincount")); // the complete number of hits at remote site; rwi+solr (via: theSearch.getResultCount()) } catch ( final NumberFormatException e ) { diff --git a/source/net/yacy/search/index/Fulltext.java b/source/net/yacy/search/index/Fulltext.java index 8fe9a3960..8d0f27ab5 100644 --- a/source/net/yacy/search/index/Fulltext.java +++ b/source/net/yacy/search/index/Fulltext.java @@ -120,17 +120,6 @@ public final class Fulltext { return this.urlIndexFile; } - /** - * true if old metadata index URLDb is connected. - * used only for migration - * @deprecated - * current and future versions use Solr for metadata - */ - @Deprecated - public boolean connectedURLDb() { - return this.urlIndexFile != null; - } - protected void connectUrlDb(final String tablename, final boolean useTailCache, final boolean exceed134217727) { if (this.urlIndexFile != null) return; this.tablename = tablename;