Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

added optimize-option

sixcoolere5abccdfe4bd
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) {
</fieldset>
</form>
<form action="IndexControlURLs_p.html" method="post" enctype="multipart/form-data" accept-charset="UTF-8">
+ <fieldset><legend>Optimize Solr</legend>
+ <dl>
+ <dt class="TableCellLight">&nbsp;</dt>
+ <dd>merge to max. <input type="text" name="optimizemax" value="#[optimizemax]#" size="6" maxlength="6" /> segments
+ <input type="submit" name="optimizesolr" value="Optimize Solr" class="submitready" style="width:240px;"/>
+ </dd>
+ </dl>
+ </fieldset>
+ </form>
+ <form action="IndexControlURLs_p.html" method="post" enctype="multipart/form-data" accept-charset="UTF-8">
<fieldset><legend>Reboot Solr Core</legend>
<dl>
<dt class="TableCellLight">&nbsp;</dt>
@@ -249,4 +259,4 @@ function updatepage(str) {
#%env/templates/footer.template%#
</body>
-</html>
\ No newline at end of file
+</html>
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<File> 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) {