added optimize-option

pull/1/head
sixcooler 12 years ago
parent 8caaf6203a
commit e5abccdfe4

@ -163,6 +163,16 @@ function updatepage(str) {
</fieldset> </fieldset>
</form> </form>
<form action="IndexControlURLs_p.html" method="post" enctype="multipart/form-data" accept-charset="UTF-8"> <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> <fieldset><legend>Reboot Solr Core</legend>
<dl> <dl>
<dt class="TableCellLight">&nbsp;</dt> <dt class="TableCellLight">&nbsp;</dt>
@ -249,4 +259,4 @@ function updatepage(str) {
#%env/templates/footer.template%# #%env/templates/footer.template%#
</body> </body>
</html> </html>

@ -78,6 +78,7 @@ public class IndexControlURLs_p {
prop.put("dumprestore", 1); prop.put("dumprestore", 1);
List<File> dumpFiles = segment.fulltext().dumpFiles(); List<File> dumpFiles = segment.fulltext().dumpFiles();
prop.put("dumprestore_dumpfile", dumpFiles.size() == 0 ? "" : dumpFiles.get(dumpFiles.size() - 1).getAbsolutePath()); 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", post == null ? 1 : 0);
prop.put("cleanup_solr", segment.fulltext().connectedRemoteSolr() ? 1 : 0); prop.put("cleanup_solr", segment.fulltext().connectedRemoteSolr() ? 1 : 0);
prop.put("cleanup_rwi", segment.termIndex() != null && !segment.termIndex().isEmpty() ? 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", "")); final File dump = new File(post.get("dumpfile", ""));
segment.fulltext().restoreSolr(dump); 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")) { if (post.containsKey("rebootsolr")) {
segment.fulltext().rebootSolr(); segment.fulltext().rebootSolr();

@ -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() { public void rebootSolr() {
synchronized (this.solrInstances) { synchronized (this.solrInstances) {

Loading…
Cancel
Save