added more patches to work without RWI data structure

pull/1/head
Michael Peter Christen 13 years ago
parent a427a68bac
commit f75b3f8a47

@ -37,11 +37,9 @@ import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader; import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.storage.HandleSet; import net.yacy.cora.storage.HandleSet;
import net.yacy.kelondro.data.meta.URIMetadataRow; import net.yacy.kelondro.data.meta.URIMetadataRow;
import net.yacy.kelondro.data.word.WordReference;
import net.yacy.kelondro.data.word.WordReferenceRow; import net.yacy.kelondro.data.word.WordReferenceRow;
import net.yacy.kelondro.index.RowHandleSet; import net.yacy.kelondro.index.RowHandleSet;
import net.yacy.kelondro.logging.Log; import net.yacy.kelondro.logging.Log;
import net.yacy.kelondro.rwi.IndexCell;
import net.yacy.kelondro.util.FileUtils; import net.yacy.kelondro.util.FileUtils;
import net.yacy.peers.EventChannel; import net.yacy.peers.EventChannel;
import net.yacy.peers.Network; import net.yacy.peers.Network;
@ -159,7 +157,6 @@ public final class transferRWI {
int received = 0; int received = 0;
int blocked = 0; int blocked = 0;
int receivedURL = 0; int receivedURL = 0;
final IndexCell<WordReference> cell = sb.index.termIndex();
int count = 0; int count = 0;
while (it.hasNext()) { while (it.hasNext()) {
serverCore.checkInterruption(); serverCore.checkInterruption();
@ -196,7 +193,7 @@ public final class transferRWI {
// learn entry // learn entry
try { try {
cell.add(wordHash.getBytes(), iEntry); sb.index.storeRWI(wordHash.getBytes(), iEntry);
} catch (final Exception e) { } catch (final Exception e) {
Log.logException(e); Log.logException(e);
} }

@ -302,8 +302,10 @@ public class WorkTables extends Tables {
public void failURLsRegisterMissingWord(IndexCell<WordReference> indexCell, final DigestURI url, HandleSet queryHashes, final String reason) { public void failURLsRegisterMissingWord(IndexCell<WordReference> indexCell, final DigestURI url, HandleSet queryHashes, final String reason) {
// remove words from index // remove words from index
for (final byte[] word: queryHashes) { if (indexCell != null) {
indexCell.removeDelayed(word, url.hash()); for (final byte[] word: queryHashes) {
indexCell.removeDelayed(word, url.hash());
}
} }
// insert information about changed url into database // insert information about changed url into database

@ -852,7 +852,7 @@ public final class Protocol
// insert the containers to the index // insert the containers to the index
for ( final ReferenceContainer<WordReference> c : container ) { for ( final ReferenceContainer<WordReference> c : container ) {
try { try {
event.getQuery().getSegment().termIndex().add(c); event.getQuery().getSegment().storeRWI(c);
} catch ( final Exception e ) { } catch ( final Exception e ) {
Log.logException(e); Log.logException(e);
} }

@ -433,7 +433,7 @@ public class Dispatcher {
if (this.transmissionCloud != null) { if (this.transmissionCloud != null) {
outerLoop: for (final Map.Entry<ByteArray, Transmission.Chunk> e : this.transmissionCloud.entrySet()) { outerLoop: for (final Map.Entry<ByteArray, Transmission.Chunk> e : this.transmissionCloud.entrySet()) {
for (final ReferenceContainer<WordReference> i : e.getValue()) try { for (final ReferenceContainer<WordReference> i : e.getValue()) try {
this.segment.termIndex().add(i); this.segment.storeRWI(i);
} catch (final Exception e1) { } catch (final Exception e1) {
Log.logException(e1); Log.logException(e1);
break outerLoop; break outerLoop;

@ -142,7 +142,7 @@ public class Transmission {
for (final byte[] b : selected) container.removeReference(b); for (final byte[] b : selected) container.removeReference(b);
// put container back // put container back
try { try {
Transmission.this.segment.termIndex().add(container); Transmission.this.segment.storeRWI(container);
} catch (final Exception e) { } catch (final Exception e) {
Log.logException(e); Log.logException(e);
} }
@ -161,7 +161,7 @@ public class Transmission {
if (remaining <= 0) { if (remaining <= 0) {
// No space left in this chunk // No space left in this chunk
try { try {
Transmission.this.segment.termIndex().add(container); Transmission.this.segment.storeRWI(container);
} catch (final Exception e) { } catch (final Exception e) {
Log.logException(e); Log.logException(e);
} }
@ -304,7 +304,7 @@ public class Transmission {
public void restore() { public void restore() {
for (final ReferenceContainer<WordReference> ic : this) try { for (final ReferenceContainer<WordReference> ic : this) try {
Transmission.this.segment.termIndex().add(ic); Transmission.this.segment.storeRWI(ic);
} catch (final Exception e) { } catch (final Exception e) {
Log.logException(e); Log.logException(e);
} }

@ -331,6 +331,14 @@ public class Segment {
return language; return language;
} }
public void storeRWI(final ReferenceContainer<WordReference> wordContainer) throws IOException, SpaceExceededException {
if (this.termIndex != null) this.termIndex.add(wordContainer);
}
public void storeRWI(final byte[] termHash, final WordReference entry) throws IOException, SpaceExceededException {
if (this.termIndex != null) this.termIndex.add(termHash, entry);
}
public URIMetadata storeDocument( public URIMetadata storeDocument(
final DigestURI url, final DigestURI url,
final DigestURI referrerURL, final DigestURI referrerURL,

Loading…
Cancel
Save