orbiter 17 years ago
parent fd9233244e
commit 670244849d

@ -1797,6 +1797,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.
// find all the words in a specific resource and remove the url reference from every word index // find all the words in a specific resource and remove the url reference from every word index
// finally, delete the url entry // finally, delete the url entry
if (urlhash == null) return 0;
// determine the url string // determine the url string
final indexURLReference entry = webIndex.getURL(urlhash, null, 0); final indexURLReference entry = webIndex.getURL(urlhash, null, 0);
if (entry == null) return 0; if (entry == null) return 0;
@ -1807,27 +1808,33 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.
try { try {
// get the resource content // get the resource content
final Object[] resource = plasmaSnippetCache.getResource(comp.url(), fetchOnline, 10000, true, false); final Object[] resource = plasmaSnippetCache.getResource(comp.url(), fetchOnline, 10000, true, false);
resourceContent = (InputStream) resource[0]; if (resource == null) {
final Long resourceContentLength = (Long) resource[1]; // delete just the url entry
webIndex.removeURL(urlhash);
return 0;
} else {
resourceContent = (InputStream) resource[0];
final Long resourceContentLength = (Long) resource[1];
// parse the resource // parse the resource
final plasmaParserDocument document = plasmaSnippetCache.parseDocument(comp.url(), resourceContentLength.longValue(), resourceContent); final plasmaParserDocument document = plasmaSnippetCache.parseDocument(comp.url(), resourceContentLength.longValue(), resourceContent);
// get the word set // get the word set
Set<String> words = null; Set<String> words = null;
try { try {
words = new plasmaCondenser(document, true, true).words().keySet(); words = new plasmaCondenser(document, true, true).words().keySet();
} catch (final UnsupportedEncodingException e) { } catch (final UnsupportedEncodingException e) {
e.printStackTrace(); e.printStackTrace();
} }
// delete all word references // delete all word references
int count = 0; int count = 0;
if (words != null) count = webIndex.removeWordReferences(words, urlhash); if (words != null) count = webIndex.removeWordReferences(words, urlhash);
// finally delete the url entry itself // finally delete the url entry itself
webIndex.removeURL(urlhash); webIndex.removeURL(urlhash);
return count; return count;
}
} catch (final ParserException e) { } catch (final ParserException e) {
return 0; return 0;
} finally { } finally {

Loading…
Cancel
Save