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);
// parse the resource return 0;
final plasmaParserDocument document = plasmaSnippetCache.parseDocument(comp.url(), resourceContentLength.longValue(), resourceContent); } else {
resourceContent = (InputStream) resource[0];
// get the word set final Long resourceContentLength = (Long) resource[1];
Set<String> words = null;
try { // parse the resource
words = new plasmaCondenser(document, true, true).words().keySet(); final plasmaParserDocument document = plasmaSnippetCache.parseDocument(comp.url(), resourceContentLength.longValue(), resourceContent);
} catch (final UnsupportedEncodingException e) {
e.printStackTrace(); // get the word set
Set<String> words = null;
try {
words = new plasmaCondenser(document, true, true).words().keySet();
} catch (final UnsupportedEncodingException e) {
e.printStackTrace();
}
// delete all word references
int count = 0;
if (words != null) count = webIndex.removeWordReferences(words, urlhash);
// finally delete the url entry itself
webIndex.removeURL(urlhash);
return count;
} }
// delete all word references
int count = 0;
if (words != null) count = webIndex.removeWordReferences(words, urlhash);
// finally delete the url entry itself
webIndex.removeURL(urlhash);
return count;
} catch (final ParserException e) { } catch (final ParserException e) {
return 0; return 0;
} finally { } finally {

Loading…
Cancel
Save