Merge branch 'master' of ssh://git@gitorious.org/yacy/rc1.git

This commit is contained in:
Michael Peter Christen 2013-06-28 15:03:25 +02:00
commit 9d291764d1
3 changed files with 29 additions and 2 deletions

View File

@ -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>
</html>

View File

@ -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();

View File

@ -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) {