final boolean delurlref = post.containsKey("delurlref");
if (post.containsKey("keystringsearch")) {
keyhash = Word.word2hash(keystring);
prop.put("keyhash", keyhash);
final RWIProcess ranking = genSearchresult(prop, sb, segment, keyhash, null);
if (ranking.filteredCount() == 0) {
prop.put("searchresult", 1);
prop.putHTML("searchresult_word", keystring);
}
}
if (post.containsKey("keyhashsearch")) {
if (keystring.length() == 0 || !ByteBuffer.equals(Word.word2hash(keystring), keyhash)) {
prop.put("keystring", "<not possible to compute word from hash>");
}
final RWIProcess ranking = genSearchresult(prop, sb, segment, keyhash, null);
if (ranking.filteredCount() == 0) {
prop.put("searchresult", 2);
prop.putHTML("searchresult_wordhash", ASCII.String(keyhash));
}
}
// delete everything
if (post.containsKey("deletecomplete")) {
if (post.get("deleteIndex", "").equals("on")) {
segment.clear();
}
if (post.get("deleteSolr", "").equals("on") && sb.getConfigBool("federated.service.solr.indexing.enabled", false)) try {
sb.indexSegments.segment(Segments.Process.LOCALCRAWLING).getSolr().clear();
} catch (final Exception e) {
Log.logException(e);
}
if (post.get("deleteCrawlQueues", "").equals("on")) {
sb.crawlQueues.clear();
sb.crawlStacker.clear();
ResultURLs.clearStacks();
}
if (post.get("deleteCache", "").equals("on")) {
Cache.clear();
}
if (post.get("deleteRobots", "").equals("on")) {
sb.robots.clear();
}
if (post.get("deleteSearchFl", "").equals("on")) {
sb.tables.clear(WorkTables.TABLE_SEARCH_FAILURE_NAME);
}
post.remove("deletecomplete");
}
// set reference limitation
if (post.containsKey("maxReferencesLimit")) {
if (post.get("maxReferencesRadio", "").equals("on")) {
ReferenceContainer.maxReferences = post.getInt("maxReferences", 0);
} else {
ReferenceContainer.maxReferences = 0;
}
sb.setConfig("index.maxReferences", ReferenceContainer.maxReferences);
}
// delete word
if (post.containsKey("keyhashdeleteall")) try {
if (delurl || delurlref) {
// generate urlx: an array of url hashes to be deleted
ReferenceContainer<WordReference> index = null;
index = segment.termIndex().get(keyhash, null);
final Iterator<WordReference> en = index.entries();
urlb = new HandleSet(URIMetadataRow.rowdef.primaryKeyLength, URIMetadataRow.rowdef.objectOrder, index.size());
while (en.hasNext()) try { urlb.put(en.next().urlhash()); } catch (final RowSpaceExceededException e) { Log.logException(e); }
index = null;
}
if (delurlref) {
segment.removeAllUrlReferences(urlb, sb.loader, CacheStrategy.IFEXIST);
}
// delete the word first because that is much faster than the deletion of the urls from the url database
segment.termIndex().delete(keyhash);
// now delete all urls if demanded
if (delurl || delurlref) {
for (final byte[] b: urlb) sb.urlRemove(segment, b);
}
post.remove("keyhashdeleteall");
post.put("urllist", "generated");
} catch (final IOException e) {
Log.logException(e);
}
// delete selected URLs
if (post.containsKey("keyhashdelete")) try {
if (delurlref) {
segment.removeAllUrlReferences(urlb, sb.loader, CacheStrategy.IFEXIST);
}
if (delurl || delurlref) {
for (final byte[] b: urlb) sb.urlRemove(segment, b);
}
final HandleSet urlHashes = new HandleSet(URIMetadataRow.rowdef.primaryKeyLength, URIMetadataRow.rowdef.objectOrder, 0);
for (final byte[] b: urlb) try { urlHashes.put(b); } catch (final RowSpaceExceededException e) { Log.logException(e); }
segment.termIndex().remove(keyhash, urlHashes);
// this shall lead to a presentation of the list; so handle that the remaining program
// thinks that it was called for a list presentation
post.remove("keyhashdelete");
post.put("urllist", "generated");
} catch (final IOException e) {
Log.logException(e);
}
if (post.containsKey("urllist")) {
if (keystring.length() == 0 || !ByteBuffer.equals(Word.word2hash(keystring), keyhash)) {
prop.put("keystring", "<not possible to compute word from hash>");
}
final Bitfield flags = compileFlags(post);
final int count = (post.get("lines", "all").equals("all")) ? -1 : post.getInt("lines", -1);
final RWIProcess ranking = genSearchresult(prop, sb, segment, keyhash, flags);
genURLList(prop, keyhash, keystring, ranking, flags, count);
}
// transfer to other peer
if (post.containsKey("keyhashtransfer")) try {