Crawl results page : apply table lines number limit.

Take into account the already existing default limit value (especially
useful after a long crawl or surrogates import), or a custom one from
parameter "count".
Added a "Show all" link for convenience.
pull/122/head
luccioman 8 years ago
parent 31fff2c986
commit 8d288f5dba

@ -119,7 +119,7 @@
#(size)# #(size)#
Showing all #[all]# entries in this stack. Showing all #[all]# entries in this stack.
:: ::
Showing latest #[count]# lines from a stack of #[all]# entries. Showing latest #[count]# lines from a stack of #[all]# entries. <a href="CrawlResults.html?process=#[tabletype]#&count=2147483647">Show all</a>
#(/size)# #(/size)#
</em></p> </em></p>
<table > <table >

@ -58,12 +58,15 @@ public class CrawlResults {
/** Used for logging. */ /** Used for logging. */
private static final String APP_NAME = "PLASMA"; private static final String APP_NAME = "PLASMA";
/** Default maximum lines number of the indexed table */
private static final int DEFAULT_MAXIMUM_LINES = 500;
public static serverObjects respond(final RequestHeader header, serverObjects post, final serverSwitch env) { public static serverObjects respond(final RequestHeader header, serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements // return variable that accumulates replacements
final Switchboard sb = (Switchboard) env; final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects(); final serverObjects prop = new serverObjects();
int lines = 500; int lines = DEFAULT_MAXIMUM_LINES;
boolean showCollection = sb.index.fulltext().getDefaultConfiguration().isEmpty() || sb.index.fulltext().getDefaultConfiguration().contains(CollectionSchema.collection_sxt); boolean showCollection = sb.index.fulltext().getDefaultConfiguration().isEmpty() || sb.index.fulltext().getDefaultConfiguration().contains(CollectionSchema.collection_sxt);
boolean showInit = env.getConfigBool("IndexMonitorInit", false); boolean showInit = env.getConfigBool("IndexMonitorInit", false);
boolean showExec = env.getConfigBool("IndexMonitorExec", false); boolean showExec = env.getConfigBool("IndexMonitorExec", false);
@ -118,7 +121,7 @@ public class CrawlResults {
if (post != null) { if (post != null) {
// custom number of lines // custom number of lines
if (post.containsKey("count")) { if (post.containsKey("count")) {
lines = post.getInt("count", 500); lines = post.getInt("count", DEFAULT_MAXIMUM_LINES);
} }
// do the commands // do the commands
@ -154,7 +157,7 @@ public class CrawlResults {
} }
if (post.containsKey("moreIndexed")) { if (post.containsKey("moreIndexed")) {
lines = post.getInt("showIndexed", 500); lines = post.getInt("showIndexed", DEFAULT_MAXIMUM_LINES);
} }
if (post.get("si") != null) showInit = !("0".equals(post.get("si"))); if (post.get("si") != null) showInit = !("0".equals(post.get("si")));
@ -180,6 +183,7 @@ public class CrawlResults {
} else { } else {
prop.put("table_size", "1"); prop.put("table_size", "1");
prop.put("table_size_count", lines); prop.put("table_size_count", lines);
prop.put("table_size_tabletype", tabletype.getCode());
} }
prop.put("table_size_all", ResultURLs.getStackSize(tabletype)); prop.put("table_size_all", ResultURLs.getStackSize(tabletype));
@ -203,7 +207,7 @@ public class CrawlResults {
int cnt = 0; int cnt = 0;
final Iterator<Map.Entry<String, InitExecEntry>> i = ResultURLs.results(tabletype); final Iterator<Map.Entry<String, InitExecEntry>> i = ResultURLs.results(tabletype);
Map.Entry<String, InitExecEntry> entry; Map.Entry<String, InitExecEntry> entry;
while (i.hasNext()) { while (i.hasNext() && cnt < lines) {
entry = i.next(); entry = i.next();
try { try {
byte[] urlhash = UTF8.getBytes(entry.getKey()); byte[] urlhash = UTF8.getBytes(entry.getKey());

Loading…
Cancel
Save