diff --git a/htroot/IndexReIndexMonitor_p.html b/htroot/IndexReIndexMonitor_p.html index d60ec6aa3..78b1d3076 100644 --- a/htroot/IndexReIndexMonitor_p.html +++ b/htroot/IndexReIndexMonitor_p.html @@ -11,12 +11,13 @@

Field Re-Indexing

In case that an index schema has changed, all documents with missing field entries can be indexed again with a reindex job.

-
+
+
- + @@ -34,13 +35,21 @@
Documents in current queue #[querysize]##(showstartbutton)#::#(/showstartbutton)##(reindexjobrunning)#::#(/reindexjobrunning)#
Documents processed
- #(showstartbutton)# - - :: - #(/showstartbutton)# -

#[infomessage]#

+ #(reindexjobrunning)# + + :: + #(/reindexjobrunning)# +

#[infomessage]#

- +
+ #(reindexjobrunning)#:: +
Remaining field list +

reindex documents containing these fields:

+

#[fieldlist]#

+
+ #(/reindexjobrunning)# +
+ #%env/templates/footer.template%# diff --git a/htroot/IndexReIndexMonitor_p.java b/htroot/IndexReIndexMonitor_p.java index 2eb5660f6..a4604fc1c 100644 --- a/htroot/IndexReIndexMonitor_p.java +++ b/htroot/IndexReIndexMonitor_p.java @@ -36,35 +36,50 @@ public class IndexReIndexMonitor_p { prop.put("docsprocessed", "0"); prop.put("currentselectquery",""); BusyThread bt = sb.getThread("reindexSolr"); + if (bt == null) { + if (post != null && post.containsKey("reindexnow") && sb.index.fulltext().connectedLocalSolr()) { + migration.reindexToschema(sb); + prop.put("querysize", "0"); + prop.put("infomessage","reindex job started"); + + bt = sb.getThread("reindexSolr"); //get new created job for following posts + } + } + if (bt != null) { + prop.put("reindexjobrunning", 1); prop.put("querysize", bt.getJobCount()); if (bt instanceof ReindexSolrBusyThread) { prop.put("docsprocessed", ((ReindexSolrBusyThread) bt).getProcessed()); prop.put("currentselectquery","q="+((ReindexSolrBusyThread) bt).getCurrentQuery()); + // prepare list of fields in queue + final String[] querylist = ((ReindexSolrBusyThread) bt).getQueryList(); + if (querylist != null) { + String allfieldnames = ""; + for (String oneqs : querylist) { // just use fieldname from query (fieldname:[* TO *]) + allfieldnames = allfieldnames + oneqs.substring(0, oneqs.indexOf(':')) + "
"; + } + prop.put("reindexjobrunning_fieldlist", allfieldnames); + } else { + prop.put("reindexjobrunning_fieldlist", ""); + } } if (post != null && post.containsKey("stopreindex")) { sb.terminateThread("reindexSolr", false); prop.put("infomessage", "reindex job stopped"); - prop.put("showstartbutton", 1); + prop.put("reindexjobrunning",0); } else { prop.put("infomessage", "reindex is running"); - prop.put("showstartbutton", 0); } } else { - if (post != null && post.containsKey("reindexnow") && sb.index.fulltext().connectedLocalSolr()) { - migration.reindexToschema(sb); - prop.put("showstartbutton", 0); - prop.put("querysize", "0"); - prop.put("infomessage","reindex job started"); - } else { - prop.put("showstartbutton", 1); - prop.put("querysize", "is empty"); - prop.put("infomessage", "no reindex job running"); - } + prop.put("reindexjobrunning", 0); + + prop.put("querysize", "is empty"); + prop.put("infomessage", "no reindex job running"); } // return rewrite properties return prop; } -} +} \ No newline at end of file diff --git a/source/net/yacy/search/index/ReindexSolrBusyThread.java b/source/net/yacy/search/index/ReindexSolrBusyThread.java index a9cfab52c..91e5e61c7 100644 --- a/source/net/yacy/search/index/ReindexSolrBusyThread.java +++ b/source/net/yacy/search/index/ReindexSolrBusyThread.java @@ -174,6 +174,18 @@ import org.apache.solr.common.SolrInputDocument; public String getCurrentQuery() { return querylist.isEmpty() ? "" : querylist.get(0); } + + /** + * @return copy of all Solr select queries in the queue or null if empty + */ + public String[] getQueryList() { + if (querylist != null) { + String[] list = new String[querylist.size()]; + list = querylist.toArray(list); + return list; + } + return null; + } /** * @return number of currently selected (found) documents