fix #1763 remove .crawler indices on maintenance page
This commit is contained in:
parent
de3044248b
commit
9dbe3eaaec
6 changed files with 50 additions and 47 deletions
|
@ -20,20 +20,8 @@ import java.util.Date;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.codelibs.fess.app.service.ScheduledJobService;
|
||||
import org.codelibs.fess.app.web.base.FessAdminAction;
|
||||
import org.codelibs.fess.es.client.FessEsClient;
|
||||
import org.codelibs.fess.es.config.exbhv.DataConfigBhv;
|
||||
import org.codelibs.fess.es.config.exbhv.DataConfigToRoleBhv;
|
||||
import org.codelibs.fess.es.config.exbhv.ElevateWordBhv;
|
||||
import org.codelibs.fess.es.config.exbhv.FileConfigBhv;
|
||||
import org.codelibs.fess.es.config.exbhv.FileConfigToRoleBhv;
|
||||
import org.codelibs.fess.es.config.exbhv.LabelToRoleBhv;
|
||||
import org.codelibs.fess.es.config.exbhv.LabelTypeBhv;
|
||||
import org.codelibs.fess.es.config.exbhv.RoleTypeBhv;
|
||||
import org.codelibs.fess.es.config.exbhv.WebConfigBhv;
|
||||
import org.codelibs.fess.es.config.exbhv.WebConfigToRoleBhv;
|
||||
import org.codelibs.fess.es.user.exbhv.RoleBhv;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.lastaflute.web.Execute;
|
||||
import org.lastaflute.web.response.HtmlResponse;
|
||||
|
@ -51,45 +39,10 @@ public class AdminMaintenanceAction extends FessAdminAction {
|
|||
// ===================================================================================
|
||||
// Attribute
|
||||
//
|
||||
@Resource
|
||||
protected RoleBhv roleBhv;
|
||||
|
||||
@Resource
|
||||
protected RoleTypeBhv roleTypeBhv;
|
||||
|
||||
@Resource
|
||||
protected LabelToRoleBhv labelToRoleBhv;
|
||||
|
||||
@Resource
|
||||
protected LabelTypeBhv labelTypeBhv;
|
||||
|
||||
@Resource
|
||||
protected WebConfigToRoleBhv webConfigToRoleBhv;
|
||||
|
||||
@Resource
|
||||
protected WebConfigBhv webConfigBhv;
|
||||
|
||||
@Resource
|
||||
protected FileConfigToRoleBhv fileConfigToRoleBhv;
|
||||
|
||||
@Resource
|
||||
protected FileConfigBhv fileConfigBhv;
|
||||
|
||||
@Resource
|
||||
protected DataConfigToRoleBhv dataConfigToRoleBhv;
|
||||
|
||||
@Resource
|
||||
protected DataConfigBhv dataConfigBhv;
|
||||
|
||||
@Resource
|
||||
protected ElevateWordBhv elevateWordBhv;
|
||||
|
||||
@Resource
|
||||
protected FessEsClient fessEsClient;
|
||||
|
||||
@Resource
|
||||
private ScheduledJobService scheduledJobService;
|
||||
|
||||
// ===================================================================================
|
||||
// Hook
|
||||
// ======
|
||||
|
@ -123,6 +76,24 @@ public class AdminMaintenanceAction extends FessAdminAction {
|
|||
return redirect(getClass());
|
||||
}
|
||||
|
||||
@Execute
|
||||
public HtmlResponse clearCrawlerIndex(final UpgradeForm form) {
|
||||
validate(form, messages -> {}, this::asIndexHtml);
|
||||
verifyToken(this::asIndexHtml);
|
||||
fessEsClient
|
||||
.admin()
|
||||
.indices()
|
||||
.prepareDelete(//
|
||||
fessConfig.getIndexDocumentCrawlerIndex() + ".queue", //
|
||||
fessConfig.getIndexDocumentCrawlerIndex() + ".data", //
|
||||
fessConfig.getIndexDocumentCrawlerIndex() + ".filter")
|
||||
.execute(
|
||||
ActionListener.wrap(res -> logger.info("Deleted .crawler indices."),
|
||||
e -> logger.warn("Failed to delete .crawler.* indices.", e)));
|
||||
saveInfo(messages -> messages.addSuccessStartedDataUpdate(GLOBAL));
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
||||
private boolean startReindex(final boolean replaceAliases, final String numberOfShards, final String autoExpandReplicas) {
|
||||
final String docIndex = "fess";
|
||||
final String fromIndex = fessConfig.getIndexDocumentUpdateIndex();
|
||||
|
|
|
@ -2823,6 +2823,12 @@ public class FessLabels extends UserMessages {
|
|||
/** The key of the message: Auto expand replicas */
|
||||
public static final String LABELS_auto_expand_replicas_for_doc = "{labels.auto_expand_replicas_for_doc}";
|
||||
|
||||
/** The key of the message: Crawler Indices */
|
||||
public static final String LABELS_clear_crawler_index = "{labels.clear_crawler_index}";
|
||||
|
||||
/** The key of the message: Clear .crawler Indices */
|
||||
public static final String LABELS_clear_crawler_index_button = "{labels.clear_crawler_index_button}";
|
||||
|
||||
/**
|
||||
* Assert the property is not null.
|
||||
* @param property The value of the property. (NotNull)
|
||||
|
|
|
@ -931,3 +931,5 @@ labels.searchlog_accesstype=Access Type
|
|||
labels.maintenance_title_configuration=Maintenance
|
||||
labels.number_of_shards_for_doc=The number of shards
|
||||
labels.auto_expand_replicas_for_doc=Auto expand replicas
|
||||
labels.clear_crawler_index=Crawler Indices
|
||||
labels.clear_crawler_index_button=Clear .crawler Indices
|
||||
|
|
|
@ -931,3 +931,5 @@ labels.searchlog_accesstype=Access Type
|
|||
labels.maintenance_title_configuration=Maintenance
|
||||
labels.number_of_shards_for_doc=The number of shards
|
||||
labels.auto_expand_replicas_for_doc=Auto expand replicas
|
||||
labels.clear_crawler_index=Crawler Indices
|
||||
labels.clear_crawler_index_button=Clear .crawler Indices
|
||||
|
|
|
@ -933,3 +933,5 @@ labels.searchlog_accesstype=アクセスタイプ
|
|||
labels.maintenance_title_configuration=メンテナンス
|
||||
labels.number_of_shards_for_doc=シャード数
|
||||
labels.auto_expand_replicas_for_doc=最大レプリカ数
|
||||
labels.clear_crawler_index=Crawlerインデックス
|
||||
labels.clear_crawler_index_button=.crawlerインデックスの削除
|
||||
|
|
|
@ -81,6 +81,26 @@
|
|||
</div>
|
||||
<!-- /.box -->
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">
|
||||
<la:message key="labels.clear_crawler_index" />
|
||||
</h3>
|
||||
</div>
|
||||
<!-- /.box-header -->
|
||||
<div class="box-footer">
|
||||
<button type="submit" class="btn btn-primary"
|
||||
name="clearCrawlerIndex"
|
||||
value="<la:message key="labels.clear_crawler_index_button"/>">
|
||||
<i class="fa fa-arrow-circle-right"></i>
|
||||
<la:message key="labels.clear_crawler_index_button" />
|
||||
</button>
|
||||
</div>
|
||||
<!-- /.box-footer -->
|
||||
</div>
|
||||
<!-- /.box -->
|
||||
</div>
|
||||
</la:form>
|
||||
</div>
|
||||
</section>
|
||||
|
|
Loading…
Add table
Reference in a new issue