Permalink
Browse files

fix of fulltext.remove() by id of webgraph document

webgraph has document hash in source_id_s
  • Loading branch information...
reger24 committed Jan 1, 2017
1 parent 1df558a commit a1e5f7dbca21d6072cb44c241efbc41a2111c5f9
Showing with 16 additions and 5 deletions.
  1. +16 −5 source/net/yacy/search/index/Fulltext.java
@@ -489,26 +489,37 @@ public int remove(final String basepath, Date freshdate) {
}
/**
* remove a list of id's from the index
* remove a list of id's from the index (matching fulltext.id and webgraph.source_id_s
* @param deleteIDs a list of urlhashes; each denoting a document
* @param concurrently if true, then the method returnes immediately and runs concurrently
*/
public void remove(final Collection<String> deleteIDs) {
if (deleteIDs == null || deleteIDs.size() == 0) return;
try {
this.getDefaultConnector().deleteByIds(deleteIDs);
if (this.writeWebgraph) this.getWebgraphConnector().deleteByIds(deleteIDs);
if (this.writeWebgraph) { // Webgraph.id is combination of sourceHash+targetHash+hexCounter, to be successful use source_id_s and/or target_id_s
for (String id : deleteIDs) {
this.getWebgraphConnector().deleteByQuery(WebgraphSchema.source_id_s.name() + ":" + id);
}
}
} catch (final Throwable e) {
ConcurrentLog.logException(e);
}
}
/**
* Deletes document with id=urlHash from fulltext index and document with
* source_id_s=urlHash from webgraph index
* @param urlHash the document id
* @return
*/
public boolean remove(final byte[] urlHash) {
if (urlHash == null) return false;
try {
String id = ASCII.String(urlHash);
this.getDefaultConnector().deleteById(id);
if (this.writeWebgraph) this.getWebgraphConnector().deleteById(id);
if (this.writeWebgraph) { // Webgraph.id is combination of sourceHash+targetHash+hexCounter, to be successful use source_id_s and/or target_id_s
this.getWebgraphConnector().deleteByQuery(WebgraphSchema.source_id_s + ":" + id);
}
} catch (final Throwable e) {
ConcurrentLog.logException(e);
}

0 comments on commit a1e5f7d

Please sign in to comment.