modify crawl action (in progress)
This commit is contained in:
parent
fe820463cd
commit
fe2ecd9693
6 changed files with 229 additions and 180 deletions
2
pom.xml
2
pom.xml
|
@ -106,7 +106,6 @@
|
|||
<exclude>org/codelibs/fess/app/web/admin/SystemForm.java</exclude>
|
||||
<exclude>org/codelibs/fess/app/web/admin/SearchListAction.java</exclude>
|
||||
<exclude>org/codelibs/fess/app/web/admin/SuggestElevateWordForm.java</exclude>
|
||||
<exclude>org/codelibs/fess/app/web/admin/CrawlAction.java</exclude>
|
||||
<exclude>org/codelibs/fess/app/web/admin/DocumentForm.java</exclude>
|
||||
<exclude>org/codelibs/fess/app/web/admin/DataForm.java</exclude>
|
||||
<exclude>org/codelibs/fess/app/web/admin/SuggestBadWordAction.java</exclude>
|
||||
|
@ -121,7 +120,6 @@
|
|||
<exclude>org/codelibs/fess/app/web/admin/CrawlingSessionAction.java</exclude>
|
||||
<exclude>org/codelibs/fess/app/web/admin/SuggestBadWordForm.java</exclude>
|
||||
<exclude>org/codelibs/fess/app/web/admin/CrawlingSessionForm.java</exclude>
|
||||
<exclude>org/codelibs/fess/app/web/admin/CrawlForm.java</exclude>
|
||||
<exclude>org/codelibs/fess/app/web/admin/WizardForm.java</exclude>
|
||||
<exclude>org/codelibs/fess/app/web/admin/FailureUrlForm.java</exclude>
|
||||
<exclude>org/codelibs/fess/app/web/base/AbstractLoginAction.java</exclude>
|
||||
|
|
|
@ -1,174 +0,0 @@
|
|||
/*
|
||||
* Copyright 2009-2015 the CodeLibs Project and the Others.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package org.codelibs.fess.app.web.admin;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.codelibs.core.lang.StringUtil;
|
||||
import org.codelibs.core.misc.DynamicProperties;
|
||||
import org.codelibs.fess.Constants;
|
||||
import org.codelibs.fess.annotation.Token;
|
||||
import org.codelibs.fess.crud.util.SAStrutsUtil;
|
||||
import org.codelibs.fess.exception.SSCActionMessagesException;
|
||||
import org.codelibs.fess.helper.SystemHelper;
|
||||
import org.lastaflute.web.util.LaRequestUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class CrawlAction implements Serializable {
|
||||
private static final Logger logger = LoggerFactory.getLogger(CrawlAction.class);
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
//@ActionForm
|
||||
@Resource
|
||||
protected CrawlForm crawlForm;
|
||||
|
||||
@Resource
|
||||
protected DynamicProperties crawlerProperties;
|
||||
|
||||
@Resource
|
||||
protected SystemHelper systemHelper;
|
||||
|
||||
public String getHelpLink() {
|
||||
return systemHelper.getHelpLink("crawl");
|
||||
}
|
||||
|
||||
protected String showIndex(final boolean redirect) {
|
||||
crawlForm.diffCrawling = crawlerProperties.getProperty(Constants.DIFF_CRAWLING_PROPERTY, Constants.TRUE);
|
||||
crawlForm.useAclAsRole = crawlerProperties.getProperty(Constants.USE_ACL_AS_ROLE, Constants.FALSE);
|
||||
crawlForm.dayForCleanup = crawlerProperties.getProperty(Constants.DAY_FOR_CLEANUP_PROPERTY, "1");
|
||||
crawlForm.crawlingThreadCount = crawlerProperties.getProperty(Constants.CRAWLING_THREAD_COUNT_PROPERTY, "5");
|
||||
crawlForm.searchLog = crawlerProperties.getProperty(Constants.SEARCH_LOG_PROPERTY, Constants.TRUE);
|
||||
crawlForm.userInfo = crawlerProperties.getProperty(Constants.USER_INFO_PROPERTY, Constants.TRUE);
|
||||
crawlForm.userFavorite = crawlerProperties.getProperty(Constants.USER_FAVORITE_PROPERTY, Constants.FALSE);
|
||||
crawlForm.webApiXml = crawlerProperties.getProperty(Constants.WEB_API_XML_PROPERTY, Constants.TRUE);
|
||||
crawlForm.webApiJson = crawlerProperties.getProperty(Constants.WEB_API_JSON_PROPERTY, Constants.TRUE);
|
||||
crawlForm.defaultLabelValue = crawlerProperties.getProperty(Constants.DEFAULT_LABEL_VALUE_PROPERTY, StringUtil.EMPTY);
|
||||
crawlForm.appendQueryParameter = crawlerProperties.getProperty(Constants.APPEND_QUERY_PARAMETER_PROPERTY, Constants.FALSE);
|
||||
crawlForm.supportedSearch =
|
||||
crawlerProperties.getProperty(Constants.SUPPORTED_SEARCH_FEATURE_PROPERTY, Constants.SUPPORTED_SEARCH_WEB);
|
||||
crawlForm.ignoreFailureType =
|
||||
crawlerProperties.getProperty(Constants.IGNORE_FAILURE_TYPE_PROPERTY, Constants.DEFAULT_IGNORE_FAILURE_TYPE);
|
||||
crawlForm.failureCountThreshold =
|
||||
crawlerProperties.getProperty(Constants.FAILURE_COUNT_THRESHOLD_PROPERTY, Constants.DEFAULT_FAILURE_COUNT);
|
||||
crawlForm.hotSearchWord = crawlerProperties.getProperty(Constants.WEB_API_HOT_SEARCH_WORD_PROPERTY, Constants.TRUE);
|
||||
crawlForm.csvFileEncoding = crawlerProperties.getProperty(Constants.CSV_FILE_ENCODING_PROPERTY, Constants.UTF_8);
|
||||
crawlForm.purgeSearchLogDay = crawlerProperties.getProperty(Constants.PURGE_SEARCH_LOG_DAY_PROPERTY, Constants.DEFAULT_PURGE_DAY);
|
||||
crawlForm.purgeJobLogDay = crawlerProperties.getProperty(Constants.PURGE_JOB_LOG_DAY_PROPERTY, Constants.DEFAULT_PURGE_DAY);
|
||||
crawlForm.purgeUserInfoDay = crawlerProperties.getProperty(Constants.PURGE_USER_INFO_DAY_PROPERTY, Constants.DEFAULT_PURGE_DAY);
|
||||
crawlForm.purgeByBots = crawlerProperties.getProperty(Constants.PURGE_BY_BOTS_PROPERTY, Constants.DEFAULT_PURGE_BY_BOTS);
|
||||
crawlForm.notificationTo = crawlerProperties.getProperty(Constants.NOTIFICATION_TO_PROPERTY, StringUtil.EMPTY);
|
||||
crawlForm.suggestSearchLog = crawlerProperties.getProperty(Constants.SUGGEST_SEARCH_LOG_PROPERTY, Constants.TRUE);
|
||||
crawlForm.purgeSuggestSearchLogDay = crawlerProperties.getProperty(Constants.PURGE_SUGGEST_SEARCH_LOG_DAY_PROPERTY, "30");
|
||||
if (redirect) {
|
||||
return "index?redirect=true";
|
||||
} else {
|
||||
return "index.jsp";
|
||||
}
|
||||
}
|
||||
|
||||
@Token(save = true, validate = false)
|
||||
//@Execute(validator = false)
|
||||
public String index() {
|
||||
return showIndex(false);
|
||||
}
|
||||
|
||||
@Token(save = false, validate = true)
|
||||
//@Execute(validator = true, input = "index.jsp")
|
||||
public String update() {
|
||||
crawlerProperties.setProperty(Constants.DIFF_CRAWLING_PROPERTY,
|
||||
crawlForm.diffCrawling != null && Constants.ON.equalsIgnoreCase(crawlForm.diffCrawling) ? Constants.TRUE : Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.USE_ACL_AS_ROLE,
|
||||
crawlForm.useAclAsRole != null && Constants.ON.equalsIgnoreCase(crawlForm.useAclAsRole) ? Constants.TRUE : Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.DAY_FOR_CLEANUP_PROPERTY, crawlForm.dayForCleanup);
|
||||
crawlerProperties.setProperty(Constants.CRAWLING_THREAD_COUNT_PROPERTY, crawlForm.crawlingThreadCount);
|
||||
crawlerProperties.setProperty(Constants.SEARCH_LOG_PROPERTY,
|
||||
crawlForm.searchLog != null && Constants.ON.equalsIgnoreCase(crawlForm.searchLog) ? Constants.TRUE : Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.USER_INFO_PROPERTY,
|
||||
crawlForm.userInfo != null && Constants.ON.equalsIgnoreCase(crawlForm.userInfo) ? Constants.TRUE : Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.USER_FAVORITE_PROPERTY,
|
||||
crawlForm.userFavorite != null && Constants.ON.equalsIgnoreCase(crawlForm.userFavorite) ? Constants.TRUE : Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.WEB_API_XML_PROPERTY,
|
||||
crawlForm.webApiXml != null && Constants.ON.equalsIgnoreCase(crawlForm.webApiXml) ? Constants.TRUE : Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.WEB_API_JSON_PROPERTY,
|
||||
crawlForm.webApiJson != null && Constants.ON.equalsIgnoreCase(crawlForm.webApiJson) ? Constants.TRUE : Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.DEFAULT_LABEL_VALUE_PROPERTY, crawlForm.defaultLabelValue);
|
||||
crawlerProperties.setProperty(Constants.APPEND_QUERY_PARAMETER_PROPERTY,
|
||||
crawlForm.appendQueryParameter != null && Constants.ON.equalsIgnoreCase(crawlForm.appendQueryParameter) ? Constants.TRUE
|
||||
: Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.SUPPORTED_SEARCH_FEATURE_PROPERTY, crawlForm.supportedSearch);
|
||||
crawlerProperties.setProperty(Constants.IGNORE_FAILURE_TYPE_PROPERTY, crawlForm.ignoreFailureType);
|
||||
crawlerProperties.setProperty(Constants.FAILURE_COUNT_THRESHOLD_PROPERTY, crawlForm.failureCountThreshold);
|
||||
crawlerProperties.setProperty(Constants.WEB_API_HOT_SEARCH_WORD_PROPERTY,
|
||||
crawlForm.hotSearchWord != null && Constants.ON.equalsIgnoreCase(crawlForm.hotSearchWord) ? Constants.TRUE
|
||||
: Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.CSV_FILE_ENCODING_PROPERTY, crawlForm.csvFileEncoding);
|
||||
crawlerProperties.setProperty(Constants.PURGE_SEARCH_LOG_DAY_PROPERTY, crawlForm.purgeSearchLogDay);
|
||||
crawlerProperties.setProperty(Constants.PURGE_JOB_LOG_DAY_PROPERTY, crawlForm.purgeJobLogDay);
|
||||
crawlerProperties.setProperty(Constants.PURGE_USER_INFO_DAY_PROPERTY, crawlForm.purgeUserInfoDay);
|
||||
crawlerProperties.setProperty(Constants.PURGE_BY_BOTS_PROPERTY, crawlForm.purgeByBots);
|
||||
crawlerProperties.setProperty(Constants.NOTIFICATION_TO_PROPERTY, crawlForm.notificationTo);
|
||||
crawlerProperties.setProperty(Constants.SUGGEST_SEARCH_LOG_PROPERTY,
|
||||
crawlForm.suggestSearchLog != null && Constants.ON.equalsIgnoreCase(crawlForm.suggestSearchLog) ? Constants.TRUE
|
||||
: Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.PURGE_SUGGEST_SEARCH_LOG_DAY_PROPERTY, crawlForm.purgeSuggestSearchLogDay);
|
||||
try {
|
||||
crawlerProperties.store();
|
||||
SAStrutsUtil.addSessionMessage("success.update_crawler_params");
|
||||
return showIndex(true);
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to update crawler parameters.", e);
|
||||
throw new SSCActionMessagesException(e, "errors.failed_to_update_crawler_params", e);
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getDayItems() {
|
||||
final List<String> items = new ArrayList<String>();
|
||||
for (int i = 0; i < 32; i++) {
|
||||
items.add(Integer.valueOf(i).toString());
|
||||
}
|
||||
for (int i = 40; i < 370; i += 10) {
|
||||
items.add(Integer.valueOf(i).toString());
|
||||
}
|
||||
items.add(Integer.valueOf(365).toString());
|
||||
return items;
|
||||
}
|
||||
|
||||
public List<Map<String, String>> getSupportedSearchItems() {
|
||||
final List<Map<String, String>> list = new ArrayList<Map<String, String>>();
|
||||
list.add(createItem(MessageResourcesUtil.getMessage(LaRequestUtil.getRequest().getLocale(), "labels.supported_search_web"),
|
||||
Constants.SUPPORTED_SEARCH_WEB));
|
||||
list.add(createItem(MessageResourcesUtil.getMessage(LaRequestUtil.getRequest().getLocale(), "labels.supported_search_none"),
|
||||
Constants.SUPPORTED_SEARCH_NONE));
|
||||
return list;
|
||||
}
|
||||
|
||||
private Map<String, String> createItem(final String label, final String value) {
|
||||
final Map<String, String> map = new HashMap<String, String>();
|
||||
map.put(Constants.ITEM_LABEL, label);
|
||||
map.put(Constants.ITEM_VALUE, value);
|
||||
return map;
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,189 @@
|
|||
/*
|
||||
* Copyright 2009-2015 the CodeLibs Project and the Others.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package org.codelibs.fess.app.web.admin.crawl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.codelibs.fess.annotation.Token;
|
||||
import org.codelibs.fess.app.web.base.FessAdminAction;
|
||||
import org.codelibs.fess.crud.CommonConstants;
|
||||
import org.codelibs.fess.helper.SystemHelper;
|
||||
import org.lastaflute.web.Execute;
|
||||
import org.lastaflute.web.callback.ActionRuntime;
|
||||
import org.lastaflute.web.response.HtmlResponse;
|
||||
import org.lastaflute.web.response.render.RenderData;
|
||||
import org.lastaflute.web.validation.VaErrorHook;
|
||||
import org.codelibs.core.lang.StringUtil;
|
||||
import org.codelibs.core.misc.DynamicProperties;
|
||||
import org.codelibs.fess.Constants;
|
||||
import org.lastaflute.web.util.LaRequestUtil;
|
||||
|
||||
/**
|
||||
* @author shinsuke
|
||||
*/
|
||||
public class AdminCrawlAction extends FessAdminAction {
|
||||
|
||||
// ===================================================================================
|
||||
// Attribute
|
||||
// =========
|
||||
@Resource
|
||||
protected DynamicProperties crawlerProperties;
|
||||
@Resource
|
||||
protected SystemHelper systemHelper;
|
||||
|
||||
public String getHelpLink() {
|
||||
return systemHelper.getHelpLink("crawl");
|
||||
}
|
||||
|
||||
// ===================================================================================
|
||||
// Hook
|
||||
// ======
|
||||
@Override
|
||||
protected void setupHtmlData(final ActionRuntime runtime) {
|
||||
super.setupHtmlData(runtime);
|
||||
runtime.registerData("helpLink", systemHelper.getHelpLink("crawl"));
|
||||
}
|
||||
|
||||
// ===================================================================================
|
||||
|
||||
protected String showIndex(final boolean redirect, CrawlEditForm form) {
|
||||
form.diffCrawling = crawlerProperties.getProperty(Constants.DIFF_CRAWLING_PROPERTY, Constants.TRUE);
|
||||
form.useAclAsRole = crawlerProperties.getProperty(Constants.USE_ACL_AS_ROLE, Constants.FALSE);
|
||||
form.dayForCleanup = crawlerProperties.getProperty(Constants.DAY_FOR_CLEANUP_PROPERTY, "1");
|
||||
form.crawlingThreadCount = crawlerProperties.getProperty(Constants.CRAWLING_THREAD_COUNT_PROPERTY, "5");
|
||||
form.searchLog = crawlerProperties.getProperty(Constants.SEARCH_LOG_PROPERTY, Constants.TRUE);
|
||||
form.userInfo = crawlerProperties.getProperty(Constants.USER_INFO_PROPERTY, Constants.TRUE);
|
||||
form.userFavorite = crawlerProperties.getProperty(Constants.USER_FAVORITE_PROPERTY, Constants.FALSE);
|
||||
form.webApiXml = crawlerProperties.getProperty(Constants.WEB_API_XML_PROPERTY, Constants.TRUE);
|
||||
form.webApiJson = crawlerProperties.getProperty(Constants.WEB_API_JSON_PROPERTY, Constants.TRUE);
|
||||
form.defaultLabelValue = crawlerProperties.getProperty(Constants.DEFAULT_LABEL_VALUE_PROPERTY, StringUtil.EMPTY);
|
||||
form.appendQueryParameter = crawlerProperties.getProperty(Constants.APPEND_QUERY_PARAMETER_PROPERTY, Constants.FALSE);
|
||||
form.supportedSearch = crawlerProperties.getProperty(Constants.SUPPORTED_SEARCH_FEATURE_PROPERTY, Constants.SUPPORTED_SEARCH_WEB);
|
||||
form.ignoreFailureType =
|
||||
crawlerProperties.getProperty(Constants.IGNORE_FAILURE_TYPE_PROPERTY, Constants.DEFAULT_IGNORE_FAILURE_TYPE);
|
||||
form.failureCountThreshold =
|
||||
crawlerProperties.getProperty(Constants.FAILURE_COUNT_THRESHOLD_PROPERTY, Constants.DEFAULT_FAILURE_COUNT);
|
||||
form.hotSearchWord = crawlerProperties.getProperty(Constants.WEB_API_HOT_SEARCH_WORD_PROPERTY, Constants.TRUE);
|
||||
form.csvFileEncoding = crawlerProperties.getProperty(Constants.CSV_FILE_ENCODING_PROPERTY, Constants.UTF_8);
|
||||
form.purgeSearchLogDay = crawlerProperties.getProperty(Constants.PURGE_SEARCH_LOG_DAY_PROPERTY, Constants.DEFAULT_PURGE_DAY);
|
||||
form.purgeJobLogDay = crawlerProperties.getProperty(Constants.PURGE_JOB_LOG_DAY_PROPERTY, Constants.DEFAULT_PURGE_DAY);
|
||||
form.purgeUserInfoDay = crawlerProperties.getProperty(Constants.PURGE_USER_INFO_DAY_PROPERTY, Constants.DEFAULT_PURGE_DAY);
|
||||
form.purgeByBots = crawlerProperties.getProperty(Constants.PURGE_BY_BOTS_PROPERTY, Constants.DEFAULT_PURGE_BY_BOTS);
|
||||
form.notificationTo = crawlerProperties.getProperty(Constants.NOTIFICATION_TO_PROPERTY, StringUtil.EMPTY);
|
||||
form.suggestSearchLog = crawlerProperties.getProperty(Constants.SUGGEST_SEARCH_LOG_PROPERTY, Constants.TRUE);
|
||||
form.purgeSuggestSearchLogDay = crawlerProperties.getProperty(Constants.PURGE_SUGGEST_SEARCH_LOG_DAY_PROPERTY, "30");
|
||||
if (redirect) {
|
||||
return "index?redirect=true";
|
||||
} else {
|
||||
return "index.jsp";
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@Token(save = true, validate = false)
|
||||
@Execute
|
||||
public HtmlResponse index(final CrawlEditForm form) {
|
||||
return asHtml(path_AdminCrawl_IndexJsp).renderWith(data -> {
|
||||
showIndex(false, form);
|
||||
});
|
||||
}
|
||||
|
||||
@Token(save = false, validate = true)
|
||||
@Execute
|
||||
public HtmlResponse update(final CrawlEditForm form) {
|
||||
crawlerProperties.setProperty(Constants.DIFF_CRAWLING_PROPERTY,
|
||||
form.diffCrawling != null && Constants.ON.equalsIgnoreCase(form.diffCrawling) ? Constants.TRUE : Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.USE_ACL_AS_ROLE,
|
||||
form.useAclAsRole != null && Constants.ON.equalsIgnoreCase(form.useAclAsRole) ? Constants.TRUE : Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.DAY_FOR_CLEANUP_PROPERTY, form.dayForCleanup);
|
||||
crawlerProperties.setProperty(Constants.CRAWLING_THREAD_COUNT_PROPERTY, form.crawlingThreadCount);
|
||||
crawlerProperties.setProperty(Constants.SEARCH_LOG_PROPERTY,
|
||||
form.searchLog != null && Constants.ON.equalsIgnoreCase(form.searchLog) ? Constants.TRUE : Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.USER_INFO_PROPERTY,
|
||||
form.userInfo != null && Constants.ON.equalsIgnoreCase(form.userInfo) ? Constants.TRUE : Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.USER_FAVORITE_PROPERTY,
|
||||
form.userFavorite != null && Constants.ON.equalsIgnoreCase(form.userFavorite) ? Constants.TRUE : Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.WEB_API_XML_PROPERTY,
|
||||
form.webApiXml != null && Constants.ON.equalsIgnoreCase(form.webApiXml) ? Constants.TRUE : Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.WEB_API_JSON_PROPERTY,
|
||||
form.webApiJson != null && Constants.ON.equalsIgnoreCase(form.webApiJson) ? Constants.TRUE : Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.DEFAULT_LABEL_VALUE_PROPERTY, form.defaultLabelValue);
|
||||
crawlerProperties.setProperty(Constants.APPEND_QUERY_PARAMETER_PROPERTY,
|
||||
form.appendQueryParameter != null && Constants.ON.equalsIgnoreCase(form.appendQueryParameter) ? Constants.TRUE
|
||||
: Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.SUPPORTED_SEARCH_FEATURE_PROPERTY, form.supportedSearch);
|
||||
crawlerProperties.setProperty(Constants.IGNORE_FAILURE_TYPE_PROPERTY, form.ignoreFailureType);
|
||||
crawlerProperties.setProperty(Constants.FAILURE_COUNT_THRESHOLD_PROPERTY, form.failureCountThreshold);
|
||||
crawlerProperties.setProperty(Constants.WEB_API_HOT_SEARCH_WORD_PROPERTY,
|
||||
form.hotSearchWord != null && Constants.ON.equalsIgnoreCase(form.hotSearchWord) ? Constants.TRUE : Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.CSV_FILE_ENCODING_PROPERTY, form.csvFileEncoding);
|
||||
crawlerProperties.setProperty(Constants.PURGE_SEARCH_LOG_DAY_PROPERTY, form.purgeSearchLogDay);
|
||||
crawlerProperties.setProperty(Constants.PURGE_JOB_LOG_DAY_PROPERTY, form.purgeJobLogDay);
|
||||
crawlerProperties.setProperty(Constants.PURGE_USER_INFO_DAY_PROPERTY, form.purgeUserInfoDay);
|
||||
crawlerProperties.setProperty(Constants.PURGE_BY_BOTS_PROPERTY, form.purgeByBots);
|
||||
crawlerProperties.setProperty(Constants.NOTIFICATION_TO_PROPERTY, form.notificationTo);
|
||||
crawlerProperties.setProperty(Constants.SUGGEST_SEARCH_LOG_PROPERTY,
|
||||
form.suggestSearchLog != null && Constants.ON.equalsIgnoreCase(form.suggestSearchLog) ? Constants.TRUE : Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.PURGE_SUGGEST_SEARCH_LOG_DAY_PROPERTY, form.purgeSuggestSearchLogDay);
|
||||
// try {
|
||||
// crawlerProperties.store();
|
||||
// SAStrutsUtil.addSessionMessage("success.update_crawler_params");
|
||||
// return showIndex(true, form);
|
||||
// } catch (final Exception e) {
|
||||
// logger.error("Failed to update crawler parameters.", e);
|
||||
// throw new SSCActionMessagesException(e, "errors.failed_to_update_crawler_params", e);
|
||||
// }
|
||||
return asHtml(path_AdminCrawl_IndexJsp).renderWith(data -> {
|
||||
showIndex(false, form);
|
||||
});
|
||||
}
|
||||
|
||||
public List<String> getDayItems() {
|
||||
final List<String> items = new ArrayList<String>();
|
||||
for (int i = 0; i < 32; i++) {
|
||||
items.add(Integer.valueOf(i).toString());
|
||||
}
|
||||
for (int i = 40; i < 370; i += 10) {
|
||||
items.add(Integer.valueOf(i).toString());
|
||||
}
|
||||
items.add(Integer.valueOf(365).toString());
|
||||
return items;
|
||||
}
|
||||
|
||||
public List<Map<String, String>> getSupportedSearchItems() {
|
||||
final List<Map<String, String>> list = new ArrayList<Map<String, String>>();
|
||||
// list.add(createItem(MessageResourcesUtil.getMessage(LaRequestUtil.getRequest().getLocale(), "labels.supported_search_web"),
|
||||
// Constants.SUPPORTED_SEARCH_WEB));
|
||||
// list.add(createItem(MessageResourcesUtil.getMessage(LaRequestUtil.getRequest().getLocale(), "labels.supported_search_none"),
|
||||
// Constants.SUPPORTED_SEARCH_NONE));
|
||||
return list;
|
||||
}
|
||||
|
||||
private Map<String, String> createItem(final String label, final String value) {
|
||||
final Map<String, String> map = new HashMap<String, String>();
|
||||
map.put(Constants.ITEM_LABEL, label);
|
||||
map.put(Constants.ITEM_VALUE, value);
|
||||
return map;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -14,11 +14,15 @@
|
|||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package org.codelibs.fess.app.web.admin;
|
||||
package org.codelibs.fess.app.web.admin.crawl;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class CrawlForm implements Serializable {
|
||||
/**
|
||||
* @author codelibs
|
||||
* @author jflute
|
||||
*/
|
||||
public class CrawlEditForm implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright 2009-2015 the CodeLibs Project and the Others.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package org.codelibs.fess.app.web.admin.crawl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author codelibs
|
||||
* @author jflute
|
||||
*/
|
||||
public class CrawlSearchForm implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Map<String, String> searchParams = new HashMap<String, String>();
|
||||
}
|
|
@ -32,10 +32,10 @@
|
|||
<span><la:message key="labels.menu.wizard" /></span>
|
||||
</todo:link></li>
|
||||
|
||||
<li <c:if test="${param.menuType=='crawl'}">class="active"</c:if>><todo:link href="/admin/crawl/index">
|
||||
<li <c:if test="${param.menuType=='crawl'}">class="active"</c:if>><la:link href="/admin/crawl/index">
|
||||
<i class='fa fa-angle-right'></i>
|
||||
<span><la:message key="labels.menu.crawl_config" /></span>
|
||||
</todo:link></li>
|
||||
</la:link></li>
|
||||
|
||||
<li <c:if test="${param.menuType=='system'}">class="active"</c:if>><todo:link href="/admin/system/index">
|
||||
<i class='fa fa-angle-right'></i>
|
||||
|
|
Loading…
Add table
Reference in a new issue