pull/1/head
Michael Peter Christen 12 years ago
parent ba793a32c0
commit 164603b946

@ -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) {

@ -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<String, ContentBody> 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<String, String> 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<byte[], Integer> 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<URIMetadataRow> links; // LURLs of search
public Map<byte[], String> 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 ) {

@ -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;

Loading…
Cancel
Save