calculating the correct size of an export.

This can be seen as a fix for
https://github.com/yacy/yacy_search_server/issues/343
however, the export was not flawed, it is just the impression that
something is wrong, but the export size must be smaller than the index
size because the index also containers error documents.
Now an information line is presented that shows i.e.:
"The local index currently contains 181,319 documents, only 106,887
exportable with status code 200 - the remaining are error documents."
pull/436/head
Michael Peter Christen 3 years ago
parent 4cadd557dc
commit 1bab4ffe20

@ -12,7 +12,7 @@
<h2>Index Export</h2>
<p>The local index currently contains #[ucount]# documents.</p>
<p>The local index currently contains #[ucount]# documents, only #[ucount200]# exportable with status code 200 - the remaining are error documents.</p>
#(lurlexport)#::
<form action="IndexExport_p.html" method="post" enctype="multipart/form-data" accept-charset="UTF-8">

@ -34,6 +34,7 @@ import net.yacy.search.Switchboard;
import net.yacy.search.SwitchboardConstants;
import net.yacy.search.index.Fulltext;
import net.yacy.search.index.Segment;
import net.yacy.search.schema.CollectionSchema;
import net.yacy.server.serverObjects;
import net.yacy.server.serverSwitch;
@ -46,7 +47,12 @@ public class IndexExport_p {
final serverObjects prop = new serverObjects();
Segment segment = sb.index;
// we have two counts of document: total number and such that are exportable with status code 200
long ucount = segment.fulltext().collectionSize();
long ucount200 = ucount;
try {
ucount200 = segment.fulltext().getDefaultConnector().getCountByQuery(CollectionSchema.httpstatus_i.getSolrFieldName() + ":200");
} catch (IOException e1) {}
// set default values
prop.put("otherHosts", "");
@ -62,6 +68,7 @@ public class IndexExport_p {
prop.put("dumprestore_dumpfile", dumpFiles.size() == 0 ? "" : dumpFiles.get(dumpFiles.size() - 1).getAbsolutePath());
prop.put("dumprestore_optimizemax", 10);
prop.putNum("ucount", ucount);
prop.putNum("ucount200", ucount200);
// show export messages
Fulltext.Export export = segment.fulltext().export();

Loading…
Cancel
Save