Skip to content

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

better flush limit for index collections

orbiterd799622da10b
diff --git a/source/de/anomic/index/indexRAMCacheRI.java b/source/de/anomic/index/indexRAMCacheRI.java
index 25b4bb2b1..5849d1d2e 100644
--- a/source/de/anomic/index/indexRAMCacheRI.java
+++ b/source/de/anomic/index/indexRAMCacheRI.java
@@ -38,6 +38,7 @@ import de.anomic.kelondro.kelondroException;
import de.anomic.kelondro.kelondroMScoreCluster;
import de.anomic.kelondro.kelondroNaturalOrder;
import de.anomic.kelondro.kelondroRow;
+import de.anomic.plasma.plasmaWordIndex;
import de.anomic.plasma.plasmaWordIndexAssortment;
import de.anomic.server.logging.serverLog;
import de.anomic.yacy.yacySeedDB;
@@ -46,9 +47,12 @@ public final class indexRAMCacheRI extends indexAbstractRI implements indexRI {
// environment constants
private static final String indexArrayFileName = "indexDump1.array";
- public static final int wCacheReferenceLimit = 64;
- public static final long wCacheMaxAge = 1000 * 60 * 30; // milliseconds; 30 minutes
- public static final long kCacheMaxAge = 1000 * 60 * 2; // milliseconds; 2 minutes
+ public static int wCacheReferenceLimit = 64;
+ public static final long wCacheMaxAge = 1000 * 60 * 30; // milliseconds; 30 minutes
+ public static final long kCacheMaxAge = 1000 * 60 * 2; // milliseconds; 2 minutes
+ static {
+ if (plasmaWordIndex.useCollectionIndex) wCacheReferenceLimit = 256;
+ }
// class variables
private final File databaseRoot;
@@ -349,7 +353,7 @@ public final class indexRAMCacheRI extends indexAbstractRI implements indexRI {
synchronized (wCache) {
String hash = null;
int count = hashScore.getMaxScore();
- if ((count > wCacheReferenceLimit) &&
+ if ((count >= wCacheReferenceLimit) &&
((hash = (String) hashScore.getMaxObject()) != null)) {
// we MUST flush high-score entries, because a loop deletes entries in cache until this condition fails
// in this cache we MUST NOT check wCacheMinAge
diff --git a/source/de/anomic/plasma/plasmaWordIndex.java b/source/de/anomic/plasma/plasmaWordIndex.java
index 96f2c021d..cb230d9a4 100644
--- a/source/de/anomic/plasma/plasmaWordIndex.java
+++ b/source/de/anomic/plasma/plasmaWordIndex.java
@@ -79,7 +79,7 @@ public final class plasmaWordIndex extends indexAbstractRI implements indexRI {
private static final String indexAssortmentClusterPath = "ACLUSTER";
private static final int assortmentCount = 64;
- private static final boolean useCollectionIndex = false;
+ public static final boolean useCollectionIndex = false;
private final File oldDatabaseRoot;
private final kelondroOrder indexOrder = new kelondroNaturalOrder(true);