mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
another resource hack
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7758 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
parent
535b6b953c
commit
0e9a99cb05
|
@ -82,16 +82,13 @@ public class TextSnippet implements Comparable<TextSnippet>, Comparator<TextSnip
|
||||||
public static class Cache {
|
public static class Cache {
|
||||||
private final ARC<String, String> cache;
|
private final ARC<String, String> cache;
|
||||||
public Cache() {
|
public Cache() {
|
||||||
cache = new ConcurrentARC<String, String>(maxCache, Math.max(10, Runtime.getRuntime().availableProcessors()));
|
cache = new ConcurrentARC<String, String>(maxCache, Math.max(32, 4 * Runtime.getRuntime().availableProcessors()));
|
||||||
}
|
}
|
||||||
public void put(final String wordhashes, final String urlhash, final String snippet) {
|
public void put(final String wordhashes, final String urlhash, final String snippet) {
|
||||||
// generate key
|
// generate key
|
||||||
final String key = urlhash + wordhashes;
|
final String key = urlhash + wordhashes;
|
||||||
|
|
||||||
// do nothing if snippet is known
|
// do nothing if snippet is known or learn new snippet
|
||||||
if (cache.containsKey(key)) return;
|
|
||||||
|
|
||||||
// learn new snippet
|
|
||||||
cache.insertIfAbsent(key, snippet);
|
cache.insertIfAbsent(key, snippet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -178,7 +178,7 @@ public class WebStructureGraph {
|
||||||
if (nexturlhashb != null) {
|
if (nexturlhashb != null) {
|
||||||
nexturlhash = ASCII.String(nexturlhashb);
|
nexturlhash = ASCII.String(nexturlhashb);
|
||||||
assert nexturlhash.length() == 12 : "nexturlhash.length() = " + nexturlhash.length() + ", nexturlhash = " + nexturlhash;
|
assert nexturlhash.length() == 12 : "nexturlhash.length() = " + nexturlhash.length() + ", nexturlhash = " + nexturlhash;
|
||||||
assert !nexturlhash.substring(6).equals(refhashp);
|
//assert !nexturlhash.substring(6).equals(refhashp);
|
||||||
// this is a global link
|
// this is a global link
|
||||||
cpg.append(nexturlhash); // store complete hash
|
cpg.append(nexturlhash); // store complete hash
|
||||||
assert cpg.length() % 12 == 0 : "cpg.length() = " + cpg.length() + ", cpg = " + cpg.toString();
|
assert cpg.length() % 12 == 0 : "cpg.length() = " + cpg.length() + ", cpg = " + cpg.toString();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user