|
|
@ -47,6 +47,7 @@
|
|
|
|
// if the shell's current path is HTROOT
|
|
|
|
// if the shell's current path is HTROOT
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
import java.net.MalformedURLException;
|
|
|
|
import java.net.URL;
|
|
|
|
import java.net.URL;
|
|
|
|
import java.util.Enumeration;
|
|
|
|
import java.util.Enumeration;
|
|
|
|
import java.util.HashSet;
|
|
|
|
import java.util.HashSet;
|
|
|
@ -91,10 +92,10 @@ public class IndexControl_p {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// default values
|
|
|
|
// default values
|
|
|
|
String keystring = ((String) post.get("keystring")).trim();
|
|
|
|
String keystring = ((String) post.get("keystring", "")).trim();
|
|
|
|
String keyhash = ((String) post.get("keyhash")).trim();
|
|
|
|
String keyhash = ((String) post.get("keyhash", "")).trim();
|
|
|
|
String urlstring = ((String) post.get("urlstring")).trim();
|
|
|
|
String urlstring = ((String) post.get("urlstring", "")).trim();
|
|
|
|
String urlhash = ((String) post.get("urlhash")).trim();
|
|
|
|
String urlhash = ((String) post.get("urlhash", "")).trim();
|
|
|
|
|
|
|
|
|
|
|
|
if (!urlstring.startsWith("http://") &&
|
|
|
|
if (!urlstring.startsWith("http://") &&
|
|
|
|
!urlstring.startsWith("https://")) { urlstring = "http://" + urlstring; }
|
|
|
|
!urlstring.startsWith("https://")) { urlstring = "http://" + urlstring; }
|
|
|
@ -166,9 +167,7 @@ public class IndexControl_p {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (delurlref) {
|
|
|
|
if (delurlref) {
|
|
|
|
for (int i = 0; i < urlx.length; i++) try {
|
|
|
|
for (int i = 0; i < urlx.length; i++) switchboard.removeAllUrlReferences(urlx[i], true);
|
|
|
|
switchboard.removeAllUrlReferences(urlx[i], true);
|
|
|
|
|
|
|
|
} catch (IOException e) {}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (delurl || delurlref) {
|
|
|
|
if (delurl || delurlref) {
|
|
|
|
for (int i = 0; i < urlx.length; i++) {
|
|
|
|
for (int i = 0; i < urlx.length; i++) {
|
|
|
@ -188,9 +187,7 @@ public class IndexControl_p {
|
|
|
|
// delete selected URLs
|
|
|
|
// delete selected URLs
|
|
|
|
if (post.containsKey("keyhashdelete")) {
|
|
|
|
if (post.containsKey("keyhashdelete")) {
|
|
|
|
if (delurlref) {
|
|
|
|
if (delurlref) {
|
|
|
|
for (int i = 0; i < urlx.length; i++) try {
|
|
|
|
for (int i = 0; i < urlx.length; i++) switchboard.removeAllUrlReferences(urlx[i], true);
|
|
|
|
switchboard.removeAllUrlReferences(urlx[i], true);
|
|
|
|
|
|
|
|
} catch (IOException e) {}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (delurl || delurlref) {
|
|
|
|
if (delurl || delurlref) {
|
|
|
|
for (int i = 0; i < urlx.length; i++) {
|
|
|
|
for (int i = 0; i < urlx.length; i++) {
|
|
|
@ -211,12 +208,12 @@ public class IndexControl_p {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (post.containsKey("urlhashdeleteall")) {
|
|
|
|
if (post.containsKey("urlhashdeleteall")) {
|
|
|
|
try {
|
|
|
|
//try {
|
|
|
|
int i = switchboard.removeAllUrlReferences(urlhash, true);
|
|
|
|
int i = switchboard.removeAllUrlReferences(urlhash, true);
|
|
|
|
prop.put("result", "Deleted URL and " + i + " references from " + i + " word indexes.");
|
|
|
|
prop.put("result", "Deleted URL and " + i + " references from " + i + " word indexes.");
|
|
|
|
} catch (IOException e) {
|
|
|
|
//} catch (IOException e) {
|
|
|
|
prop.put("result", "Deleted nothing because the url-hash could not be resolved");
|
|
|
|
// prop.put("result", "Deleted nothing because the url-hash could not be resolved");
|
|
|
|
}
|
|
|
|
//}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (post.containsKey("urlhashdelete")) {
|
|
|
|
if (post.containsKey("urlhashdelete")) {
|
|
|
@ -311,11 +308,7 @@ public class IndexControl_p {
|
|
|
|
while (hashIt.hasNext() && i < 256) {
|
|
|
|
while (hashIt.hasNext() && i < 256) {
|
|
|
|
hash = (String) hashIt.next();
|
|
|
|
hash = (String) hashIt.next();
|
|
|
|
result.append("<a href=\"/IndexControl_p.html?")
|
|
|
|
result.append("<a href=\"/IndexControl_p.html?")
|
|
|
|
.append("keystring=")
|
|
|
|
.append("keyhash=").append(hash).append("&keyhashsearch=")
|
|
|
|
.append("&keyhash=").append(hash)
|
|
|
|
|
|
|
|
.append("&urlhash=")
|
|
|
|
|
|
|
|
.append("&urlstring=")
|
|
|
|
|
|
|
|
.append("&urlhashsearch=")
|
|
|
|
|
|
|
|
.append("\" class=\"tt\">").append(hash).append("</a> ")
|
|
|
|
.append("\" class=\"tt\">").append(hash).append("</a> ")
|
|
|
|
.append(((i + 1) % 8 == 0) ? "<br>" : "");
|
|
|
|
.append(((i + 1) % 8 == 0) ? "<br>" : "");
|
|
|
|
i++;
|
|
|
|
i++;
|
|
|
@ -326,12 +319,15 @@ public class IndexControl_p {
|
|
|
|
if (post.containsKey("urlstringsearch")) {
|
|
|
|
if (post.containsKey("urlstringsearch")) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
URL url = new URL(urlstring);
|
|
|
|
URL url = new URL(urlstring);
|
|
|
|
urlhash = plasmaURL.urlHash(url);
|
|
|
|
urlhash = plasmaURL.urlHash(url);
|
|
|
|
prop.put("urlhash", urlhash);
|
|
|
|
prop.put("urlhash", urlhash);
|
|
|
|
plasmaCrawlLURL.Entry entry = switchboard.urlPool.loadedURL.getEntry(urlhash);
|
|
|
|
plasmaCrawlLURL.Entry entry = switchboard.urlPool.loadedURL.getEntry(urlhash);
|
|
|
|
prop.put("result", genUrlProfile(switchboard, entry, urlhash));
|
|
|
|
prop.put("result", genUrlProfile(switchboard, entry, urlhash));
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (MalformedURLException e) {
|
|
|
|
prop.put("urlstring", "wrong url: " + urlstring);
|
|
|
|
prop.put("urlstring", "bad url: " + urlstring);
|
|
|
|
|
|
|
|
prop.put("urlhash", "");
|
|
|
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
|
|
|
prop.put("urlstring", "unknown url: " + urlstring);
|
|
|
|
prop.put("urlhash", "");
|
|
|
|
prop.put("urlhash", "");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -356,7 +352,10 @@ public class IndexControl_p {
|
|
|
|
int i = 0;
|
|
|
|
int i = 0;
|
|
|
|
while (hashIt.hasNext() && i < 256) {
|
|
|
|
while (hashIt.hasNext() && i < 256) {
|
|
|
|
hash = (String) hashIt.next();
|
|
|
|
hash = (String) hashIt.next();
|
|
|
|
result.append("<a href=\"/IndexControl_p.html?").append("keystring=").append("&keyhash=").append("&urlhash=").append(hash).append("&urlstring=").append("&urlhashsearch=").append("\" class=\"tt\">").append(hash).append("</a> ").append(((i + 1) % 8 == 0) ? "<br>" : "");
|
|
|
|
result.append("<a href=\"/IndexControl_p.html?")
|
|
|
|
|
|
|
|
.append("urlhash=").append(hash).append("&urlhashsearch=")
|
|
|
|
|
|
|
|
.append("\" class=\"tt\">").append(hash).append("</a> ")
|
|
|
|
|
|
|
|
.append(((i + 1) % 8 == 0) ? "<br>" : "");
|
|
|
|
i++;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
prop.put("result", result.toString());
|
|
|
|
prop.put("result", result.toString());
|
|
|
@ -449,10 +448,10 @@ public class IndexControl_p {
|
|
|
|
final TreeMap tm = new TreeMap();
|
|
|
|
final TreeMap tm = new TreeMap();
|
|
|
|
while (en.hasNext()) {
|
|
|
|
while (en.hasNext()) {
|
|
|
|
uh = ((plasmaWordIndexEntry)en.next()).getUrlHash();
|
|
|
|
uh = ((plasmaWordIndexEntry)en.next()).getUrlHash();
|
|
|
|
if (switchboard.urlPool.loadedURL.exists(uh)) {
|
|
|
|
try {
|
|
|
|
us = switchboard.urlPool.loadedURL.getEntry(uh).url().toString();
|
|
|
|
us = switchboard.urlPool.loadedURL.getEntry(uh).url().toString();
|
|
|
|
tm.put(us, uh);
|
|
|
|
tm.put(us, uh);
|
|
|
|
} else {
|
|
|
|
} catch (IOException e) {
|
|
|
|
tm.put("", uh);
|
|
|
|
tm.put("", uh);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|