From e5abccdfe4bdfc1a52dcadb81c94b828b7541eb6 Mon Sep 17 00:00:00 2001 From: sixcooler Date: Fri, 28 Jun 2013 14:51:37 +0200 Subject: [PATCH] added optimize-option --- htroot/IndexControlURLs_p.html | 12 +++++++++++- htroot/IndexControlURLs_p.java | 7 +++++++ source/net/yacy/search/index/Fulltext.java | 12 +++++++++++- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/htroot/IndexControlURLs_p.html b/htroot/IndexControlURLs_p.html index 6eab66226..b83d63754 100644 --- a/htroot/IndexControlURLs_p.html +++ b/htroot/IndexControlURLs_p.html @@ -163,6 +163,16 @@ function updatepage(str) {
+
Optimize Solr +
+
 
+
merge to max. segments + +
+
+
+
+
Reboot Solr Core
 
@@ -249,4 +259,4 @@ function updatepage(str) { #%env/templates/footer.template%# - \ No newline at end of file + diff --git a/htroot/IndexControlURLs_p.java b/htroot/IndexControlURLs_p.java index 69f43c97a..e75d9547a 100644 --- a/htroot/IndexControlURLs_p.java +++ b/htroot/IndexControlURLs_p.java @@ -78,6 +78,7 @@ public class IndexControlURLs_p { prop.put("dumprestore", 1); List dumpFiles = segment.fulltext().dumpFiles(); prop.put("dumprestore_dumpfile", dumpFiles.size() == 0 ? "" : dumpFiles.get(dumpFiles.size() - 1).getAbsolutePath()); + prop.put("dumprestore_optimizemax", 10); prop.put("cleanup", post == null ? 1 : 0); prop.put("cleanup_solr", segment.fulltext().connectedRemoteSolr() ? 1 : 0); prop.put("cleanup_rwi", segment.termIndex() != null && !segment.termIndex().isEmpty() ? 1 : 0); @@ -277,6 +278,12 @@ public class IndexControlURLs_p { final File dump = new File(post.get("dumpfile", "")); segment.fulltext().restoreSolr(dump); } + + if (post.containsKey("optimizesolr")) { + final int size = post.getInt("optimizemax", 10); + segment.fulltext().optimize(size); + sb.tables.recordAPICall(post, "IndexControlURLs_p.html", WorkTables.TABLE_API_TYPE_STEERING, "solr optimize " + size); + } if (post.containsKey("rebootsolr")) { segment.fulltext().rebootSolr(); diff --git a/source/net/yacy/search/index/Fulltext.java b/source/net/yacy/search/index/Fulltext.java index b43a3b095..f021d410f 100644 --- a/source/net/yacy/search/index/Fulltext.java +++ b/source/net/yacy/search/index/Fulltext.java @@ -701,9 +701,19 @@ public final class Fulltext { } } } + + /** + * optimize solr (experimental to check resource management) + * @param size + */ + public void optimize(final int size) { + if (size < 1) return; + getDefaultConnector().optimize(size); + getWebgraphConnector().optimize(size); + } /** - * reboot solr (experimental to check resource management + * reboot solr (experimental to check resource management) */ public void rebootSolr() { synchronized (this.solrInstances) {