- some bugfixing and code cleanup

- now assortments can completely left out if they do not exist
  before startup and collection index is selected.

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2757 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 19 years ago
parent bdf4c7c51e
commit 50f2578c55

@ -281,18 +281,22 @@ public class PerformanceQueues_p {
prop.put("onlineCautionDelayCurrent", System.currentTimeMillis() - switchboard.proxyLastAccess); prop.put("onlineCautionDelayCurrent", System.currentTimeMillis() - switchboard.proxyLastAccess);
int[] asizes = switchboard.wordIndex.assortmentsSizes(); int[] asizes = switchboard.wordIndex.assortmentsSizes();
for (int i = 0; i < asizes.length; i += 8) { if (asizes != null) {
prop.put("assortmentCluster_" + (i/8) + "_assortmentSlots", (i + 1) + "-" + (i + 8)); for (int i = 0; i < asizes.length; i += 8) {
prop.put("assortmentCluster_" + (i/8) + "_assortmentSizeA", asizes[i]); prop.put("assortmentCluster_" + (i/8) + "_assortmentSlots", (i + 1) + "-" + (i + 8));
prop.put("assortmentCluster_" + (i/8) + "_assortmentSizeB", asizes[i + 1]); prop.put("assortmentCluster_" + (i/8) + "_assortmentSizeA", asizes[i]);
prop.put("assortmentCluster_" + (i/8) + "_assortmentSizeC", asizes[i + 2]); prop.put("assortmentCluster_" + (i/8) + "_assortmentSizeB", asizes[i + 1]);
prop.put("assortmentCluster_" + (i/8) + "_assortmentSizeD", asizes[i + 3]); prop.put("assortmentCluster_" + (i/8) + "_assortmentSizeC", asizes[i + 2]);
prop.put("assortmentCluster_" + (i/8) + "_assortmentSizeE", asizes[i + 4]); prop.put("assortmentCluster_" + (i/8) + "_assortmentSizeD", asizes[i + 3]);
prop.put("assortmentCluster_" + (i/8) + "_assortmentSizeF", asizes[i + 5]); prop.put("assortmentCluster_" + (i/8) + "_assortmentSizeE", asizes[i + 4]);
prop.put("assortmentCluster_" + (i/8) + "_assortmentSizeG", asizes[i + 6]); prop.put("assortmentCluster_" + (i/8) + "_assortmentSizeF", asizes[i + 5]);
prop.put("assortmentCluster_" + (i/8) + "_assortmentSizeH", asizes[i + 7]); prop.put("assortmentCluster_" + (i/8) + "_assortmentSizeG", asizes[i + 6]);
prop.put("assortmentCluster_" + (i/8) + "_assortmentSizeH", asizes[i + 7]);
}
prop.put("assortmentCluster", asizes.length / 8);
} else {
prop.put("assortmentCluster", 0);
} }
prop.put("assortmentCluster", asizes.length / 8);
// table thread pool settings // table thread pool settings
GenericKeyedObjectPool.Config crawlerPoolConfig = switchboard.cacheLoader.getPoolConfig(); GenericKeyedObjectPool.Config crawlerPoolConfig = switchboard.cacheLoader.getPoolConfig();

@ -270,7 +270,7 @@ public class kelondroCollectionIndex {
if (oldindexrow == null) { if (oldindexrow == null) {
if ((collection != null) && (collection.size() > 0)) { if ((collection != null) && (collection.size() > 0)) {
// the collection is new // the collection is new
overwrite(key, collection); overwrite(key, collection, arrayIndex(collection.size()));
} }
return 0; return 0;
} }
@ -286,8 +286,8 @@ public class kelondroCollectionIndex {
if (merge) { if (merge) {
// load the old collection and join it // load the old collection and join it
kelondroRowSet oldcollection = getdelete(oldindexrow, false, false); kelondroRowSet oldcollection = getwithparams(oldindexrow, oldchunksize, oldchunkcount, oldPartitionNumber, oldrownumber, oldSerialNumber, false, false);
// join with new collection // join with new collection
oldcollection.addAll(collection); oldcollection.addAll(collection);
collection = oldcollection; collection = oldcollection;
@ -296,7 +296,7 @@ public class kelondroCollectionIndex {
int removed = 0; int removed = 0;
if (removekeys != null) { if (removekeys != null) {
// load the old collection and remove keys // load the old collection and remove keys
kelondroRowSet oldcollection = getdelete(oldindexrow, false, false); kelondroRowSet oldcollection = getwithparams(oldindexrow, oldchunksize, oldchunkcount, oldPartitionNumber, oldrownumber, oldSerialNumber, false, false);
// remove the keys from the set // remove the keys from the set
Iterator i = removekeys.iterator(); Iterator i = removekeys.iterator();
@ -338,7 +338,7 @@ public class kelondroCollectionIndex {
// update the index entry // update the index entry
oldindexrow.setCol(idx_col_chunkcount, collection.size()); oldindexrow.setCol(idx_col_chunkcount, collection.size());
oldindexrow.setCol(idx_col_clusteridx, (byte) newPartitionNumber); oldindexrow.setCol(idx_col_clusteridx, (byte) oldPartitionNumber);
oldindexrow.setCol(idx_col_flags, (byte) 0); oldindexrow.setCol(idx_col_flags, (byte) 0);
oldindexrow.setCol(idx_col_lastwrote, kelondroRowCollection.daysSince2000(System.currentTimeMillis())); oldindexrow.setCol(idx_col_lastwrote, kelondroRowCollection.daysSince2000(System.currentTimeMillis()));
index.put(oldindexrow); index.put(oldindexrow);
@ -351,19 +351,18 @@ public class kelondroCollectionIndex {
array.remove(oldrownumber); array.remove(oldrownumber);
// write a new entry in the other array // write a new entry in the other array
overwrite(key, collection); overwrite(key, collection, newPartitionNumber);
} }
return removed; return removed;
} }
} }
private void overwrite(byte[] key, kelondroRowCollection collection) throws IOException { private void overwrite(byte[] key, kelondroRowCollection collection, int targetpartition) throws IOException {
// helper method, should not be called directly and only within a synchronized(index) environment // helper method, should not be called directly and only within a synchronized(index) environment
// simply store a collection without check if the collection existed before // simply store a collection without check if the collection existed before
// find array file // find array file
int clusteridx = arrayIndex(collection.size()); kelondroFixedWidthArray array = getArray(targetpartition, 0, this.playloadrow.objectsize());
kelondroFixedWidthArray array = getArray(clusteridx, 0, this.playloadrow.objectsize());
// define row // define row
kelondroRow.Entry arrayEntry = array.row().newEntry(); kelondroRow.Entry arrayEntry = array.row().newEntry();
@ -378,7 +377,7 @@ public class kelondroCollectionIndex {
indexEntry.setCol(idx_col_key, key); indexEntry.setCol(idx_col_key, key);
indexEntry.setCol(idx_col_chunksize, this.playloadrow.objectsize()); indexEntry.setCol(idx_col_chunksize, this.playloadrow.objectsize());
indexEntry.setCol(idx_col_chunkcount, collection.size()); indexEntry.setCol(idx_col_chunkcount, collection.size());
indexEntry.setCol(idx_col_clusteridx, (byte) clusteridx); indexEntry.setCol(idx_col_clusteridx, (byte) targetpartition);
indexEntry.setCol(idx_col_flags, (byte) 0); indexEntry.setCol(idx_col_flags, (byte) 0);
indexEntry.setCol(idx_col_indexpos, (long) newRowNumber); indexEntry.setCol(idx_col_indexpos, (long) newRowNumber);
indexEntry.setCol(idx_col_lastread, kelondroRowCollection.daysSince2000(System.currentTimeMillis())); indexEntry.setCol(idx_col_lastread, kelondroRowCollection.daysSince2000(System.currentTimeMillis()));
@ -413,7 +412,7 @@ public class kelondroCollectionIndex {
return removedCollection; return removedCollection;
} }
} }
protected kelondroRowSet getdelete(kelondroRow.Entry indexrow, boolean remove, boolean deleteIfEmpty) throws IOException { protected kelondroRowSet getdelete(kelondroRow.Entry indexrow, boolean remove, boolean deleteIfEmpty) throws IOException {
// call this only within a synchronized(index) environment // call this only within a synchronized(index) environment
@ -425,10 +424,14 @@ public class kelondroCollectionIndex {
assert(partitionnumber >= arrayIndex(chunkcount)); assert(partitionnumber >= arrayIndex(chunkcount));
int serialnumber = 0; int serialnumber = 0;
return getwithparams(indexrow, chunksize, chunkcount, partitionnumber, rownumber, serialnumber, remove, deleteIfEmpty);
}
private kelondroRowSet getwithparams(kelondroRow.Entry indexrow, int chunksize, int chunkcount, int clusteridx, int rownumber, int serialnumber, boolean remove, boolean deleteIfEmpty) throws IOException {
// open array entry // open array entry
kelondroFixedWidthArray array = getArray(partitionnumber, serialnumber, chunksize); kelondroFixedWidthArray array = getArray(clusteridx, serialnumber, chunksize);
kelondroRow.Entry arrayrow = array.get(rownumber); kelondroRow.Entry arrayrow = array.get(rownumber);
if (arrayrow == null) throw new kelondroException(arrayFile(this.path, this.filenameStub, this.loadfactor, chunksize, partitionnumber, serialnumber).toString(), "array does not contain expected row"); if (arrayrow == null) throw new kelondroException(arrayFile(this.path, this.filenameStub, this.loadfactor, chunksize, clusteridx, serialnumber).toString(), "array does not contain expected row");
// read the row and define a collection // read the row and define a collection
kelondroRowSet collection = new kelondroRowSet(this.playloadrow, arrayrow.getColBytes(1)); // FIXME: this does not yet work with different rowdef in case of several rowdef.objectsize() kelondroRowSet collection = new kelondroRowSet(this.playloadrow, arrayrow.getColBytes(1)); // FIXME: this does not yet work with different rowdef in case of several rowdef.objectsize()
@ -440,7 +443,7 @@ public class kelondroCollectionIndex {
indexEntry.setCol(idx_col_key, arrayrow.getColBytes(0)); indexEntry.setCol(idx_col_key, arrayrow.getColBytes(0));
indexEntry.setCol(idx_col_chunksize, this.playloadrow.objectsize()); indexEntry.setCol(idx_col_chunksize, this.playloadrow.objectsize());
indexEntry.setCol(idx_col_chunkcount, collection.size()); indexEntry.setCol(idx_col_chunkcount, collection.size());
indexEntry.setCol(idx_col_clusteridx, (byte) partitionnumber); indexEntry.setCol(idx_col_clusteridx, (byte) clusteridx);
indexEntry.setCol(idx_col_flags, (byte) 0); indexEntry.setCol(idx_col_flags, (byte) 0);
indexEntry.setCol(idx_col_indexpos, (long) rownumber); indexEntry.setCol(idx_col_indexpos, (long) rownumber);
indexEntry.setCol(idx_col_lastread, kelondroRowCollection.daysSince2000(System.currentTimeMillis())); indexEntry.setCol(idx_col_lastread, kelondroRowCollection.daysSince2000(System.currentTimeMillis()));
@ -453,14 +456,12 @@ public class kelondroCollectionIndex {
// fix the entry in index // fix the entry in index
indexrow.setCol(idx_col_chunkcount, chunkcountInArray); indexrow.setCol(idx_col_chunkcount, chunkcountInArray);
index.put(indexrow); index.put(indexrow);
array.logFailure("INCONSISTENCY in " + arrayFile(this.path, this.filenameStub, this.loadfactor, chunksize, partitionnumber, serialnumber).toString() + ": array has different chunkcount than index: index = " + chunkcount + ", array = " + chunkcountInArray + "; the index has been auto-fixed"); array.logFailure("INCONSISTENCY in " + arrayFile(this.path, this.filenameStub, this.loadfactor, chunksize, clusteridx, serialnumber).toString() + ": array has different chunkcount than index: index = " + chunkcount + ", array = " + chunkcountInArray + "; the index has been auto-fixed");
} }
if ((remove) || ((collection.size() == 0) && (deleteIfEmpty))) array.remove(rownumber);
if ((remove) || ((chunkcountInArray == 0) && (deleteIfEmpty))) array.remove(rownumber);
return collection; return collection;
} }
public Iterator keycollections(byte[] startKey, boolean rot) { public Iterator keycollections(byte[] startKey, boolean rot) {
// returns an iteration of {byte[], kelondroRowSet} Objects // returns an iteration of {byte[], kelondroRowSet} Objects
try { try {

@ -78,14 +78,14 @@ public class kelondroMergeIterator implements Iterator {
private void nexta() { private void nexta() {
try { try {
if (a.hasNext()) na = a.next(); else na = null; if ((a != null) && (a.hasNext())) na = a.next(); else na = null;
} catch (ConcurrentModificationException e) { } catch (ConcurrentModificationException e) {
na = null; na = null;
} }
} }
private void nextb() { private void nextb() {
try { try {
if (b.hasNext()) nb = b.next(); else nb = null; if ((b != null) && (b.hasNext())) nb = b.next(); else nb = null;
} catch (ConcurrentModificationException e) { } catch (ConcurrentModificationException e) {
nb = null; nb = null;
} }

@ -1,3 +1,29 @@
// plasmaCrawlLURLEntry.java
// (C) 2006 by Michael Peter Christen; mc@anomic.de, Frankfurt a. M., Germany
// first published 13.10.2006 on http://www.anomic.de
//
// This is a part of YaCy, a peer-to-peer based web search engine
//
// $LastChangedDate: 2006-04-02 22:40:07 +0200 (So, 02 Apr 2006) $
// $LastChangedRevision: 1986 $
// $LastChangedBy: orbiter $
//
// LICENSE
//
// 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
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package de.anomic.plasma; package de.anomic.plasma;
import java.io.IOException; import java.io.IOException;

@ -1,3 +1,29 @@
// plasmaCrawlLURLOldEntry.java
// (C) 2006 by Michael Peter Christen; mc@anomic.de, Frankfurt a. M., Germany
// first published 13.10.2006 on http://www.anomic.de
//
// This is a part of YaCy, a peer-to-peer based web search engine
//
// $LastChangedDate: 2006-04-02 22:40:07 +0200 (So, 02 Apr 2006) $
// $LastChangedRevision: 1986 $
// $LastChangedBy: orbiter $
//
// LICENSE
//
// 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
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package de.anomic.plasma; package de.anomic.plasma;
import java.io.IOException; import java.io.IOException;

@ -1,14 +1,15 @@
// plasmaWordIndex.java // plasmaWordIndex.java
// ----------------------- // (C) 2005, 2006 by Michael Peter Christen; mc@anomic.de, Frankfurt a. M., Germany
// part of YACY // first published 2005 on http://www.anomic.de
// (C) by Michael Peter Christen; mc@anomic.de //
// first published on http://www.anomic.de // This is a part of YaCy, a peer-to-peer based web search engine
// Frankfurt, Germany, 2005
// //
// $LastChangedDate$ // $LastChangedDate$
// $LastChangedRevision$ // $LastChangedRevision$
// $LastChangedBy$ // $LastChangedBy$
// //
// LICENSE
//
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or // the Free Software Foundation; either version 2 of the License, or
@ -22,28 +23,6 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Using this software in any meaning (reading, learning, copying, compiling,
// running) means that you agree that the Author(s) is (are) not responsible
// for cost, loss of data or any harm that may be caused directly or indirectly
// by usage of this softare or this documentation. The usage of this software
// is on your own risk. The installation and usage (starting/running) of this
// software may allow other people or application to access your computer and
// any attached devices and is highly dependent on the configuration of the
// software which must be done by the user of the software; the author(s) is
// (are) also not responsible for proper configuration and usage of the
// software, even if provoked by documentation provided together with
// the software.
//
// Any changes to this file according to the GPL as documented in the file
// gpl.txt aside this file in the shipment you received can be done to the
// lines that follows this copyright notice here, but changes must not be
// done inside the copyright notive above. A re-distribution must contain
// the intact and unchanged copyright notice.
// Contributions and changes to the program code must be marked as such.
// compile with
// javac -classpath classes -sourcepath source -d classes -g source/de/anomic/plasma/*.java
package de.anomic.plasma; package de.anomic.plasma;
@ -101,16 +80,21 @@ public final class plasmaWordIndex extends indexAbstractRI implements indexRI {
// create assortment cluster path // create assortment cluster path
File assortmentClusterPath = new File(oldDatabaseRoot, indexAssortmentClusterPath); File assortmentClusterPath = new File(oldDatabaseRoot, indexAssortmentClusterPath);
if (!(assortmentClusterPath.exists())) assortmentClusterPath.mkdirs();
this.assortmentBufferSize = bufferkb; this.assortmentBufferSize = bufferkb;
this.assortmentCluster = new plasmaWordIndexAssortmentCluster(assortmentClusterPath, assortmentCount, assortmentBufferSize, preloadTime, log);
// create collections storage path // create collections storage path
if (!(newIndexRoot.exists())) newIndexRoot.mkdirs(); if (!(newIndexRoot.exists())) newIndexRoot.mkdirs();
if (useCollectionIndex) if (useCollectionIndex) {
collections = new indexCollectionRI(newIndexRoot, "test_generation1", bufferkb * 1024, preloadTime); this.collections = new indexCollectionRI(newIndexRoot, "test_generation1", bufferkb * 1024, preloadTime);
else if (assortmentClusterPath.exists())
collections = null; this.assortmentCluster = new plasmaWordIndexAssortmentCluster(assortmentClusterPath, assortmentCount, assortmentBufferSize, preloadTime, log);
else
this.assortmentCluster = null;
} else {
this.collections = null;
if (!(assortmentClusterPath.exists())) assortmentClusterPath.mkdirs();
this.assortmentCluster = new plasmaWordIndexAssortmentCluster(assortmentClusterPath, assortmentCount, assortmentBufferSize, preloadTime, log);
}
busyCacheFlush = false; busyCacheFlush = false;
this.useCollectionIndex = useCollectionIndex; this.useCollectionIndex = useCollectionIndex;
@ -155,23 +139,23 @@ public final class plasmaWordIndex extends indexAbstractRI implements indexRI {
} }
public int[] assortmentsSizes() { public int[] assortmentsSizes() {
return assortmentCluster.sizes(); return (assortmentCluster == null) ? null : assortmentCluster.sizes();
} }
public int assortmentsCacheChunkSizeAvg() { public int assortmentsCacheChunkSizeAvg() {
return assortmentCluster.cacheChunkSizeAvg(); return (assortmentCluster == null) ? 0 : assortmentCluster.cacheChunkSizeAvg();
} }
public int assortmentsCacheObjectSizeAvg() { public int assortmentsCacheObjectSizeAvg() {
return assortmentCluster.cacheObjectSizeAvg(); return (assortmentCluster == null) ? 0 : assortmentCluster.cacheObjectSizeAvg();
} }
public int[] assortmentsCacheNodeStatus() { public int[] assortmentsCacheNodeStatus() {
return assortmentCluster.cacheNodeStatus(); return (assortmentCluster == null) ? null : assortmentCluster.cacheNodeStatus();
} }
public long[] assortmentsCacheObjectStatus() { public long[] assortmentsCacheObjectStatus() {
return assortmentCluster.cacheObjectStatus(); return (assortmentCluster == null) ? null : assortmentCluster.cacheObjectStatus();
} }
public void setMaxWordCount(int maxWords) { public void setMaxWordCount(int maxWords) {
@ -376,13 +360,15 @@ public final class plasmaWordIndex extends indexAbstractRI implements indexRI {
} }
// get from assortments // get from assortments
if (container == null) { if (assortmentCluster != null) {
container = assortmentCluster.getContainer(wordHash, urlselection, true, (maxTime < 0) ? -1 : maxTime); if (container == null) {
} else { container = assortmentCluster.getContainer(wordHash, urlselection, true, (maxTime < 0) ? -1 : maxTime);
// add containers from assortment cluster } else {
container.add(assortmentCluster.getContainer(wordHash, urlselection, true, (maxTime < 0) ? -1 : maxTime), -1); // add containers from assortment cluster
container.add(assortmentCluster.getContainer(wordHash, urlselection, true, (maxTime < 0) ? -1 : maxTime), -1);
}
} }
// get from backend // get from backend
if (maxTime > 0) { if (maxTime > 0) {
maxTime = maxTime - (System.currentTimeMillis() - start); maxTime = maxTime - (System.currentTimeMillis() - start);
@ -425,11 +411,11 @@ public final class plasmaWordIndex extends indexAbstractRI implements indexRI {
public int size() { public int size() {
if (useCollectionIndex) if (useCollectionIndex)
return java.lang.Math.max(collections.size(), return java.lang.Math.max(collections.size(),
java.lang.Math.max(assortmentCluster.size(), java.lang.Math.max((assortmentCluster == null) ? 0 : assortmentCluster.size(),
java.lang.Math.max(backend.size(), java.lang.Math.max(backend.size(),
java.lang.Math.max(dhtInCache.size(), dhtOutCache.size())))); java.lang.Math.max(dhtInCache.size(), dhtOutCache.size()))));
else else
return java.lang.Math.max(assortmentCluster.size(), return java.lang.Math.max((assortmentCluster == null) ? 0 : assortmentCluster.size(),
java.lang.Math.max(backend.size(), java.lang.Math.max(backend.size(),
java.lang.Math.max(dhtInCache.size(), dhtOutCache.size()))); java.lang.Math.max(dhtInCache.size(), dhtOutCache.size())));
} }
@ -444,7 +430,7 @@ public final class plasmaWordIndex extends indexAbstractRI implements indexRI {
} }
} catch (IOException e) {} } catch (IOException e) {}
if (useCollectionIndex) size += collections.indexSize(wordHash); if (useCollectionIndex) size += collections.indexSize(wordHash);
size += assortmentCluster.indexSize(wordHash); size += (assortmentCluster == null) ? 0 : assortmentCluster.indexSize(wordHash);
size += dhtInCache.indexSize(wordHash); size += dhtInCache.indexSize(wordHash);
size += dhtOutCache.indexSize(wordHash); size += dhtOutCache.indexSize(wordHash);
return size; return size;
@ -455,7 +441,7 @@ public final class plasmaWordIndex extends indexAbstractRI implements indexRI {
dhtInCache.close(waitingBoundSeconds); dhtInCache.close(waitingBoundSeconds);
dhtOutCache.close(waitingBoundSeconds); dhtOutCache.close(waitingBoundSeconds);
if (useCollectionIndex) collections.close(-1); if (useCollectionIndex) collections.close(-1);
assortmentCluster.close(-1); if (assortmentCluster != null) assortmentCluster.close(-1);
backend.close(10); backend.close(10);
} }
} }
@ -465,7 +451,7 @@ public final class plasmaWordIndex extends indexAbstractRI implements indexRI {
c.add(dhtInCache.deleteContainer(wordHash), -1); c.add(dhtInCache.deleteContainer(wordHash), -1);
c.add(dhtOutCache.deleteContainer(wordHash), -1); c.add(dhtOutCache.deleteContainer(wordHash), -1);
if (useCollectionIndex) c.add(collections.deleteContainer(wordHash), -1); if (useCollectionIndex) c.add(collections.deleteContainer(wordHash), -1);
c.add(assortmentCluster.deleteContainer(wordHash), -1); if (assortmentCluster != null) c.add(assortmentCluster.deleteContainer(wordHash), -1);
c.add(backend.deleteContainer(wordHash), -1); c.add(backend.deleteContainer(wordHash), -1);
return c; return c;
} }
@ -475,7 +461,7 @@ public final class plasmaWordIndex extends indexAbstractRI implements indexRI {
removed = removed | (dhtInCache.removeEntry(wordHash, urlHash, deleteComplete)); removed = removed | (dhtInCache.removeEntry(wordHash, urlHash, deleteComplete));
removed = removed | (dhtOutCache.removeEntry(wordHash, urlHash, deleteComplete)); removed = removed | (dhtOutCache.removeEntry(wordHash, urlHash, deleteComplete));
if (useCollectionIndex) {removed = removed | (collections.removeEntry(wordHash, urlHash, deleteComplete));} if (useCollectionIndex) {removed = removed | (collections.removeEntry(wordHash, urlHash, deleteComplete));}
removed = removed | (assortmentCluster.removeEntry(wordHash, urlHash, deleteComplete)); if (assortmentCluster != null) removed = removed | (assortmentCluster.removeEntry(wordHash, urlHash, deleteComplete));
removed = removed | backend.removeEntry(wordHash, urlHash, deleteComplete); removed = removed | backend.removeEntry(wordHash, urlHash, deleteComplete);
return removed; return removed;
} }
@ -489,7 +475,7 @@ public final class plasmaWordIndex extends indexAbstractRI implements indexRI {
removed += collections.removeEntries(wordHash, urlHashes, deleteComplete); removed += collections.removeEntries(wordHash, urlHashes, deleteComplete);
//if (removed == urlHashes.size()) return removed; //if (removed == urlHashes.size()) return removed;
} }
removed += assortmentCluster.removeEntries(wordHash, urlHashes, deleteComplete); if (assortmentCluster != null) removed += assortmentCluster.removeEntries(wordHash, urlHashes, deleteComplete);
//if (removed == urlHashes.size()) return removed; //if (removed == urlHashes.size()) return removed;
removed += backend.removeEntries(wordHash, urlHashes, deleteComplete); removed += backend.removeEntries(wordHash, urlHashes, deleteComplete);
return removed; return removed;
@ -502,7 +488,7 @@ public final class plasmaWordIndex extends indexAbstractRI implements indexRI {
if (useCollectionIndex) { if (useCollectionIndex) {
removed += collections.removeEntries(wordHash, urlHashes, deleteComplete) + ", "; removed += collections.removeEntries(wordHash, urlHashes, deleteComplete) + ", ";
} else removed += "0, "; } else removed += "0, ";
removed += assortmentCluster.removeEntries(wordHash, urlHashes, deleteComplete) + ", "; if (assortmentCluster != null) removed += assortmentCluster.removeEntries(wordHash, urlHashes, deleteComplete) + ", ";
removed += backend.removeEntries(wordHash, urlHashes, deleteComplete); removed += backend.removeEntries(wordHash, urlHashes, deleteComplete);
return removed; return removed;
} }
@ -574,14 +560,14 @@ public final class plasmaWordIndex extends indexAbstractRI implements indexRI {
new indexContainerOrder(kelondroNaturalOrder.naturalOrder), new indexContainerOrder(kelondroNaturalOrder.naturalOrder),
indexContainer.containerMergeMethod, indexContainer.containerMergeMethod,
true), true),
assortmentCluster.wordContainers(startWordHash, true, false), (assortmentCluster == null) ? null : assortmentCluster.wordContainers(startWordHash, true, false),
new indexContainerOrder(kelondroNaturalOrder.naturalOrder), new indexContainerOrder(kelondroNaturalOrder.naturalOrder),
indexContainer.containerMergeMethod, indexContainer.containerMergeMethod,
true); true);
} else { } else {
return new kelondroMergeIterator( return new kelondroMergeIterator(
dhtOutCache.wordContainers(startWordHash, false), dhtOutCache.wordContainers(startWordHash, false),
assortmentCluster.wordContainers(startWordHash, true, false), (assortmentCluster == null) ? null : assortmentCluster.wordContainers(startWordHash, true, false),
new indexContainerOrder(kelondroNaturalOrder.naturalOrder), new indexContainerOrder(kelondroNaturalOrder.naturalOrder),
indexContainer.containerMergeMethod, indexContainer.containerMergeMethod,
true); true);
@ -597,7 +583,7 @@ public final class plasmaWordIndex extends indexAbstractRI implements indexRI {
new indexContainerOrder(kelondroNaturalOrder.naturalOrder), new indexContainerOrder(kelondroNaturalOrder.naturalOrder),
indexContainer.containerMergeMethod, indexContainer.containerMergeMethod,
true), true),
assortmentCluster.wordContainers(startWordHash, true, false), (assortmentCluster == null) ? null : assortmentCluster.wordContainers(startWordHash, true, false),
new indexContainerOrder(kelondroNaturalOrder.naturalOrder), new indexContainerOrder(kelondroNaturalOrder.naturalOrder),
indexContainer.containerMergeMethod, indexContainer.containerMergeMethod,
true), true),
@ -609,7 +595,7 @@ public final class plasmaWordIndex extends indexAbstractRI implements indexRI {
return new kelondroMergeIterator( return new kelondroMergeIterator(
new kelondroMergeIterator( new kelondroMergeIterator(
dhtOutCache.wordContainers(startWordHash, false), dhtOutCache.wordContainers(startWordHash, false),
assortmentCluster.wordContainers(startWordHash, true, false), (assortmentCluster == null) ? null : assortmentCluster.wordContainers(startWordHash, true, false),
new indexContainerOrder(kelondroNaturalOrder.naturalOrder), new indexContainerOrder(kelondroNaturalOrder.naturalOrder),
indexContainer.containerMergeMethod, indexContainer.containerMergeMethod,
true), true),

Loading…
Cancel
Save