merge from 10.0.2

This commit is contained in:
Shinsuke Sugaya 2016-03-06 18:35:55 +09:00
commit 35dc2adb75
68 changed files with 2496 additions and 1124 deletions

View file

@ -24,8 +24,8 @@
<param name="repo.url" value="${maven.release.repo.url}" />
<param name="plugin.groupId" value="org/codelibs" />
<param name="plugin.name" value="analysis-ja" />
<param name="plugin.version" value="2.1.1" />
<param name="plugin.zip.version" value="2.1.1" />
<param name="plugin.version" value="2.1.2" />
<param name="plugin.zip.version" value="2.1.2" />
</antcall>
<!-- analysis-synonym -->
<antcall target="install.plugin">
@ -56,8 +56,8 @@
<param name="repo.url" value="${maven.release.repo.url}" />
<param name="plugin.groupId" value="org/codelibs" />
<param name="plugin.name" value="langfield" />
<param name="plugin.version" value="2.1.2" />
<param name="plugin.zip.version" value="2.1.2" />
<param name="plugin.version" value="2.1.3" />
<param name="plugin.zip.version" value="2.1.3" />
</antcall>
<!-- kopf -->
<get dest="${target.dir}">

View file

@ -59,7 +59,7 @@
<utflute.version>0.6.0F</utflute.version>
<!-- Crawler -->
<crawler.version>1.0.5</crawler.version>
<crawler.version>1.0.6</crawler.version>
<!-- Suggest -->
<suggest.version>2.1.1</suggest.version>

View file

@ -111,6 +111,8 @@ public class Constants extends CoreLibConstants {
public static final String DEFAULT_LABEL_VALUE_PROPERTY = "label.value";
public static final String DEFAULT_SORT_VALUE_PROPERTY = "sort.value";
public static final String LOGIN_REQUIRED_PROPERTY = "login.required";
public static final String IGNORE_FAILURE_TYPE_PROPERTY = "failure.ignoretype";
@ -372,4 +374,6 @@ public class Constants extends CoreLibConstants {
public static final String MAPPING_TYPE_DOUBLE = "double";
public static final String PAGING_QUERY_LIST = "pagingQueryList";
public static final String REQUEST_LANGUAGES = "requestLanguages";
}

View file

@ -67,6 +67,9 @@ public class CrawlingInfoService implements Serializable {
@Resource
protected CrawlingInfoBhv crawlingInfoBhv;
@Resource
protected FessConfig fessConfig;
public List<CrawlingInfo> getCrawlingInfoList(final CrawlingInfoPager crawlingInfoPager) {
final PagingResultBean<CrawlingInfo> crawlingInfoList = crawlingInfoBhv.selectPage(cb -> {
@ -145,6 +148,7 @@ public class CrawlingInfoService implements Serializable {
});
cb.fetchFirst(fessConfig.getPageCrawlingInfoMaxFetchSizeAsInteger());
cb.specify().columnId();
});
if (!crawlingInfoList.isEmpty()) {
@ -189,6 +193,7 @@ public class CrawlingInfoService implements Serializable {
return crawlingInfoParamBhv.selectList(cb -> {
cb.query().setCrawlingInfoId_Equal(id);
cb.query().addOrderBy_Id_Asc();
cb.fetchFirst(fessConfig.getPageCrawlingInfoParamMaxFetchSizeAsInteger());
});
}
@ -209,6 +214,7 @@ public class CrawlingInfoService implements Serializable {
final List<CrawlingInfo> activeSessionList =
activeSessionId.isEmpty() ? Collections.emptyList() : crawlingInfoBhv.selectList(cb -> {
cb.query().setSessionId_InScope(activeSessionId);
cb.fetchFirst(fessConfig.getPageCrawlingInfoMaxFetchSizeAsInteger());
cb.specify().columnId();
});
final List<String> idList = activeSessionList.stream().map(session -> session.getId()).collect(Collectors.toList());

View file

@ -31,6 +31,7 @@ import org.codelibs.fess.es.config.exbhv.DataConfigToRoleBhv;
import org.codelibs.fess.es.config.exentity.DataConfig;
import org.codelibs.fess.es.config.exentity.DataConfigToLabel;
import org.codelibs.fess.es.config.exentity.DataConfigToRole;
import org.codelibs.fess.mylasta.direction.FessConfig;
import org.dbflute.cbean.result.PagingResultBean;
import org.dbflute.optional.OptionalEntity;
@ -47,6 +48,9 @@ public class DataConfigService implements Serializable {
@Resource
protected DataConfigBhv dataConfigBhv;
@Resource
protected FessConfig fessConfig;
public List<DataConfig> getDataConfigList(final DataConfigPager dataConfigPager) {
final PagingResultBean<DataConfig> dataConfigList = dataConfigBhv.selectPage(cb -> {
@ -66,10 +70,20 @@ public class DataConfigService implements Serializable {
public void delete(final DataConfig dataConfig) {
final String dataConfigId = dataConfig.getId();
dataConfigBhv.delete(dataConfig, op -> {
op.setRefresh(true);
});
dataConfigToLabelBhv.queryDelete(cb -> {
cb.query().setDataConfigId_Equal(dataConfigId);
});
dataConfigToRoleBhv.queryDelete(cb -> {
cb.query().setDataConfigId_Equal(dataConfigId);
});
}
public List<DataConfig> getAllDataConfigList() {
@ -93,6 +107,7 @@ public class DataConfigService implements Serializable {
if (idList != null) {
cb.query().setId_InScope(idList);
}
cb.fetchFirst(fessConfig.getPageDataConfigMaxFetchSizeAsInteger());
});
return list;
}
@ -102,6 +117,7 @@ public class DataConfigService implements Serializable {
final List<DataConfigToRole> fctrtmList = dataConfigToRoleBhv.selectList(fctrtmCb -> {
fctrtmCb.query().setDataConfigId_Equal(entity.getId());
fctrtmCb.fetchFirst(fessConfig.getPageRoletypeMaxFetchSizeAsInteger());
});
if (!fctrtmList.isEmpty()) {
final List<String> roleTypeIds = new ArrayList<String>(fctrtmList.size());
@ -113,6 +129,7 @@ public class DataConfigService implements Serializable {
final List<DataConfigToLabel> fctltmList = dataConfigToLabelBhv.selectList(fctltmCb -> {
fctltmCb.query().setDataConfigId_Equal(entity.getId());
fctltmCb.fetchFirst(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger());
});
if (!fctltmList.isEmpty()) {
final List<String> labelTypeIds = new ArrayList<String>(fctltmList.size());
@ -166,6 +183,7 @@ public class DataConfigService implements Serializable {
if (labelTypeIds != null) {
final List<DataConfigToLabel> fctltmList = dataConfigToLabelBhv.selectList(fctltmCb -> {
fctltmCb.query().setDataConfigId_Equal(dataConfigId);
fctltmCb.fetchFirst(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger());
});
final List<DataConfigToLabel> newList = new ArrayList<DataConfigToLabel>();
final List<DataConfigToLabel> matchedList = new ArrayList<DataConfigToLabel>();
@ -197,6 +215,7 @@ public class DataConfigService implements Serializable {
if (roleTypeIds != null) {
final List<DataConfigToRole> fctrtmList = dataConfigToRoleBhv.selectList(fctrtmCb -> {
fctrtmCb.query().setDataConfigId_Equal(dataConfigId);
fctrtmCb.fetchFirst(fessConfig.getPageRoletypeMaxFetchSizeAsInteger());
});
final List<DataConfigToRole> newList = new ArrayList<DataConfigToRole>();
final List<DataConfigToRole> matchedList = new ArrayList<DataConfigToRole>();

View file

@ -26,6 +26,7 @@ import org.codelibs.fess.app.pager.DuplicateHostPager;
import org.codelibs.fess.es.config.cbean.DuplicateHostCB;
import org.codelibs.fess.es.config.exbhv.DuplicateHostBhv;
import org.codelibs.fess.es.config.exentity.DuplicateHost;
import org.codelibs.fess.mylasta.direction.FessConfig;
import org.dbflute.cbean.result.PagingResultBean;
import org.dbflute.optional.OptionalEntity;
@ -36,6 +37,9 @@ public class DuplicateHostService implements Serializable {
@Resource
protected DuplicateHostBhv duplicateHostBhv;
@Resource
protected FessConfig fessConfig;
public List<DuplicateHost> getDuplicateHostList(final DuplicateHostPager duplicateHostPager) {
final PagingResultBean<DuplicateHost> duplicateHostList = duplicateHostBhv.selectPage(cb -> {
@ -78,6 +82,7 @@ public class DuplicateHostService implements Serializable {
cb.query().addOrderBy_SortOrder_Asc();
cb.query().addOrderBy_RegularName_Asc();
cb.query().addOrderBy_DuplicateHostName_Asc();
cb.fetchFirst(fessConfig.getPageDuplicateHostMaxFetchSizeAsInteger());
});
}

View file

@ -33,6 +33,7 @@ import org.codelibs.fess.es.config.exbhv.ElevateWordBhv;
import org.codelibs.fess.es.config.exbhv.ElevateWordToLabelBhv;
import org.codelibs.fess.es.config.exentity.ElevateWord;
import org.codelibs.fess.es.config.exentity.ElevateWordToLabel;
import org.codelibs.fess.mylasta.direction.FessConfig;
import org.codelibs.fess.util.ComponentUtil;
import org.dbflute.bhv.readable.EntityRowHandler;
import org.dbflute.cbean.result.PagingResultBean;
@ -56,6 +57,9 @@ public class ElevateWordService implements Serializable {
@Resource
protected ElevateWordBhv elevateWordBhv;
@Resource
protected FessConfig fessConfig;
public List<ElevateWord> getElevateWordList(final ElevateWordPager elevateWordPager) {
final PagingResultBean<ElevateWord> elevateWordList = elevateWordBhv.selectPage(cb -> {
@ -77,6 +81,7 @@ public class ElevateWordService implements Serializable {
final List<ElevateWordToLabel> wctltmList = elevateWordToLabelBhv.selectList(wctltmCb -> {
wctltmCb.query().setElevateWordId_Equal(entity.getId());
wctltmCb.fetchFirst(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger());
});
if (!wctltmList.isEmpty()) {
final List<String> labelTypeIds = new ArrayList<String>(wctltmList.size());
@ -116,6 +121,7 @@ public class ElevateWordService implements Serializable {
if (labelTypeIds != null) {
final List<ElevateWordToLabel> list = elevateWordToLabelBhv.selectList(wctltmCb -> {
wctltmCb.query().setElevateWordId_Equal(elevateWordId);
wctltmCb.fetchFirst(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger());
});
final List<ElevateWordToLabel> newList = new ArrayList<ElevateWordToLabel>();
final List<ElevateWordToLabel> matchedList = new ArrayList<ElevateWordToLabel>();

View file

@ -36,6 +36,7 @@ import org.codelibs.fess.es.config.exbhv.FailureUrlBhv;
import org.codelibs.fess.es.config.exentity.CrawlingConfig;
import org.codelibs.fess.es.config.exentity.FailureUrl;
import org.codelibs.fess.helper.SystemHelper;
import org.codelibs.fess.mylasta.direction.FessConfig;
import org.codelibs.fess.util.ComponentUtil;
import org.dbflute.cbean.result.ListResultBean;
import org.dbflute.cbean.result.PagingResultBean;
@ -52,6 +53,9 @@ public class FailureUrlService implements Serializable {
@Resource
protected FailureUrlBhv failureUrlBhv;
@Resource
protected FessConfig fessConfig;
public List<FailureUrl> getFailureUrlList(final FailureUrlPager failureUrlPager) {
final PagingResultBean<FailureUrl> failureUrlList = failureUrlBhv.selectPage(cb -> {
@ -146,6 +150,7 @@ public class FailureUrlService implements Serializable {
final ListResultBean<FailureUrl> list = failureUrlBhv.selectList(cb -> {
cb.query().setConfigId_Equal(configId);
cb.query().setErrorCount_GreaterEqual(count);
cb.fetchFirst(fessConfig.getPageFailureUrlMaxFetchSizeAsInteger());
});
if (list.isEmpty()) {
return Collections.emptyList();

View file

@ -27,6 +27,7 @@ import org.codelibs.fess.es.log.exbhv.UserInfoBhv;
import org.codelibs.fess.es.log.exentity.FavoriteLog;
import org.codelibs.fess.es.log.exentity.UserInfo;
import org.codelibs.fess.helper.SystemHelper;
import org.codelibs.fess.mylasta.direction.FessConfig;
import org.dbflute.cbean.result.ListResultBean;
public class FavoriteLogService {
@ -39,6 +40,9 @@ public class FavoriteLogService {
@Resource
protected FavoriteLogBhv favoriteLogBhv;
@Resource
protected FessConfig fessConfig;
public boolean addUrl(final String userCode, final BiConsumer<UserInfo, FavoriteLog> favoriteLogLambda) {
return userInfoBhv.selectByPK(userCode).map(userInfo -> {
final FavoriteLog favoriteLog = new FavoriteLog();
@ -57,6 +61,7 @@ public class FavoriteLogService {
final ListResultBean<FavoriteLog> list = favoriteLogBhv.selectList(cb2 -> {
cb2.query().setUserInfoId_Equal(userInfo.getId());
cb2.query().setUrl_InScope(urlList);
cb2.fetchFirst(fessConfig.getPageFavoriteLogMaxFetchSizeAsInteger());
});
if (!list.isEmpty()) {
final List<String> newUrlList = new ArrayList<>(list.size());

View file

@ -26,6 +26,7 @@ import org.codelibs.fess.app.pager.FileAuthPager;
import org.codelibs.fess.es.config.cbean.FileAuthenticationCB;
import org.codelibs.fess.es.config.exbhv.FileAuthenticationBhv;
import org.codelibs.fess.es.config.exentity.FileAuthentication;
import org.codelibs.fess.mylasta.direction.FessConfig;
import org.dbflute.cbean.result.PagingResultBean;
import org.dbflute.optional.OptionalEntity;
@ -36,6 +37,9 @@ public class FileAuthenticationService implements Serializable {
@Resource
protected FileAuthenticationBhv fileAuthenticationBhv;
@Resource
protected FessConfig fessConfig;
public List<FileAuthentication> getFileAuthenticationList(final FileAuthPager fileAuthenticationPager) {
final PagingResultBean<FileAuthentication> fileAuthenticationList = fileAuthenticationBhv.selectPage(cb -> {
@ -88,6 +92,7 @@ public class FileAuthenticationService implements Serializable {
public List<FileAuthentication> getFileAuthenticationList(final String fileConfigId) {
return fileAuthenticationBhv.selectList(cb -> {
cb.query().setFileConfigId_Equal(fileConfigId);
cb.fetchFirst(fessConfig.getPageFileAuthMaxFetchSizeAsInteger());
});
}
}

View file

@ -25,12 +25,14 @@ import org.codelibs.core.beans.util.BeanUtil;
import org.codelibs.fess.Constants;
import org.codelibs.fess.app.pager.FileConfigPager;
import org.codelibs.fess.es.config.cbean.FileConfigCB;
import org.codelibs.fess.es.config.exbhv.FileAuthenticationBhv;
import org.codelibs.fess.es.config.exbhv.FileConfigBhv;
import org.codelibs.fess.es.config.exbhv.FileConfigToLabelBhv;
import org.codelibs.fess.es.config.exbhv.FileConfigToRoleBhv;
import org.codelibs.fess.es.config.exentity.FileConfig;
import org.codelibs.fess.es.config.exentity.FileConfigToLabel;
import org.codelibs.fess.es.config.exentity.FileConfigToRole;
import org.codelibs.fess.mylasta.direction.FessConfig;
import org.dbflute.cbean.result.PagingResultBean;
import org.dbflute.optional.OptionalEntity;
@ -47,6 +49,12 @@ public class FileConfigService implements Serializable {
@Resource
protected FileConfigBhv fileConfigBhv;
@Resource
protected FileAuthenticationBhv fileAuthenticationBhv;
@Resource
protected FessConfig fessConfig;
public List<FileConfig> getFileConfigList(final FileConfigPager fileConfigPager) {
final PagingResultBean<FileConfig> fileConfigList = fileConfigBhv.selectPage(cb -> {
@ -65,10 +73,23 @@ public class FileConfigService implements Serializable {
public void delete(final FileConfig fileConfig) {
final String fileConfigId = fileConfig.getId();
fileConfigBhv.delete(fileConfig, op -> {
op.setRefresh(true);
});
fileConfigToLabelBhv.queryDelete(cb -> {
cb.query().setFileConfigId_Equal(fileConfigId);
});
fileConfigToRoleBhv.queryDelete(cb -> {
cb.query().setFileConfigId_Equal(fileConfigId);
});
fileAuthenticationBhv.queryDelete(cb -> {
cb.query().setFileConfigId_Equal(fileConfigId);
});
}
public List<FileConfig> getAllFileConfigList() {
@ -92,6 +113,7 @@ public class FileConfigService implements Serializable {
if (idList != null) {
cb.query().setId_InScope(idList);
}
cb.fetchFirst(fessConfig.getPageFileConfigMaxFetchSizeAsInteger());
});
return list;
}
@ -101,6 +123,7 @@ public class FileConfigService implements Serializable {
final List<FileConfigToRole> fctrtmList = fileConfigToRoleBhv.selectList(fctrtmCb -> {
fctrtmCb.query().setFileConfigId_Equal(entity.getId());
fctrtmCb.fetchFirst(fessConfig.getPageRoletypeMaxFetchSizeAsInteger());
});
if (!fctrtmList.isEmpty()) {
final List<String> roleTypeIds = new ArrayList<String>(fctrtmList.size());
@ -112,6 +135,7 @@ public class FileConfigService implements Serializable {
final List<FileConfigToLabel> fctltmList = fileConfigToLabelBhv.selectList(fctltmCb -> {
fctltmCb.query().setFileConfigId_Equal(entity.getId());
fctltmCb.fetchFirst(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger());
});
if (!fctltmList.isEmpty()) {
final List<String> labelTypeIds = new ArrayList<String>(fctltmList.size());
@ -164,6 +188,7 @@ public class FileConfigService implements Serializable {
if (labelTypeIds != null) {
final List<FileConfigToLabel> fctltmList = fileConfigToLabelBhv.selectList(fctltmCb -> {
fctltmCb.query().setFileConfigId_Equal(fileConfigId);
fctltmCb.fetchFirst(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger());
});
final List<FileConfigToLabel> newList = new ArrayList<FileConfigToLabel>();
final List<FileConfigToLabel> matchedList = new ArrayList<FileConfigToLabel>();
@ -195,6 +220,7 @@ public class FileConfigService implements Serializable {
if (roleTypeIds != null) {
final List<FileConfigToRole> fctrtmList = fileConfigToRoleBhv.selectList(fctrtmCb -> {
fctrtmCb.query().setFileConfigId_Equal(fileConfigId);
fctrtmCb.fetchFirst(fessConfig.getPageRoletypeMaxFetchSizeAsInteger());
});
final List<FileConfigToRole> newList = new ArrayList<FileConfigToRole>();
final List<FileConfigToRole> matchedList = new ArrayList<FileConfigToRole>();

View file

@ -134,6 +134,7 @@ public class LabelTypeService implements Serializable {
if (roleTypeIds != null) {
final List<LabelToRole> list = labelToRoleBhv.selectList(lttrtmCb -> {
lttrtmCb.query().setLabelTypeId_Equal(labelTypeId);
lttrtmCb.fetchFirst(fessConfig.getPageRoletypeMaxFetchSizeAsInteger());
});
final List<LabelToRole> newList = new ArrayList<LabelToRole>();
final List<LabelToRole> matchedList = new ArrayList<LabelToRole>();
@ -174,6 +175,7 @@ public class LabelTypeService implements Serializable {
return labelTypeBhv.selectByPK(id).map(entity -> {
final List<LabelToRole> wctrtmList = labelToRoleBhv.selectList(wctrtmCb -> {
wctrtmCb.query().setLabelTypeId_Equal(entity.getId());
wctrtmCb.fetchFirst(fessConfig.getPageRoletypeMaxFetchSizeAsInteger());
});
if (!wctrtmList.isEmpty()) {
final List<String> roleTypeIds = new ArrayList<String>(wctrtmList.size());

View file

@ -27,6 +27,7 @@ import org.codelibs.fess.app.pager.PathMapPager;
import org.codelibs.fess.es.config.cbean.PathMappingCB;
import org.codelibs.fess.es.config.exbhv.PathMappingBhv;
import org.codelibs.fess.es.config.exentity.PathMapping;
import org.codelibs.fess.mylasta.direction.FessConfig;
import org.codelibs.fess.util.ComponentUtil;
import org.dbflute.cbean.result.PagingResultBean;
import org.dbflute.optional.OptionalEntity;
@ -38,6 +39,9 @@ public class PathMappingService implements Serializable {
@Resource
protected PathMappingBhv pathMappingBhv;
@Resource
protected FessConfig fessConfig;
public List<PathMapping> getPathMappingList(final PathMapPager pathMappingPager) {
final PagingResultBean<PathMapping> pathMappingList = pathMappingBhv.selectPage(cb -> {
@ -81,6 +85,7 @@ public class PathMappingService implements Serializable {
return pathMappingBhv.selectList(cb -> {
cb.query().addOrderBy_SortOrder_Asc();
cb.query().setProcessType_InScope(processTypeList);
cb.fetchFirst(fessConfig.getPagePathMappingMaxFetchSizeAsInteger());
});
}

View file

@ -26,6 +26,7 @@ import org.codelibs.fess.app.pager.ReqHeaderPager;
import org.codelibs.fess.es.config.cbean.RequestHeaderCB;
import org.codelibs.fess.es.config.exbhv.RequestHeaderBhv;
import org.codelibs.fess.es.config.exentity.RequestHeader;
import org.codelibs.fess.mylasta.direction.FessConfig;
import org.dbflute.cbean.result.PagingResultBean;
import org.dbflute.optional.OptionalEntity;
@ -36,6 +37,9 @@ public class RequestHeaderService implements Serializable {
@Resource
protected RequestHeaderBhv requestHeaderBhv;
@Resource
protected FessConfig fessConfig;
public List<RequestHeader> getRequestHeaderList(final ReqHeaderPager requestHeaderPager) {
final PagingResultBean<RequestHeader> requestHeaderList = requestHeaderBhv.selectPage(cb -> {
@ -88,6 +92,7 @@ public class RequestHeaderService implements Serializable {
public List<RequestHeader> getRequestHeaderList(final String webConfigId) {
return requestHeaderBhv.selectList(cb -> {
cb.query().setWebConfigId_Equal(webConfigId);
cb.fetchFirst(fessConfig.getPageRequestHeaderMaxFetchSizeAsInteger());
});
}

View file

@ -101,6 +101,7 @@ public class ScheduledJobService implements Serializable {
return scheduledJobBhv.selectList(cb -> {
cb.query().addOrderBy_SortOrder_Asc();
cb.query().addOrderBy_Name_Asc();
cb.fetchFirst(fessConfig.getPageScheduledJobMaxFetchSizeAsInteger());
});
}
@ -118,6 +119,7 @@ public class ScheduledJobService implements Serializable {
cb.query().setCrawler_Equal(Constants.T);
cb.query().addOrderBy_SortOrder_Asc();
cb.query().addOrderBy_Name_Asc();
cb.fetchFirst(fessConfig.getPageScheduledJobMaxFetchSizeAsInteger());
});
}

View file

@ -51,9 +51,7 @@ import org.elasticsearch.action.bulk.BulkResponse;
import org.elasticsearch.action.update.UpdateRequestBuilder;
import org.elasticsearch.action.update.UpdateResponse;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.sort.SortBuilder;
import org.elasticsearch.search.sort.SortBuilders;
import org.elasticsearch.search.sort.SortOrder;
import org.lastaflute.taglib.function.LaFunctions;
public class SearchService {
@ -100,18 +98,9 @@ public class SearchService {
fessConfig.getIndexDocumentSearchIndex(),
fessConfig.getIndexDocumentType(),
searchRequestBuilder -> {
if (StringUtil.isNotBlank(sortField)) {
final String[] sort = sortField.split("\\.");
final SortBuilder sortBuilder = SortBuilders.fieldSort(sort[0]);
if ("asc".equals(sort[1])) {
sortBuilder.order(SortOrder.ASC);
} else if ("desc".equals(sort[1])) {
sortBuilder.order(SortOrder.DESC);
}
searchRequestBuilder.addSort(sortBuilder);
}
return SearchConditionBuilder.builder(searchRequestBuilder).query(query).offset(pageStart).size(pageSize)
.facetInfo(params.getFacetInfo()).geoInfo(params.getGeoInfo())
return SearchConditionBuilder.builder(searchRequestBuilder)
.query(StringUtil.isBlank(sortField) ? query : query + " sort:" + sortField).offset(pageStart)
.size(pageSize).facetInfo(params.getFacetInfo()).geoInfo(params.getGeoInfo())
.responseFields(queryHelper.getResponseFields()).administrativeAccess(params.isAdministrativeAccess())
.build();
}, (searchRequestBuilder, execTime, searchResponse) -> {
@ -130,7 +119,7 @@ public class SearchService {
if (highlightQueries != null) {
final StringBuilder buf = new StringBuilder(100);
highlightQueries.stream().forEach(q -> {
buf.append("&hq=").append(q);
buf.append("&hq=").append(LaFunctions.u(q));
});
data.setAppendHighlightParams(buf.toString());
}
@ -249,7 +238,7 @@ public class SearchService {
final UpdateRequestBuilder builder =
fessEsClient.prepareUpdate(fessConfig.getIndexDocumentUpdateIndex(), fessConfig.getIndexDocumentType(), id);
builderLambda.accept(builder);
final UpdateResponse response = builder.execute().actionGet();
final UpdateResponse response = builder.execute().actionGet(fessConfig.getIndexIndexTimeout());
return response.isCreated();
} catch (final ElasticsearchException e) {
throw new FessEsClientException("Failed to update doc " + id, e);

View file

@ -43,6 +43,9 @@ public class UserService implements Serializable {
@Resource
protected FessLoginAssist fessLoginAssist;
@Resource
protected FessConfig fessConfig;
public List<User> getUserList(final UserPager userPager) {
final PagingResultBean<User> userList = userBhv.selectPage(cb -> {
@ -113,6 +116,7 @@ public class UserService implements Serializable {
public List<User> getAvailableUserList() {
return userBhv.selectList(cb -> {
cb.query().matchAll();
cb.fetchFirst(fessConfig.getPageUserMaxFetchSizeAsInteger());
});
}

View file

@ -26,6 +26,7 @@ import org.codelibs.fess.app.pager.WebAuthPager;
import org.codelibs.fess.es.config.cbean.WebAuthenticationCB;
import org.codelibs.fess.es.config.exbhv.WebAuthenticationBhv;
import org.codelibs.fess.es.config.exentity.WebAuthentication;
import org.codelibs.fess.mylasta.direction.FessConfig;
import org.dbflute.cbean.result.PagingResultBean;
import org.dbflute.optional.OptionalEntity;
@ -36,6 +37,9 @@ public class WebAuthenticationService implements Serializable {
@Resource
protected WebAuthenticationBhv webAuthenticationBhv;
@Resource
protected FessConfig fessConfig;
public List<WebAuthentication> getWebAuthenticationList(final WebAuthPager webAuthenticationPager) {
final PagingResultBean<WebAuthentication> webAuthenticationList = webAuthenticationBhv.selectPage(cb -> {
@ -88,6 +92,7 @@ public class WebAuthenticationService implements Serializable {
public List<WebAuthentication> getWebAuthenticationList(final String webConfigId) {
return webAuthenticationBhv.selectList(cb -> {
cb.query().setWebConfigId_Equal(webConfigId);
cb.fetchFirst(fessConfig.getPageWebAuthMaxFetchSizeAsInteger());
});
}

View file

@ -25,12 +25,15 @@ import org.codelibs.core.beans.util.BeanUtil;
import org.codelibs.fess.Constants;
import org.codelibs.fess.app.pager.WebConfigPager;
import org.codelibs.fess.es.config.cbean.WebConfigCB;
import org.codelibs.fess.es.config.exbhv.RequestHeaderBhv;
import org.codelibs.fess.es.config.exbhv.WebAuthenticationBhv;
import org.codelibs.fess.es.config.exbhv.WebConfigBhv;
import org.codelibs.fess.es.config.exbhv.WebConfigToLabelBhv;
import org.codelibs.fess.es.config.exbhv.WebConfigToRoleBhv;
import org.codelibs.fess.es.config.exentity.WebConfig;
import org.codelibs.fess.es.config.exentity.WebConfigToLabel;
import org.codelibs.fess.es.config.exentity.WebConfigToRole;
import org.codelibs.fess.mylasta.direction.FessConfig;
import org.dbflute.cbean.result.PagingResultBean;
import org.dbflute.optional.OptionalEntity;
@ -47,6 +50,15 @@ public class WebConfigService implements Serializable {
@Resource
protected WebConfigBhv webConfigBhv;
@Resource
protected WebAuthenticationBhv webAuthenticationBhv;
@Resource
protected RequestHeaderBhv requestHeaderBhv;
@Resource
protected FessConfig fessConfig;
public List<WebConfig> getWebConfigList(final WebConfigPager webConfigPager) {
final PagingResultBean<WebConfig> webConfigList = webConfigBhv.selectPage(cb -> {
@ -65,10 +77,27 @@ public class WebConfigService implements Serializable {
public void delete(final WebConfig webConfig) {
final String webConfigId = webConfig.getId();
webConfigBhv.delete(webConfig, op -> {
op.setRefresh(true);
});
webConfigToLabelBhv.queryDelete(cb -> {
cb.query().setWebConfigId_Equal(webConfigId);
});
webConfigToRoleBhv.queryDelete(cb -> {
cb.query().setWebConfigId_Equal(webConfigId);
});
webAuthenticationBhv.queryDelete(cb -> {
cb.query().setWebConfigId_Equal(webConfigId);
});
requestHeaderBhv.queryDelete(cb -> {
cb.query().setWebConfigId_Equal(webConfigId);
});
}
public List<WebConfig> getAllWebConfigList() {
@ -92,6 +121,7 @@ public class WebConfigService implements Serializable {
if (idList != null) {
cb.query().setId_InScope(idList);
}
cb.fetchFirst(fessConfig.getPageWebConfigMaxFetchSizeAsInteger());
});
return list;
@ -102,6 +132,7 @@ public class WebConfigService implements Serializable {
final List<WebConfigToRole> wctrtmList = webConfigToRoleBhv.selectList(wctrtmCb -> {
wctrtmCb.query().setWebConfigId_Equal(entity.getId());
wctrtmCb.fetchFirst(fessConfig.getPageRoletypeMaxFetchSizeAsInteger());
});
if (!wctrtmList.isEmpty()) {
final List<String> roleTypeIds = new ArrayList<String>(wctrtmList.size());
@ -113,6 +144,7 @@ public class WebConfigService implements Serializable {
final List<WebConfigToLabel> wctltmList = webConfigToLabelBhv.selectList(wctltmCb -> {
wctltmCb.query().setWebConfigId_Equal(entity.getId());
wctltmCb.fetchFirst(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger());
});
if (!wctltmList.isEmpty()) {
final List<String> labelTypeIds = new ArrayList<String>(wctltmList.size());
@ -165,6 +197,7 @@ public class WebConfigService implements Serializable {
if (labelTypeIds != null) {
final List<WebConfigToLabel> list = webConfigToLabelBhv.selectList(wctltmCb -> {
wctltmCb.query().setWebConfigId_Equal(webConfigId);
wctltmCb.fetchFirst(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger());
});
final List<WebConfigToLabel> newList = new ArrayList<WebConfigToLabel>();
final List<WebConfigToLabel> matchedList = new ArrayList<WebConfigToLabel>();
@ -196,6 +229,7 @@ public class WebConfigService implements Serializable {
if (roleTypeIds != null) {
final List<WebConfigToRole> list = webConfigToRoleBhv.selectList(wctrtmCb -> {
wctrtmCb.query().setWebConfigId_Equal(webConfigId);
wctrtmCb.fetchFirst(fessConfig.getPageRoletypeMaxFetchSizeAsInteger());
});
final List<WebConfigToRole> newList = new ArrayList<WebConfigToRole>();
final List<WebConfigToRole> matchedList = new ArrayList<WebConfigToRole>();

View file

@ -44,7 +44,7 @@ public class RootAction extends FessSearchAction {
return asHtml(path_IndexJsp).useForm(SearchForm.class, op -> {
op.setup(form -> {
buildLabelParams(form.fields);
buildFormParams(form);
});
}).renderWith(
data -> {

View file

@ -117,33 +117,34 @@ public class AdminGeneralAction extends FessAdminAction {
});
fessConfig.setLoginRequired(Constants.ON.equalsIgnoreCase(form.loginRequired));
updateProperty(Constants.INCREMENTAL_CRAWLING_PROPERTY, getCheckboxValue(form.incrementalCrawling));
updateProperty(Constants.DAY_FOR_CLEANUP_PROPERTY, form.dayForCleanup.toString());
updateProperty(Constants.CRAWLING_THREAD_COUNT_PROPERTY, form.crawlingThreadCount.toString());
updateProperty(Constants.SEARCH_LOG_PROPERTY, getCheckboxValue(form.searchLog));
updateProperty(Constants.USER_INFO_PROPERTY, getCheckboxValue(form.userInfo));
updateProperty(Constants.USER_FAVORITE_PROPERTY, getCheckboxValue(form.userFavorite));
updateProperty(Constants.WEB_API_JSON_PROPERTY, getCheckboxValue(form.webApiJson));
updateProperty(Constants.DEFAULT_LABEL_VALUE_PROPERTY, form.defaultLabelValue);
updateProperty(Constants.APPEND_QUERY_PARAMETER_PROPERTY, getCheckboxValue(form.appendQueryParameter));
updateProperty(Constants.IGNORE_FAILURE_TYPE_PROPERTY, form.ignoreFailureType);
updateProperty(Constants.FAILURE_COUNT_THRESHOLD_PROPERTY, form.failureCountThreshold.toString());
fessConfig.setIncrementalCrawling(Constants.ON.equalsIgnoreCase(form.incrementalCrawling));
fessConfig.setDayForCleanup(form.dayForCleanup);
fessConfig.setCrawlingThreadCount(form.crawlingThreadCount);
fessConfig.setSearchLog(Constants.ON.equalsIgnoreCase(form.searchLog));
fessConfig.setUserInfo(Constants.ON.equalsIgnoreCase(form.userInfo));
fessConfig.setUserFavorite(Constants.ON.equalsIgnoreCase(form.userFavorite));
fessConfig.setWebApiJson(Constants.ON.equalsIgnoreCase(form.webApiJson));
fessConfig.setDefaultLabelValue(form.defaultLabelValue);
fessConfig.setDefaultSortValue(form.defaultSortValue);
fessConfig.setAppendQueryParameter(Constants.ON.equalsIgnoreCase(form.appendQueryParameter));
fessConfig.setIgnoreFailureType(form.ignoreFailureType);
fessConfig.setFailureCountThreshold(form.failureCountThreshold);
fessConfig.setWebApiPopularWord(Constants.ON.equalsIgnoreCase(form.popularWord));
updateProperty(Constants.CSV_FILE_ENCODING_PROPERTY, form.csvFileEncoding);
updateProperty(Constants.PURGE_SEARCH_LOG_DAY_PROPERTY, form.purgeSearchLogDay.toString());
updateProperty(Constants.PURGE_JOB_LOG_DAY_PROPERTY, form.purgeJobLogDay.toString());
updateProperty(Constants.PURGE_USER_INFO_DAY_PROPERTY, form.purgeUserInfoDay.toString());
updateProperty(Constants.PURGE_BY_BOTS_PROPERTY, form.purgeByBots);
updateProperty(Constants.NOTIFICATION_TO_PROPERTY, form.notificationTo);
updateProperty(Constants.SUGGEST_SEARCH_LOG_PROPERTY, getCheckboxValue(form.suggestSearchLog));
updateProperty(Constants.SUGGEST_DOCUMENTS_PROPERTY, getCheckboxValue(form.suggestDocuments));
updateProperty(Constants.PURGE_SUGGEST_SEARCH_LOG_DAY_PROPERTY, form.purgeSuggestSearchLogDay.toString());
updateProperty(Constants.LDAP_PROVIDER_URL, form.ldapProviderUrl);
updateProperty(Constants.LDAP_SECURITY_PRINCIPAL, form.ldapSecurityPrincipal);
updateProperty(Constants.LDAP_BASE_DN, form.ldapBaseDn);
updateProperty(Constants.LDAP_ACCOUNT_FILTER, form.ldapAccountFilter);
updateProperty(Constants.NOTIFICATION_LOGIN, form.notificationLogin);
updateProperty(Constants.NOTIFICATION_SEARCH_TOP, form.notificationSearchTop);
fessConfig.setCsvFileEncoding(form.csvFileEncoding);
fessConfig.setPurgeSearchLogDay(form.purgeSearchLogDay);
fessConfig.setPurgeJobLogDay(form.purgeJobLogDay);
fessConfig.setPurgeUserInfoDay(form.purgeUserInfoDay);
fessConfig.setPurgeByBots(form.purgeByBots);
fessConfig.setNotificationTo(form.notificationTo);
fessConfig.setSuggestSearchLog(Constants.ON.equalsIgnoreCase(form.suggestSearchLog));
fessConfig.setSuggestDocuments(Constants.ON.equalsIgnoreCase(form.suggestDocuments));
fessConfig.setPurgeSuggestSearchLogDay(form.purgeSuggestSearchLogDay);
fessConfig.setLdapProviderUrl(form.ldapProviderUrl);
fessConfig.setLdapSecurityPrincipal(form.ldapSecurityPrincipal);
fessConfig.setLdapBaseDn(form.ldapBaseDn);
fessConfig.setLdapAccountFilter(form.ldapAccountFilter);
fessConfig.setNotificationLogin(form.notificationLogin);
fessConfig.setNotificationSearchTop(form.notificationSearchTop);
fessConfig.storeSystemProperties();
saveInfo(messages -> messages.addSuccessUpdateCrawlerParams(GLOBAL));
@ -156,39 +157,34 @@ public class AdminGeneralAction extends FessAdminAction {
protected void updateForm(final EditForm form) {
form.loginRequired = fessConfig.isLoginRequired() ? Constants.TRUE : Constants.FALSE;
form.incrementalCrawling = systemProperties.getProperty(Constants.INCREMENTAL_CRAWLING_PROPERTY, Constants.TRUE);
form.dayForCleanup = getPropertyAsInteger(Constants.DAY_FOR_CLEANUP_PROPERTY, Constants.DEFAULT_DAY_FOR_CLEANUP);
form.crawlingThreadCount = Integer.parseInt(systemProperties.getProperty(Constants.CRAWLING_THREAD_COUNT_PROPERTY, "5"));
form.searchLog = systemProperties.getProperty(Constants.SEARCH_LOG_PROPERTY, Constants.TRUE);
form.userInfo = systemProperties.getProperty(Constants.USER_INFO_PROPERTY, Constants.TRUE);
form.userFavorite = systemProperties.getProperty(Constants.USER_FAVORITE_PROPERTY, Constants.FALSE);
form.webApiJson = systemProperties.getProperty(Constants.WEB_API_JSON_PROPERTY, Constants.TRUE);
form.defaultLabelValue = systemProperties.getProperty(Constants.DEFAULT_LABEL_VALUE_PROPERTY, StringUtil.EMPTY);
form.appendQueryParameter = systemProperties.getProperty(Constants.APPEND_QUERY_PARAMETER_PROPERTY, Constants.FALSE);
form.ignoreFailureType =
systemProperties.getProperty(Constants.IGNORE_FAILURE_TYPE_PROPERTY, Constants.DEFAULT_IGNORE_FAILURE_TYPE);
form.failureCountThreshold = getPropertyAsInteger(Constants.FAILURE_COUNT_THRESHOLD_PROPERTY, Constants.DEFAULT_FAILURE_COUNT);
form.incrementalCrawling = fessConfig.isIncrementalCrawling() ? Constants.TRUE : Constants.FALSE;
form.dayForCleanup = fessConfig.getDayForCleanup();
form.crawlingThreadCount = fessConfig.getCrawlingThreadCount();
form.searchLog = fessConfig.isSearchLog() ? Constants.TRUE : Constants.FALSE;
form.userInfo = fessConfig.isUserInfo() ? Constants.TRUE : Constants.FALSE;
form.userFavorite = fessConfig.isUserFavorite() ? Constants.TRUE : Constants.FALSE;
form.webApiJson = fessConfig.isWebApiJson() ? Constants.TRUE : Constants.FALSE;
form.defaultLabelValue = fessConfig.getDefaultLabelValue();
form.defaultSortValue = fessConfig.getDefaultSortValue();
form.appendQueryParameter = fessConfig.isAppendQueryParameter() ? Constants.TRUE : Constants.FALSE;
form.ignoreFailureType = fessConfig.getIgnoreFailureType();
form.failureCountThreshold = fessConfig.getFailureCountThreshold();
form.popularWord = fessConfig.isWebApiPopularWord() ? Constants.TRUE : Constants.FALSE;
form.csvFileEncoding = systemProperties.getProperty(Constants.CSV_FILE_ENCODING_PROPERTY, Constants.UTF_8);
form.purgeSearchLogDay =
Integer.parseInt(systemProperties.getProperty(Constants.PURGE_SEARCH_LOG_DAY_PROPERTY, Constants.DEFAULT_PURGE_DAY));
form.purgeJobLogDay =
Integer.parseInt(systemProperties.getProperty(Constants.PURGE_JOB_LOG_DAY_PROPERTY, Constants.DEFAULT_PURGE_DAY));
form.purgeUserInfoDay =
Integer.parseInt(systemProperties.getProperty(Constants.PURGE_USER_INFO_DAY_PROPERTY, Constants.DEFAULT_PURGE_DAY));
form.purgeByBots = systemProperties.getProperty(Constants.PURGE_BY_BOTS_PROPERTY, Constants.DEFAULT_PURGE_BY_BOTS);
form.notificationTo = systemProperties.getProperty(Constants.NOTIFICATION_TO_PROPERTY, StringUtil.EMPTY);
form.suggestSearchLog = systemProperties.getProperty(Constants.SUGGEST_SEARCH_LOG_PROPERTY, Constants.TRUE);
form.suggestDocuments = systemProperties.getProperty(Constants.SUGGEST_DOCUMENTS_PROPERTY, Constants.TRUE);
form.purgeSuggestSearchLogDay =
Integer.parseInt(systemProperties.getProperty(Constants.PURGE_SUGGEST_SEARCH_LOG_DAY_PROPERTY,
Constants.DEFAULT_SUGGEST_PURGE_DAY));
form.ldapProviderUrl = systemProperties.getProperty(Constants.LDAP_PROVIDER_URL, StringUtil.EMPTY);
form.ldapSecurityPrincipal = systemProperties.getProperty(Constants.LDAP_SECURITY_PRINCIPAL, StringUtil.EMPTY);
form.ldapBaseDn = systemProperties.getProperty(Constants.LDAP_BASE_DN, StringUtil.EMPTY);
form.ldapAccountFilter = systemProperties.getProperty(Constants.LDAP_ACCOUNT_FILTER, StringUtil.EMPTY);
form.notificationLogin = systemProperties.getProperty(Constants.NOTIFICATION_LOGIN, StringUtil.EMPTY);
form.notificationSearchTop = systemProperties.getProperty(Constants.NOTIFICATION_SEARCH_TOP, StringUtil.EMPTY);
form.csvFileEncoding = fessConfig.getCsvFileEncoding();
form.purgeSearchLogDay = fessConfig.getPurgeSearchLogDay();
form.purgeJobLogDay = fessConfig.getPurgeJobLogDay();
form.purgeUserInfoDay = fessConfig.getPurgeUserInfoDay();
form.purgeByBots = fessConfig.getPurgeByBots();
form.notificationTo = fessConfig.getNotificationTo();
form.suggestSearchLog = fessConfig.isSuggestSearchLog() ? Constants.TRUE : Constants.FALSE;
form.suggestDocuments = fessConfig.isSuggestDocuments() ? Constants.TRUE : Constants.FALSE;
form.purgeSuggestSearchLogDay = fessConfig.getPurgeSuggestSearchLogDay();
form.ldapProviderUrl = fessConfig.getLdapProviderUrl();
form.ldapSecurityPrincipal = fessConfig.getLdapSecurityPrincipal();
form.ldapBaseDn = fessConfig.getLdapBaseDn();
form.ldapAccountFilter = fessConfig.getLdapAccountFilter();
form.notificationLogin = fessConfig.getNotificationLogin();
form.notificationSearchTop = fessConfig.getNotificationSearchTop();
}
private void updateProperty(final String key, final String value) {
@ -196,7 +192,7 @@ public class AdminGeneralAction extends FessAdminAction {
}
private Integer getPropertyAsInteger(final String key, final int defaultValue) {
final String value = systemProperties.getProperty(Constants.CRAWLING_THREAD_COUNT_PROPERTY);
final String value = systemProperties.getProperty(key);
if (value != null) {
try {
return Integer.valueOf(value);

View file

@ -62,6 +62,9 @@ public class EditForm implements Serializable {
@Size(max = 1000)
public String defaultLabelValue;
@Size(max = 1000)
public String defaultSortValue;
@Size(max = 10)
public String appendQueryParameter;

View file

@ -15,7 +15,6 @@
*/
package org.codelibs.fess.app.web.base;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
@ -134,25 +133,22 @@ public abstract class FessSearchAction extends FessBaseAction {
return false;
}
protected void buildLabelParams(final Map<String, String[]> fields) {
protected void buildFormParams(final SearchForm form) {
if (form.facet == null) {
form.facet = queryHelper.getDefaultFacetInfo();
}
if (form.geo == null) {
form.geo = queryHelper.getDefaultGeoInfo();
}
// label
final List<Map<String, String>> labelTypeItems = labelTypeHelper.getLabelTypeItemList();
if (!labelTypeItems.isEmpty() && !fields.containsKey(FessSearchAction.LABEL_FIELD)) {
final String defaultLabelValue = systemProperties.getProperty(Constants.DEFAULT_LABEL_VALUE_PROPERTY, StringUtil.EMPTY);
if (StringUtil.isNotBlank(defaultLabelValue)) {
final String[] values = defaultLabelValue.split("\n");
if (values != null && values.length > 0) {
final List<String> list = new ArrayList<String>(values.length);
for (final String value : values) {
if (StringUtil.isNotBlank(value)) {
list.add(value);
}
}
if (!list.isEmpty()) {
fields.put(FessSearchAction.LABEL_FIELD, list.toArray(new String[list.size()]));
}
}
if (!labelTypeItems.isEmpty() && !form.fields.containsKey(FessSearchAction.LABEL_FIELD)) {
final String[] defaultLabelValues = fessConfig.getDefaultLabelValues(getUserBean());
if (defaultLabelValues.length > 0) {
form.fields.put(FessSearchAction.LABEL_FIELD, defaultLabelValues);
}
}
@ -163,6 +159,14 @@ public abstract class FessSearchAction extends FessBaseAction {
}
}
request.setAttribute(Constants.LABEL_VALUE_MAP, labelMap);
// sort
if (StringUtil.isBlank(form.sort)) {
String[] defaultSortValues = fessConfig.getDefaultSortValues(getUserBean());
if (defaultSortValues.length > 0) {
form.sort = String.join(",", defaultSortValues);
}
}
}
protected void buildInitParams() {

View file

@ -47,7 +47,7 @@ public class HelpAction extends FessSearchAction {
return asHtml(path_HelpJsp).useForm(SearchForm.class, op -> {
op.setup(form -> {
buildLabelParams(form.fields);
buildFormParams(form);
});
}).renderWith(data -> {
buildInitParams();

View file

@ -118,9 +118,9 @@ public class SearchAction extends FessSearchAction {
}
try {
updateSearchParams(form);
buildLabelParams(form.fields);
buildFormParams(form);
form.lang = searchService.getLanguages(request, form);
request.setAttribute(Constants.REQUEST_LANGUAGES, form.lang);
final WebRenderData renderData = new WebRenderData();
searchService.search(request, form, renderData);
return asHtml(path_SearchJsp).renderWith(data -> {
@ -172,16 +172,6 @@ public class SearchAction extends FessSearchAction {
return doSearch(form);
}
protected void updateSearchParams(final SearchForm form) {
if (form.facet == null) {
form.facet = queryHelper.getDefaultFacetInfo();
}
if (form.geo == null) {
form.geo = queryHelper.getDefaultGeoInfo();
}
}
protected String getDisplayQuery(final SearchForm form, final List<Map<String, String>> labelTypeItems) {
final StringBuilder buf = new StringBuilder(100);
buf.append(form.q);

View file

@ -59,7 +59,6 @@ public class FessCrawlerThread extends CrawlerThread {
final DynamicProperties systemProperties = ComponentUtil.getSystemProperties();
if (systemProperties.getProperty(Constants.INCREMENTAL_CRAWLING_PROPERTY, Constants.TRUE).equals(Constants.TRUE)) {
log(logHelper, LogType.CHECK_LAST_MODIFIED, crawlerContext, urlQueue);
final long startTime = System.currentTimeMillis();
final FessConfig fessConfig = ComponentUtil.getFessConfig();
@ -79,30 +78,39 @@ public class FessCrawlerThread extends CrawlerThread {
for (final String roleType : crawlingConfig.getRoleTypeValues()) {
roleTypeList.add(roleType);
}
if (fessConfig.isSmbRoleFromFile() && url.startsWith("smb://")) {
// head method
responseData = client.execute(RequestDataBuilder.newRequestData().head().url(url).build());
if (responseData == null) {
if (url.startsWith("smb://")) {
if (url.endsWith("/")) {
// directory
return true;
}
final ACE[] aces = (ACE[]) responseData.getMetaDataMap().get(SmbClient.SMB_ACCESS_CONTROL_ENTRIES);
if (aces != null) {
for (final ACE item : aces) {
final SID sid = item.getSID();
final String accountId = sambaHelper.getAccountId(sid);
if (accountId != null) {
roleTypeList.add(accountId);
}
if (fessConfig.isSmbRoleFromFile()) {
// head method
responseData = client.execute(RequestDataBuilder.newRequestData().head().url(url).build());
if (responseData == null) {
return true;
}
if (logger.isDebugEnabled()) {
logger.debug("smbUrl:" + responseData.getUrl() + " roleType:" + roleTypeList.toString());
final ACE[] aces = (ACE[]) responseData.getMetaDataMap().get(SmbClient.SMB_ACCESS_CONTROL_ENTRIES);
if (aces != null) {
for (final ACE item : aces) {
final SID sid = item.getSID();
final String accountId = sambaHelper.getAccountId(sid);
if (accountId != null) {
roleTypeList.add(accountId);
}
}
if (logger.isDebugEnabled()) {
logger.debug("smbUrl:" + responseData.getUrl() + " roleType:" + roleTypeList.toString());
}
}
}
}
dataMap.put(fessConfig.getIndexFieldRole(), roleTypeList);
final String id = crawlingInfoHelper.generateId(dataMap);
if (logger.isDebugEnabled()) {
logger.debug("Searching indexed document: " + id);
}
final Map<String, Object> document =
indexingHelper.getDocument(
fessEsClient,
@ -129,6 +137,8 @@ public class FessCrawlerThread extends CrawlerThread {
if (lastModified == null) {
return true;
}
urlQueue.setLastModified(lastModified.getTime());
log(logHelper, LogType.CHECK_LAST_MODIFIED, crawlerContext, urlQueue);
if (responseData == null) {
// head method
@ -139,6 +149,9 @@ public class FessCrawlerThread extends CrawlerThread {
}
final int httpStatusCode = responseData.getHttpStatusCode();
if (logger.isDebugEnabled()) {
logger.debug("Accessing document: " + url + ", status: " + httpStatusCode);
}
if (httpStatusCode == 404) {
storeChildUrlsToQueue(urlQueue, getAnchorSet(document.get(fessConfig.getIndexFieldAnchor())));
indexingHelper.deleteDocument(fessEsClient, id);
@ -170,11 +183,9 @@ public class FessCrawlerThread extends CrawlerThread {
protected void storeChildUrlsToQueue(final UrlQueue<?> urlQueue, final Set<RequestData> childUrlSet) {
if (childUrlSet != null) {
synchronized (crawlerContext.getAccessCountLock()) {
// add an url
storeChildUrls(childUrlSet.stream().filter(rd -> StringUtil.isNotBlank(rd.getUrl())).collect(Collectors.toSet()),
urlQueue.getUrl(), urlQueue.getDepth() != null ? urlQueue.getDepth() + 1 : 1);
}
// add an url
storeChildUrls(childUrlSet.stream().filter(rd -> StringUtil.isNotBlank(rd.getUrl())).collect(Collectors.toSet()),
urlQueue.getUrl(), urlQueue.getDepth() != null ? urlQueue.getDepth() + 1 : 1);
}
}
@ -214,9 +225,9 @@ public class FessCrawlerThread extends CrawlerThread {
}
final Set<RequestData> urlSet = new HashSet<>(docList.size());
for (final Map<String, Object> doc : docList) {
final Object obj = doc.get(fessConfig.getIndexFieldUrl());
if (obj != null) {
urlSet.add(RequestDataBuilder.newRequestData().get().url(obj.toString()).build());
final String url = DocumentUtil.getValue(doc, fessConfig.getIndexFieldUrl(), String.class);
if (StringUtil.isNotBlank(url)) {
urlSet.add(RequestDataBuilder.newRequestData().get().url(url).build());
}
}
return urlSet;

View file

@ -67,6 +67,7 @@ import org.elasticsearch.action.ActionRequestBuilder;
import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse;
import org.elasticsearch.action.admin.indices.flush.FlushResponse;
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse;
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
@ -128,7 +129,6 @@ import org.elasticsearch.action.search.SearchRequestBuilder;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.search.SearchScrollRequest;
import org.elasticsearch.action.search.SearchScrollRequestBuilder;
import org.elasticsearch.action.search.SearchType;
import org.elasticsearch.action.suggest.SuggestRequest;
import org.elasticsearch.action.suggest.SuggestRequestBuilder;
import org.elasticsearch.action.suggest.SuggestResponse;
@ -152,7 +152,6 @@ import org.elasticsearch.common.settings.Settings.Builder;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
import org.elasticsearch.common.transport.TransportAddress;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.index.IndexNotFoundException;
import org.elasticsearch.index.get.GetField;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.indices.IndexAlreadyExistsException;
@ -211,7 +210,8 @@ public class FessEsClient implements Client {
}
public String getStatus() {
return admin().cluster().prepareHealth().execute().actionGet().getStatus().name();
return admin().cluster().prepareHealth().execute().actionGet(ComponentUtil.getFessConfig().getIndexHealthTimeout()).getStatus()
.name();
}
public void setRunner(final ElasticsearchClusterRunner runner) {
@ -308,9 +308,10 @@ public class FessEsClient implements Client {
final String configType = values[1];
boolean exists = false;
try {
client.prepareExists(configIndex).execute().actionGet();
exists = true;
} catch (final IndexNotFoundException e) {
IndicesExistsResponse response =
client.admin().indices().prepareExists(configIndex).execute().actionGet(fessConfig.getIndexSearchTimeout());
exists = response.isExists();
} catch (final Exception e) {
// ignore
}
if (!exists) {
@ -351,7 +352,8 @@ public class FessEsClient implements Client {
final String dictionaryPath = System.getProperty("fess.dictionary.path", StringUtil.EMPTY);
source = source.replaceAll(Pattern.quote("${fess.dictionary.path}"), dictionaryPath);
final CreateIndexResponse indexResponse =
client.admin().indices().prepareCreate(configIndex).setSource(source).execute().actionGet();
client.admin().indices().prepareCreate(configIndex).setSource(source).execute()
.actionGet(fessConfig.getIndexIndicesTimeout());
if (indexResponse.isAcknowledged()) {
logger.info("Created " + configIndex + " index.");
} else if (logger.isDebugEnabled()) {
@ -365,7 +367,7 @@ public class FessEsClient implements Client {
}
final GetMappingsResponse getMappingsResponse =
client.admin().indices().prepareGetMappings(configIndex).setTypes(configType).execute().actionGet();
client.admin().indices().prepareGetMappings(configIndex).execute().actionGet(fessConfig.getIndexIndicesTimeout());
final ImmutableOpenMap<String, MappingMetaData> indexMappings = getMappingsResponse.mappings().get(configIndex);
if (indexMappings == null || !indexMappings.containsKey(configType)) {
String source = null;
@ -375,56 +377,22 @@ public class FessEsClient implements Client {
} catch (final Exception e) {
logger.warn(mappingFile + " is not found.", e);
}
final PutMappingResponse putMappingResponse =
client.admin().indices().preparePutMapping(configIndex).setType(configType).setSource(source).execute().actionGet();
if (putMappingResponse.isAcknowledged()) {
logger.info("Created " + configIndex + "/" + configType + " mapping.");
} else {
logger.warn("Failed to create " + configIndex + "/" + configType + " mapping.");
}
final String dataPath = indexConfigPath + "/" + configIndex + "/" + configType + ".bulk";
if (ResourceUtil.isExist(dataPath)) {
try {
final BulkRequestBuilder builder = client.prepareBulk();
final ObjectMapper mapper = new ObjectMapper();
Arrays.stream(FileUtil.readUTF8(dataPath).split("\n")).reduce(
(prev, line) -> {
try {
if (StringUtil.isBlank(prev)) {
final Map<String, Map<String, String>> result =
mapper.readValue(line, new TypeReference<Map<String, Map<String, String>>>() {
});
if (result.keySet().contains("index")) {
return line;
} else if (result.keySet().contains("update")) {
return line;
} else if (result.keySet().contains("delete")) {
return StringUtil.EMPTY;
}
} else {
final Map<String, Map<String, String>> result =
mapper.readValue(prev, new TypeReference<Map<String, Map<String, String>>>() {
});
if (result.keySet().contains("index")) {
final IndexRequestBuilder requestBuilder =
client.prepareIndex(configIndex, configType, result.get("index").get("_id"))
.setSource(line);
builder.add(requestBuilder);
}
}
} catch (final Exception e) {
logger.warn("Failed to parse " + dataPath);
}
return StringUtil.EMPTY;
});
final BulkResponse response = builder.execute().actionGet();
if (response.hasFailures()) {
logger.warn("Failed to register " + dataPath + ": " + response.buildFailureMessage());
}
} catch (final Exception e) {
try {
final PutMappingResponse putMappingResponse =
client.admin().indices().preparePutMapping(configIndex).setType(configType).setSource(source).execute()
.actionGet(fessConfig.getIndexIndicesTimeout());
if (putMappingResponse.isAcknowledged()) {
logger.info("Created " + configIndex + "/" + configType + " mapping.");
} else {
logger.warn("Failed to create " + configIndex + "/" + configType + " mapping.");
}
final String dataPath = indexConfigPath + "/" + configIndex + "/" + configType + ".bulk";
if (ResourceUtil.isExist(dataPath)) {
insertBulkData(fessConfig, configIndex, configType, dataPath);
}
} catch (final Exception e) {
logger.warn("Failed to create " + configIndex + "/" + configType + " mapping.", e);
}
} else if (logger.isDebugEnabled()) {
logger.debug(configIndex + "/" + configType + " mapping exists.");
@ -435,8 +403,52 @@ public class FessEsClient implements Client {
}) ;
}
protected void insertBulkData(final FessConfig fessConfig, final String configIndex, final String configType, final String dataPath) {
try {
final BulkRequestBuilder builder = client.prepareBulk();
final ObjectMapper mapper = new ObjectMapper();
Arrays.stream(FileUtil.readUTF8(dataPath).split("\n")).reduce(
(prev, line) -> {
try {
if (StringUtil.isBlank(prev)) {
final Map<String, Map<String, String>> result =
mapper.readValue(line, new TypeReference<Map<String, Map<String, String>>>() {
});
if (result.keySet().contains("index")) {
return line;
} else if (result.keySet().contains("update")) {
return line;
} else if (result.keySet().contains("delete")) {
return StringUtil.EMPTY;
}
} else {
final Map<String, Map<String, String>> result =
mapper.readValue(prev, new TypeReference<Map<String, Map<String, String>>>() {
});
if (result.keySet().contains("index")) {
final IndexRequestBuilder requestBuilder =
client.prepareIndex(configIndex, configType, result.get("index").get("_id")).setSource(line);
builder.add(requestBuilder);
}
}
} catch (final Exception e) {
logger.warn("Failed to parse " + dataPath);
}
return StringUtil.EMPTY;
});
final BulkResponse response = builder.execute().actionGet(fessConfig.getIndexBulkTimeout());
if (response.hasFailures()) {
logger.warn("Failed to register " + dataPath + ": " + response.buildFailureMessage());
}
} catch (final Exception e) {
logger.warn("Failed to create " + configIndex + "/" + configType + " mapping.");
}
}
private void waitForYellowStatus() {
final ClusterHealthResponse response = client.admin().cluster().prepareHealth().setWaitForYellowStatus().execute().actionGet();
final ClusterHealthResponse response =
client.admin().cluster().prepareHealth().setWaitForYellowStatus().execute()
.actionGet(ComponentUtil.getFessConfig().getIndexHealthTimeout());
if (logger.isDebugEnabled()) {
logger.debug("Elasticsearch Cluster Status: " + response.getStatus());
}
@ -445,6 +457,12 @@ public class FessEsClient implements Client {
@Override
@PreDestroy
public void close() {
try {
client.admin().indices().prepareFlush().setForce(true).execute()
.actionGet(ComponentUtil.getFessConfig().getIndexIndicesTimeout());
} catch (Exception e) {
logger.warn("Failed to flush indices.", e);
}
try {
client.close();
} catch (final ElasticsearchException e) {
@ -454,16 +472,16 @@ public class FessEsClient implements Client {
public int deleteByQuery(final String index, final String type, final QueryBuilder queryBuilder) {
final SearchResponse response =
client.prepareSearch(index).setTypes(type).setSearchType(SearchType.SCAN).setScroll(scrollForDelete).setSize(sizeForDelete)
.setQuery(queryBuilder).execute().actionGet();
final FessConfig fessConfig = ComponentUtil.getFessConfig();
SearchResponse response =
client.prepareSearch(index).setTypes(type).setScroll(scrollForDelete).setSize(sizeForDelete)
.addField(fessConfig.getIndexFieldId()).setQuery(queryBuilder).execute()
.actionGet(fessConfig.getIndexScrollSearchTimeoutTimeout());
int count = 0;
String scrollId = response.getScrollId();
while (scrollId != null) {
final SearchResponse scrollResponse = client.prepareSearchScroll(scrollId).setScroll(scrollForDelete).execute().actionGet();
scrollId = scrollResponse.getScrollId();
final SearchHits searchHits = scrollResponse.getHits();
final SearchHits searchHits = response.getHits();
final SearchHit[] hits = searchHits.getHits();
if (hits.length == 0) {
scrollId = null;
@ -475,10 +493,14 @@ public class FessEsClient implements Client {
bulkRequest.add(client.prepareDelete(index, type, hit.getId()));
}
count += hits.length;
final BulkResponse bulkResponse = bulkRequest.execute().actionGet();
final BulkResponse bulkResponse = bulkRequest.execute().actionGet(fessConfig.getIndexBulkTimeout());
if (bulkResponse.hasFailures()) {
throw new IllegalBehaviorStateException(bulkResponse.buildFailureMessage());
}
response =
client.prepareSearchScroll(scrollId).setScroll(scrollForDelete).execute().actionGet(fessConfig.getIndexBulkTimeout());
scrollId = response.getScrollId();
}
return count;
}
@ -505,7 +527,7 @@ public class FessEsClient implements Client {
}
}
response = requestBuilder.execute().actionGet();
response = requestBuilder.execute().actionGet(ComponentUtil.getFessConfig().getIndexSearchTimeout());
}
final long execTime = System.currentTimeMillis() - startTime;
@ -539,7 +561,7 @@ public class FessEsClient implements Client {
}
try {
searchResponse = searchRequestBuilder.execute().actionGet();
searchResponse = searchRequestBuilder.execute().actionGet(ComponentUtil.getFessConfig().getIndexSearchTimeout());
} catch (final SearchPhaseExecutionException e) {
throw new InvalidQueryException(messages -> messages.addErrorsInvalidQueryParseError(UserMessages.GLOBAL_PROPERTY_KEY),
"Invalid query: " + searchRequestBuilder, e);
@ -667,7 +689,8 @@ public class FessEsClient implements Client {
public boolean update(final String index, final String type, final String id, final String field, final Object value) {
try {
return client.prepareUpdate(index, type, id).setDoc(field, value).execute().actionGet().isCreated();
return client.prepareUpdate(index, type, id).setDoc(field, value).execute()
.actionGet(ComponentUtil.getFessConfig().getIndexIndexTimeout()).isCreated();
} catch (final ElasticsearchException e) {
throw new FessEsClientException("Failed to set " + value + " to " + field + " for doc " + id, e);
}
@ -710,7 +733,8 @@ public class FessEsClient implements Client {
public PingResponse ping() {
try {
final ClusterHealthResponse response = client.admin().cluster().prepareHealth().execute().actionGet();
final ClusterHealthResponse response =
client.admin().cluster().prepareHealth().execute().actionGet(ComponentUtil.getFessConfig().getIndexHealthTimeout());
return new PingResponse(response);
} catch (final ElasticsearchException e) {
throw new FessEsClientException("Failed to process a ping request.", e);
@ -724,15 +748,17 @@ public class FessEsClient implements Client {
final Object id = doc.remove(fessConfig.getIndexFieldId());
bulkRequestBuilder.add(client.prepareIndex(index, type, id.toString()).setSource(doc));
}
final BulkResponse response = bulkRequestBuilder.execute().actionGet();
final BulkResponse response = bulkRequestBuilder.execute().actionGet(ComponentUtil.getFessConfig().getIndexBulkTimeout());
if (response.hasFailures()) {
if (logger.isDebugEnabled()) {
@SuppressWarnings("rawtypes")
final List<ActionRequest> requests = bulkRequestBuilder.request().requests();
final BulkItemResponse[] items = response.getItems();
if (requests.size() == items.length) {
for (int i = 0; i < requests.size(); i++) {
final BulkItemResponse resp = items[i];
if (resp.isFailed() && resp.getFailure() != null) {
@SuppressWarnings("rawtypes")
final ActionRequest req = requests.get(i);
final Failure failure = resp.getFailure();
logger.debug("Failed Request: " + req + "\n=>" + failure.getMessage());
@ -889,12 +915,13 @@ public class FessEsClient implements Client {
if (id == null) {
// create
response =
client.prepareIndex(index, type).setSource(source).setRefresh(true).setOpType(OpType.CREATE).execute().actionGet();
client.prepareIndex(index, type).setSource(source).setRefresh(true).setOpType(OpType.CREATE).execute()
.actionGet(fessConfig.getIndexIndexTimeout());
} else {
// create or update
response =
client.prepareIndex(index, type, id).setSource(source).setRefresh(true).setOpType(OpType.INDEX).setVersion(version)
.execute().actionGet();
.execute().actionGet(fessConfig.getIndexIndexTimeout());
}
return response.isCreated();
} catch (final ElasticsearchException e) {
@ -908,7 +935,7 @@ public class FessEsClient implements Client {
if (version > 0) {
builder.setVersion(version);
}
final DeleteResponse response = builder.execute().actionGet();
final DeleteResponse response = builder.execute().actionGet(ComponentUtil.getFessConfig().getIndexDeleteTimeout());
return response.isFound();
} catch (final ElasticsearchException e) {
throw new FessEsClientException("Failed to delete: " + index + "/" + type + "/" + id + "/" + version, e);
@ -1120,31 +1147,37 @@ public class FessEsClient implements Client {
return client.prepareMultiGet();
}
@SuppressWarnings("deprecation")
@Override
public ActionFuture<CountResponse> count(final CountRequest request) {
return client.count(request);
}
@SuppressWarnings("deprecation")
@Override
public void count(final CountRequest request, final ActionListener<CountResponse> listener) {
client.count(request, listener);
}
@SuppressWarnings("deprecation")
@Override
public CountRequestBuilder prepareCount(final String... indices) {
return client.prepareCount(indices);
}
@SuppressWarnings("deprecation")
@Override
public ActionFuture<ExistsResponse> exists(final ExistsRequest request) {
return client.exists(request);
}
@SuppressWarnings("deprecation")
@Override
public void exists(final ExistsRequest request, final ActionListener<ExistsResponse> listener) {
client.exists(request, listener);
}
@SuppressWarnings("deprecation")
@Override
public ExistsRequestBuilder prepareExists(final String... indices) {
return client.prepareExists(indices);
@ -1290,18 +1323,21 @@ public class FessEsClient implements Client {
return client.settings();
}
@SuppressWarnings("rawtypes")
@Override
public <Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>> ActionFuture<Response> execute(
final Action<Request, Response, RequestBuilder> action, final Request request) {
return client.execute(action, request);
}
@SuppressWarnings("rawtypes")
@Override
public <Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>> void execute(
final Action<Request, Response, RequestBuilder> action, final Request request, final ActionListener<Response> listener) {
client.execute(action, request, listener);
}
@SuppressWarnings("rawtypes")
@Override
public <Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>> RequestBuilder prepareExecute(
final Action<Request, Response, RequestBuilder> action) {

View file

@ -42,14 +42,12 @@ import org.dbflute.util.DfTypeUtil;
import org.elasticsearch.action.bulk.BulkItemResponse;
import org.elasticsearch.action.bulk.BulkRequestBuilder;
import org.elasticsearch.action.bulk.BulkResponse;
import org.elasticsearch.action.count.CountRequestBuilder;
import org.elasticsearch.action.delete.DeleteRequestBuilder;
import org.elasticsearch.action.delete.DeleteResponse;
import org.elasticsearch.action.index.IndexRequestBuilder;
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.search.SearchRequestBuilder;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.search.SearchType;
import org.elasticsearch.action.update.UpdateRequestBuilder;
import org.elasticsearch.client.Client;
import org.elasticsearch.search.SearchHit;
@ -69,6 +67,11 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
protected String scrollForDelete = "1m";
protected int sizeForCursor = 100;
protected String scrollForCursor = "1m";
protected String searchTimeout = "3m";
protected String indexTimeout = "3m";
protected String scrollSearchTimeout = "3m";
protected String bulkTimeout = "3m";
protected String deleteTimeout = "3m";
protected abstract String asEsIndex();
@ -84,8 +87,8 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
@Override
protected int delegateSelectCountUniquely(final ConditionBean cb) {
// #pending check response and cast problem
final CountRequestBuilder builder = client.prepareCount(asEsIndex()).setTypes(asEsSearchType());
return (int) ((EsAbstractConditionBean) cb).build(builder).execute().actionGet().getCount();
final SearchRequestBuilder builder = client.prepareSearch(asEsIndex()).setTypes(asEsSearchType());
return (int) ((EsAbstractConditionBean) cb).build(builder).execute().actionGet(searchTimeout).getHits().getTotalHits();
}
@Override
@ -117,7 +120,7 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
builder.setFrom(from);
builder.setSize(size);
((EsAbstractConditionBean) cb).request().build(builder);
final SearchResponse response = ((EsAbstractConditionBean) cb).build(builder).execute().actionGet();
final SearchResponse response = ((EsAbstractConditionBean) cb).build(builder).execute().actionGet(searchTimeout);
final EsPagingResultBean<RESULT> list = new EsPagingResultBean<>();
final SearchHits searchHits = response.getHits();
@ -192,20 +195,20 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
}
protected void delegateBulkRequest(final ConditionBean cb, Function<SearchHits, Boolean> handler) {
final SearchRequestBuilder builder =
client.prepareSearch(asEsIndex()).setTypes(asEsIndexType()).setSearchType(SearchType.SCAN).setScroll(scrollForCursor)
.setSize(sizeForCursor);
((EsAbstractConditionBean) cb).request().build(builder);
final SearchResponse response = ((EsAbstractConditionBean) cb).build(builder).execute().actionGet();
String scrollId = response.getScrollId();
while (scrollId != null) {
final SearchResponse scrollResponse = client.prepareSearchScroll(scrollId).setScroll(scrollForDelete).execute().actionGet();
scrollId = scrollResponse.getScrollId();
final SearchHits searchHits = scrollResponse.getHits();
SearchResponse response = null;
while (true) {
if (response == null) {
final SearchRequestBuilder builder =
client.prepareSearch(asEsIndex()).setTypes(asEsIndexType()).setScroll(scrollForCursor).setSize(sizeForCursor);
((EsAbstractConditionBean) cb).request().build(builder);
response = ((EsAbstractConditionBean) cb).build(builder).execute().actionGet(scrollSearchTimeout);
} else {
final String scrollId = response.getScrollId();
response = client.prepareSearchScroll(scrollId).setScroll(scrollForDelete).execute().actionGet(scrollSearchTimeout);
}
final SearchHits searchHits = response.getHits();
final SearchHit[] hits = searchHits.getHits();
if (hits.length == 0) {
scrollId = null;
break;
}
@ -237,7 +240,7 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
final EsAbstractEntity esEntity = (EsAbstractEntity) entity;
IndexRequestBuilder builder = createInsertRequest(esEntity);
final IndexResponse response = builder.execute().actionGet();
final IndexResponse response = builder.execute().actionGet(indexTimeout);
esEntity.asDocMeta().id(response.getId());
return response.isCreated() ? 1 : 0;
}
@ -260,7 +263,7 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
final EsAbstractEntity esEntity = (EsAbstractEntity) entity;
final IndexRequestBuilder builder = createUpdateRequest(esEntity);
final IndexResponse response = builder.execute().actionGet();
final IndexResponse response = builder.execute().actionGet(indexTimeout);
long version = response.getVersion();
if (version != -1) {
esEntity.asDocMeta().version(version);
@ -287,7 +290,7 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
final EsAbstractEntity esEntity = (EsAbstractEntity) entity;
final DeleteRequestBuilder builder = createDeleteRequest(esEntity);
final DeleteResponse response = builder.execute().actionGet();
final DeleteResponse response = builder.execute().actionGet(deleteTimeout);
return response.isFound() ? 1 : 0;
}
@ -302,21 +305,21 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
@Override
protected int delegateQueryDelete(final ConditionBean cb, final DeleteOption<? extends ConditionBean> option) {
final SearchRequestBuilder builder =
client.prepareSearch(asEsIndex()).setTypes(asEsIndexType()).setSearchType(SearchType.SCAN).setScroll(scrollForDelete)
.setSize(sizeForDelete);
((EsAbstractConditionBean) cb).request().build(builder);
final SearchResponse response = ((EsAbstractConditionBean) cb).build(builder).execute().actionGet();
SearchResponse response = null;
int count = 0;
String scrollId = response.getScrollId();
while (scrollId != null) {
final SearchResponse scrollResponse = client.prepareSearchScroll(scrollId).setScroll(scrollForDelete).execute().actionGet();
scrollId = scrollResponse.getScrollId();
final SearchHits searchHits = scrollResponse.getHits();
while (true) {
if (response == null) {
final SearchRequestBuilder builder =
client.prepareSearch(asEsIndex()).setTypes(asEsIndexType()).setScroll(scrollForDelete).setSize(sizeForDelete);
((EsAbstractConditionBean) cb).request().build(builder);
response = ((EsAbstractConditionBean) cb).build(builder).execute().actionGet(scrollSearchTimeout);
} else {
final String scrollId = response.getScrollId();
response = client.prepareSearchScroll(scrollId).setScroll(scrollForDelete).execute().actionGet(scrollSearchTimeout);
}
final SearchHits searchHits = response.getHits();
final SearchHit[] hits = searchHits.getHits();
if (hits.length == 0) {
scrollId = null;
break;
}
@ -325,7 +328,7 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
bulkRequest.add(client.prepareDelete(asEsIndex(), asEsIndexType(), hit.getId()));
}
count += hits.length;
final BulkResponse bulkResponse = bulkRequest.execute().actionGet();
final BulkResponse bulkResponse = bulkRequest.execute().actionGet(bulkTimeout);
if (bulkResponse.hasFailures()) {
throw new IllegalBehaviorStateException(bulkResponse.buildFailureMessage());
}
@ -390,7 +393,7 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
builderCall.callback(bulkBuilder);
}
final BulkResponse response = bulkBuilder.execute().actionGet();
final BulkResponse response = bulkBuilder.execute().actionGet(bulkTimeout);
final BulkItemResponse[] itemResponses = response.getItems();
if (itemResponses.length != entityList.size()) {
throw new IllegalStateException("Invalid response size: " + itemResponses.length + " != " + entityList.size());
@ -419,6 +422,42 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
return true;
}
public void setSizeForDelete(int sizeForDelete) {
this.sizeForDelete = sizeForDelete;
}
public void setScrollForDelete(String scrollForDelete) {
this.scrollForDelete = scrollForDelete;
}
public void setSizeForCursor(int sizeForCursor) {
this.sizeForCursor = sizeForCursor;
}
public void setScrollForCursor(String scrollForCursor) {
this.scrollForCursor = scrollForCursor;
}
public void setSearchTimeout(String searchTimeout) {
this.searchTimeout = searchTimeout;
}
public void setIndexTimeout(String indexTimeout) {
this.indexTimeout = indexTimeout;
}
public void setScrollSearchTimeout(String scrollSearchTimeout) {
this.scrollSearchTimeout = scrollSearchTimeout;
}
public void setBulkTimeout(String bulkTimeout) {
this.bulkTimeout = bulkTimeout;
}
public void setDeleteTimeout(String deleteTimeout) {
this.deleteTimeout = deleteTimeout;
}
// ===================================================================================
// Assist Logic
// ============

View file

@ -121,6 +121,7 @@ public class DataConfig extends BsDataConfig implements CrawlingConfig {
labelTypeList = labelIdList.isEmpty() ? Collections.emptyList() : labelTypeBhv.selectList(cb -> {
cb.query().setId_InScope(labelIdList);
cb.query().addOrderBy_SortOrder_Asc();
cb.fetchFirst(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger());
});
}
}
@ -168,6 +169,7 @@ public class DataConfig extends BsDataConfig implements CrawlingConfig {
roleTypeList = roleIdList.isEmpty() ? Collections.emptyList() : roleTypeBhv.selectList(cb -> {
cb.query().setId_InScope(roleIdList);
cb.query().addOrderBy_SortOrder_Asc();
cb.fetchFirst(fessConfig.getPageRoletypeMaxFetchSizeAsInteger());
});
}
}

View file

@ -71,6 +71,7 @@ public class ElevateWord extends BsElevateWord {
labelTypeList = labelIdList.isEmpty() ? Collections.emptyList() : labelTypeBhv.selectList(cb -> {
cb.query().setId_InScope(labelIdList);
cb.query().addOrderBy_SortOrder_Asc();
cb.fetchFirst(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger());
});
}
}

View file

@ -18,6 +18,8 @@ package org.codelibs.fess.es.config.exentity;
import org.codelibs.fess.app.service.FileConfigService;
import org.codelibs.fess.es.config.bsentity.BsFileAuthentication;
import org.codelibs.fess.util.ComponentUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author FreeGen
@ -25,6 +27,9 @@ import org.codelibs.fess.util.ComponentUtil;
public class FileAuthentication extends BsFileAuthentication {
private static final long serialVersionUID = 1L;
private static final Logger logger = LoggerFactory.getLogger(FileAuthentication.class);
private FileConfig fileConfig;
public String getId() {
@ -46,7 +51,11 @@ public class FileAuthentication extends BsFileAuthentication {
public FileConfig getFileConfig() {
if (fileConfig == null) {
final FileConfigService fileConfigService = ComponentUtil.getComponent(FileConfigService.class);
fileConfig = fileConfigService.getFileConfig(getFileConfigId()).get();
try {
fileConfig = fileConfigService.getFileConfig(getFileConfigId()).get();
} catch (Exception e) {
logger.warn("File Config " + getFileConfigId() + " does not exist.", e);
}
}
return fileConfig;
}

View file

@ -96,6 +96,7 @@ public class FileConfig extends BsFileConfig implements CrawlingConfig {
labelTypeList = labelIdList.isEmpty() ? Collections.emptyList() : labelTypeBhv.selectList(cb -> {
cb.query().setId_InScope(labelIdList);
cb.query().addOrderBy_SortOrder_Asc();
cb.fetchFirst(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger());
});
}
}
@ -143,6 +144,7 @@ public class FileConfig extends BsFileConfig implements CrawlingConfig {
roleTypeList = roleIdList.isEmpty() ? Collections.emptyList() : roleTypeBhv.selectList(cb -> {
cb.query().setId_InScope(roleIdList);
cb.query().addOrderBy_SortOrder_Asc();
cb.fetchFirst(fessConfig.getPageRoletypeMaxFetchSizeAsInteger());
});
}
}

View file

@ -67,6 +67,7 @@ public class LabelType extends BsLabelType {
roleTypeList = roleIdList.isEmpty() ? Collections.emptyList() : roleTypeBhv.selectList(cb -> {
cb.query().setId_InScope(roleIdList);
cb.query().addOrderBy_SortOrder_Asc();
cb.fetchFirst(fessConfig.getPageRoletypeMaxFetchSizeAsInteger());
});
}
}

View file

@ -18,6 +18,8 @@ package org.codelibs.fess.es.config.exentity;
import org.codelibs.fess.app.service.WebConfigService;
import org.codelibs.fess.es.config.bsentity.BsRequestHeader;
import org.codelibs.fess.util.ComponentUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author FreeGen
@ -25,6 +27,9 @@ import org.codelibs.fess.util.ComponentUtil;
public class RequestHeader extends BsRequestHeader {
private static final long serialVersionUID = 1L;
private static final Logger logger = LoggerFactory.getLogger(RequestHeader.class);
private WebConfig webConfig;
public String getId() {
@ -50,7 +55,11 @@ public class RequestHeader extends BsRequestHeader {
public WebConfig getWebConfig() {
if (webConfig == null) {
final WebConfigService webConfigService = ComponentUtil.getComponent(WebConfigService.class);
webConfig = webConfigService.getWebConfig(getWebConfigId()).get();
try {
webConfig = webConfigService.getWebConfig(getWebConfigId()).get();
} catch (Exception e) {
logger.warn("Web Config " + getWebConfigId() + " does not exist.", e);
}
}
return webConfig;
}

View file

@ -35,6 +35,8 @@ import org.codelibs.fess.crawler.exception.CrawlerSystemException;
import org.codelibs.fess.es.config.bsentity.BsWebAuthentication;
import org.codelibs.fess.util.ComponentUtil;
import org.codelibs.fess.util.ParameterUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author FreeGen
@ -42,6 +44,9 @@ import org.codelibs.fess.util.ParameterUtil;
public class WebAuthentication extends BsWebAuthentication {
private static final long serialVersionUID = 1L;
private static final Logger logger = LoggerFactory.getLogger(WebAuthentication.class);
private WebConfig webConfig;
public Authentication getAuthentication() {
@ -103,7 +108,11 @@ public class WebAuthentication extends BsWebAuthentication {
public WebConfig getWebConfig() {
if (webConfig == null) {
final WebConfigService webConfigService = ComponentUtil.getComponent(WebConfigService.class);
webConfig = webConfigService.getWebConfig(getWebConfigId()).get();
try {
webConfig = webConfigService.getWebConfig(getWebConfigId()).get();
} catch (Exception e) {
logger.warn("Web Config " + getWebConfigId() + " does not exist.", e);
}
}
return webConfig;
}

View file

@ -99,6 +99,7 @@ public class WebConfig extends BsWebConfig implements CrawlingConfig {
labelTypeList = labelIdList.isEmpty() ? Collections.emptyList() : labelTypeBhv.selectList(cb -> {
cb.query().setId_InScope(labelIdList);
cb.query().addOrderBy_SortOrder_Asc();
cb.fetchFirst(fessConfig.getPageLabeltypeMaxFetchSizeAsInteger());
});
}
}
@ -149,6 +150,7 @@ public class WebConfig extends BsWebConfig implements CrawlingConfig {
roleTypeList = roleIdList.isEmpty() ? Collections.emptyList() : roleTypeBhv.selectList(cb -> {
cb.query().setId_InScope(roleIdList);
cb.query().addOrderBy_SortOrder_Asc();
cb.fetchFirst(fessConfig.getPageRoletypeMaxFetchSizeAsInteger());
});
}
}

View file

@ -42,14 +42,12 @@ import org.dbflute.util.DfTypeUtil;
import org.elasticsearch.action.bulk.BulkItemResponse;
import org.elasticsearch.action.bulk.BulkRequestBuilder;
import org.elasticsearch.action.bulk.BulkResponse;
import org.elasticsearch.action.count.CountRequestBuilder;
import org.elasticsearch.action.delete.DeleteRequestBuilder;
import org.elasticsearch.action.delete.DeleteResponse;
import org.elasticsearch.action.index.IndexRequestBuilder;
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.search.SearchRequestBuilder;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.search.SearchType;
import org.elasticsearch.action.update.UpdateRequestBuilder;
import org.elasticsearch.client.Client;
import org.elasticsearch.search.SearchHit;
@ -69,6 +67,11 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
protected String scrollForDelete = "1m";
protected int sizeForCursor = 100;
protected String scrollForCursor = "1m";
protected String searchTimeout = "3m";
protected String indexTimeout = "3m";
protected String scrollSearchTimeout = "3m";
protected String bulkTimeout = "3m";
protected String deleteTimeout = "3m";
protected abstract String asEsIndex();
@ -84,8 +87,8 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
@Override
protected int delegateSelectCountUniquely(final ConditionBean cb) {
// #pending check response and cast problem
final CountRequestBuilder builder = client.prepareCount(asEsIndex()).setTypes(asEsSearchType());
return (int) ((EsAbstractConditionBean) cb).build(builder).execute().actionGet().getCount();
final SearchRequestBuilder builder = client.prepareSearch(asEsIndex()).setTypes(asEsSearchType());
return (int) ((EsAbstractConditionBean) cb).build(builder).execute().actionGet(searchTimeout).getHits().getTotalHits();
}
@Override
@ -117,7 +120,7 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
builder.setFrom(from);
builder.setSize(size);
((EsAbstractConditionBean) cb).request().build(builder);
final SearchResponse response = ((EsAbstractConditionBean) cb).build(builder).execute().actionGet();
final SearchResponse response = ((EsAbstractConditionBean) cb).build(builder).execute().actionGet(searchTimeout);
final EsPagingResultBean<RESULT> list = new EsPagingResultBean<>();
final SearchHits searchHits = response.getHits();
@ -192,20 +195,20 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
}
protected void delegateBulkRequest(final ConditionBean cb, Function<SearchHits, Boolean> handler) {
final SearchRequestBuilder builder =
client.prepareSearch(asEsIndex()).setTypes(asEsIndexType()).setSearchType(SearchType.SCAN).setScroll(scrollForCursor)
.setSize(sizeForCursor);
((EsAbstractConditionBean) cb).request().build(builder);
final SearchResponse response = ((EsAbstractConditionBean) cb).build(builder).execute().actionGet();
String scrollId = response.getScrollId();
while (scrollId != null) {
final SearchResponse scrollResponse = client.prepareSearchScroll(scrollId).setScroll(scrollForDelete).execute().actionGet();
scrollId = scrollResponse.getScrollId();
final SearchHits searchHits = scrollResponse.getHits();
SearchResponse response = null;
while (true) {
if (response == null) {
final SearchRequestBuilder builder =
client.prepareSearch(asEsIndex()).setTypes(asEsIndexType()).setScroll(scrollForCursor).setSize(sizeForCursor);
((EsAbstractConditionBean) cb).request().build(builder);
response = ((EsAbstractConditionBean) cb).build(builder).execute().actionGet(scrollSearchTimeout);
} else {
final String scrollId = response.getScrollId();
response = client.prepareSearchScroll(scrollId).setScroll(scrollForDelete).execute().actionGet(scrollSearchTimeout);
}
final SearchHits searchHits = response.getHits();
final SearchHit[] hits = searchHits.getHits();
if (hits.length == 0) {
scrollId = null;
break;
}
@ -237,7 +240,7 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
final EsAbstractEntity esEntity = (EsAbstractEntity) entity;
IndexRequestBuilder builder = createInsertRequest(esEntity);
final IndexResponse response = builder.execute().actionGet();
final IndexResponse response = builder.execute().actionGet(indexTimeout);
esEntity.asDocMeta().id(response.getId());
return response.isCreated() ? 1 : 0;
}
@ -260,7 +263,7 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
final EsAbstractEntity esEntity = (EsAbstractEntity) entity;
final IndexRequestBuilder builder = createUpdateRequest(esEntity);
final IndexResponse response = builder.execute().actionGet();
final IndexResponse response = builder.execute().actionGet(indexTimeout);
long version = response.getVersion();
if (version != -1) {
esEntity.asDocMeta().version(version);
@ -287,7 +290,7 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
final EsAbstractEntity esEntity = (EsAbstractEntity) entity;
final DeleteRequestBuilder builder = createDeleteRequest(esEntity);
final DeleteResponse response = builder.execute().actionGet();
final DeleteResponse response = builder.execute().actionGet(deleteTimeout);
return response.isFound() ? 1 : 0;
}
@ -302,21 +305,21 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
@Override
protected int delegateQueryDelete(final ConditionBean cb, final DeleteOption<? extends ConditionBean> option) {
final SearchRequestBuilder builder =
client.prepareSearch(asEsIndex()).setTypes(asEsIndexType()).setSearchType(SearchType.SCAN).setScroll(scrollForDelete)
.setSize(sizeForDelete);
((EsAbstractConditionBean) cb).request().build(builder);
final SearchResponse response = ((EsAbstractConditionBean) cb).build(builder).execute().actionGet();
SearchResponse response = null;
int count = 0;
String scrollId = response.getScrollId();
while (scrollId != null) {
final SearchResponse scrollResponse = client.prepareSearchScroll(scrollId).setScroll(scrollForDelete).execute().actionGet();
scrollId = scrollResponse.getScrollId();
final SearchHits searchHits = scrollResponse.getHits();
while (true) {
if (response == null) {
final SearchRequestBuilder builder =
client.prepareSearch(asEsIndex()).setTypes(asEsIndexType()).setScroll(scrollForDelete).setSize(sizeForDelete);
((EsAbstractConditionBean) cb).request().build(builder);
response = ((EsAbstractConditionBean) cb).build(builder).execute().actionGet(scrollSearchTimeout);
} else {
final String scrollId = response.getScrollId();
response = client.prepareSearchScroll(scrollId).setScroll(scrollForDelete).execute().actionGet(scrollSearchTimeout);
}
final SearchHits searchHits = response.getHits();
final SearchHit[] hits = searchHits.getHits();
if (hits.length == 0) {
scrollId = null;
break;
}
@ -325,7 +328,7 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
bulkRequest.add(client.prepareDelete(asEsIndex(), asEsIndexType(), hit.getId()));
}
count += hits.length;
final BulkResponse bulkResponse = bulkRequest.execute().actionGet();
final BulkResponse bulkResponse = bulkRequest.execute().actionGet(bulkTimeout);
if (bulkResponse.hasFailures()) {
throw new IllegalBehaviorStateException(bulkResponse.buildFailureMessage());
}
@ -390,7 +393,7 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
builderCall.callback(bulkBuilder);
}
final BulkResponse response = bulkBuilder.execute().actionGet();
final BulkResponse response = bulkBuilder.execute().actionGet(bulkTimeout);
final BulkItemResponse[] itemResponses = response.getItems();
if (itemResponses.length != entityList.size()) {
throw new IllegalStateException("Invalid response size: " + itemResponses.length + " != " + entityList.size());
@ -419,6 +422,42 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
return true;
}
public void setSizeForDelete(int sizeForDelete) {
this.sizeForDelete = sizeForDelete;
}
public void setScrollForDelete(String scrollForDelete) {
this.scrollForDelete = scrollForDelete;
}
public void setSizeForCursor(int sizeForCursor) {
this.sizeForCursor = sizeForCursor;
}
public void setScrollForCursor(String scrollForCursor) {
this.scrollForCursor = scrollForCursor;
}
public void setSearchTimeout(String searchTimeout) {
this.searchTimeout = searchTimeout;
}
public void setIndexTimeout(String indexTimeout) {
this.indexTimeout = indexTimeout;
}
public void setScrollSearchTimeout(String scrollSearchTimeout) {
this.scrollSearchTimeout = scrollSearchTimeout;
}
public void setBulkTimeout(String bulkTimeout) {
this.bulkTimeout = bulkTimeout;
}
public void setDeleteTimeout(String deleteTimeout) {
this.deleteTimeout = deleteTimeout;
}
// ===================================================================================
// Assist Logic
// ============

View file

@ -92,6 +92,7 @@ public class SearchLog extends BsSearchLog {
final SearchFieldLogBhv searchFieldLogBhv = ComponentUtil.getComponent(SearchFieldLogBhv.class);
searchFieldLogList = searchFieldLogBhv.selectList(cb -> {
cb.query().setSearchLogId_Equal(getId());
cb.fetchFirst(ComponentUtil.getFessConfig().getPageSearchFieldLogMaxFetchSizeAsInteger());
});
}
return searchFieldLogList;

View file

@ -42,14 +42,12 @@ import org.dbflute.util.DfTypeUtil;
import org.elasticsearch.action.bulk.BulkItemResponse;
import org.elasticsearch.action.bulk.BulkRequestBuilder;
import org.elasticsearch.action.bulk.BulkResponse;
import org.elasticsearch.action.count.CountRequestBuilder;
import org.elasticsearch.action.delete.DeleteRequestBuilder;
import org.elasticsearch.action.delete.DeleteResponse;
import org.elasticsearch.action.index.IndexRequestBuilder;
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.search.SearchRequestBuilder;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.search.SearchType;
import org.elasticsearch.action.update.UpdateRequestBuilder;
import org.elasticsearch.client.Client;
import org.elasticsearch.search.SearchHit;
@ -69,6 +67,11 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
protected String scrollForDelete = "1m";
protected int sizeForCursor = 100;
protected String scrollForCursor = "1m";
protected String searchTimeout = "3m";
protected String indexTimeout = "3m";
protected String scrollSearchTimeout = "3m";
protected String bulkTimeout = "3m";
protected String deleteTimeout = "3m";
protected abstract String asEsIndex();
@ -84,8 +87,8 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
@Override
protected int delegateSelectCountUniquely(final ConditionBean cb) {
// #pending check response and cast problem
final CountRequestBuilder builder = client.prepareCount(asEsIndex()).setTypes(asEsSearchType());
return (int) ((EsAbstractConditionBean) cb).build(builder).execute().actionGet().getCount();
final SearchRequestBuilder builder = client.prepareSearch(asEsIndex()).setTypes(asEsSearchType());
return (int) ((EsAbstractConditionBean) cb).build(builder).execute().actionGet(searchTimeout).getHits().getTotalHits();
}
@Override
@ -117,7 +120,7 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
builder.setFrom(from);
builder.setSize(size);
((EsAbstractConditionBean) cb).request().build(builder);
final SearchResponse response = ((EsAbstractConditionBean) cb).build(builder).execute().actionGet();
final SearchResponse response = ((EsAbstractConditionBean) cb).build(builder).execute().actionGet(searchTimeout);
final EsPagingResultBean<RESULT> list = new EsPagingResultBean<>();
final SearchHits searchHits = response.getHits();
@ -192,20 +195,20 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
}
protected void delegateBulkRequest(final ConditionBean cb, Function<SearchHits, Boolean> handler) {
final SearchRequestBuilder builder =
client.prepareSearch(asEsIndex()).setTypes(asEsIndexType()).setSearchType(SearchType.SCAN).setScroll(scrollForCursor)
.setSize(sizeForCursor);
((EsAbstractConditionBean) cb).request().build(builder);
final SearchResponse response = ((EsAbstractConditionBean) cb).build(builder).execute().actionGet();
String scrollId = response.getScrollId();
while (scrollId != null) {
final SearchResponse scrollResponse = client.prepareSearchScroll(scrollId).setScroll(scrollForDelete).execute().actionGet();
scrollId = scrollResponse.getScrollId();
final SearchHits searchHits = scrollResponse.getHits();
SearchResponse response = null;
while (true) {
if (response == null) {
final SearchRequestBuilder builder =
client.prepareSearch(asEsIndex()).setTypes(asEsIndexType()).setScroll(scrollForCursor).setSize(sizeForCursor);
((EsAbstractConditionBean) cb).request().build(builder);
response = ((EsAbstractConditionBean) cb).build(builder).execute().actionGet(scrollSearchTimeout);
} else {
final String scrollId = response.getScrollId();
response = client.prepareSearchScroll(scrollId).setScroll(scrollForDelete).execute().actionGet(scrollSearchTimeout);
}
final SearchHits searchHits = response.getHits();
final SearchHit[] hits = searchHits.getHits();
if (hits.length == 0) {
scrollId = null;
break;
}
@ -237,7 +240,7 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
final EsAbstractEntity esEntity = (EsAbstractEntity) entity;
IndexRequestBuilder builder = createInsertRequest(esEntity);
final IndexResponse response = builder.execute().actionGet();
final IndexResponse response = builder.execute().actionGet(indexTimeout);
esEntity.asDocMeta().id(response.getId());
return response.isCreated() ? 1 : 0;
}
@ -260,7 +263,7 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
final EsAbstractEntity esEntity = (EsAbstractEntity) entity;
final IndexRequestBuilder builder = createUpdateRequest(esEntity);
final IndexResponse response = builder.execute().actionGet();
final IndexResponse response = builder.execute().actionGet(indexTimeout);
long version = response.getVersion();
if (version != -1) {
esEntity.asDocMeta().version(version);
@ -287,7 +290,7 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
final EsAbstractEntity esEntity = (EsAbstractEntity) entity;
final DeleteRequestBuilder builder = createDeleteRequest(esEntity);
final DeleteResponse response = builder.execute().actionGet();
final DeleteResponse response = builder.execute().actionGet(deleteTimeout);
return response.isFound() ? 1 : 0;
}
@ -302,21 +305,21 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
@Override
protected int delegateQueryDelete(final ConditionBean cb, final DeleteOption<? extends ConditionBean> option) {
final SearchRequestBuilder builder =
client.prepareSearch(asEsIndex()).setTypes(asEsIndexType()).setSearchType(SearchType.SCAN).setScroll(scrollForDelete)
.setSize(sizeForDelete);
((EsAbstractConditionBean) cb).request().build(builder);
final SearchResponse response = ((EsAbstractConditionBean) cb).build(builder).execute().actionGet();
SearchResponse response = null;
int count = 0;
String scrollId = response.getScrollId();
while (scrollId != null) {
final SearchResponse scrollResponse = client.prepareSearchScroll(scrollId).setScroll(scrollForDelete).execute().actionGet();
scrollId = scrollResponse.getScrollId();
final SearchHits searchHits = scrollResponse.getHits();
while (true) {
if (response == null) {
final SearchRequestBuilder builder =
client.prepareSearch(asEsIndex()).setTypes(asEsIndexType()).setScroll(scrollForDelete).setSize(sizeForDelete);
((EsAbstractConditionBean) cb).request().build(builder);
response = ((EsAbstractConditionBean) cb).build(builder).execute().actionGet(scrollSearchTimeout);
} else {
final String scrollId = response.getScrollId();
response = client.prepareSearchScroll(scrollId).setScroll(scrollForDelete).execute().actionGet(scrollSearchTimeout);
}
final SearchHits searchHits = response.getHits();
final SearchHit[] hits = searchHits.getHits();
if (hits.length == 0) {
scrollId = null;
break;
}
@ -325,7 +328,7 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
bulkRequest.add(client.prepareDelete(asEsIndex(), asEsIndexType(), hit.getId()));
}
count += hits.length;
final BulkResponse bulkResponse = bulkRequest.execute().actionGet();
final BulkResponse bulkResponse = bulkRequest.execute().actionGet(bulkTimeout);
if (bulkResponse.hasFailures()) {
throw new IllegalBehaviorStateException(bulkResponse.buildFailureMessage());
}
@ -390,7 +393,7 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
builderCall.callback(bulkBuilder);
}
final BulkResponse response = bulkBuilder.execute().actionGet();
final BulkResponse response = bulkBuilder.execute().actionGet(bulkTimeout);
final BulkItemResponse[] itemResponses = response.getItems();
if (itemResponses.length != entityList.size()) {
throw new IllegalStateException("Invalid response size: " + itemResponses.length + " != " + entityList.size());
@ -419,6 +422,42 @@ public abstract class EsAbstractBehavior<ENTITY extends Entity, CB extends Condi
return true;
}
public void setSizeForDelete(int sizeForDelete) {
this.sizeForDelete = sizeForDelete;
}
public void setScrollForDelete(String scrollForDelete) {
this.scrollForDelete = scrollForDelete;
}
public void setSizeForCursor(int sizeForCursor) {
this.sizeForCursor = sizeForCursor;
}
public void setScrollForCursor(String scrollForCursor) {
this.scrollForCursor = scrollForCursor;
}
public void setSearchTimeout(String searchTimeout) {
this.searchTimeout = searchTimeout;
}
public void setIndexTimeout(String indexTimeout) {
this.indexTimeout = indexTimeout;
}
public void setScrollSearchTimeout(String scrollSearchTimeout) {
this.scrollSearchTimeout = scrollSearchTimeout;
}
public void setBulkTimeout(String bulkTimeout) {
this.bulkTimeout = bulkTimeout;
}
public void setDeleteTimeout(String deleteTimeout) {
this.deleteTimeout = deleteTimeout;
}
// ===================================================================================
// Assist Logic
// ============

View file

@ -18,6 +18,7 @@ package org.codelibs.fess.exec;
import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.lang.management.ManagementFactory;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
@ -140,6 +141,13 @@ public class Crawler implements Serializable {
return idList;
}
@Override
public String toString() {
return "Options [sessionId=" + sessionId + ", name=" + name + ", webConfigIds=" + webConfigIds + ", fileConfigIds="
+ fileConfigIds + ", dataConfigIds=" + dataConfigIds + ", propertiesPath=" + propertiesPath + ", expires=" + expires
+ "]";
}
}
public static void main(final String[] args) {
@ -155,6 +163,17 @@ public class Crawler implements Serializable {
return;
}
if (logger.isDebugEnabled()) {
try {
ManagementFactory.getRuntimeMXBean().getInputArguments().stream().forEach(s -> logger.debug("Parameter: " + s));
System.getProperties().entrySet().stream().forEach(e -> logger.debug("Property: " + e.getKey() + "=" + e.getValue()));
System.getenv().entrySet().forEach(e -> logger.debug("Env: " + e.getKey() + "=" + e.getValue()));
logger.debug("Option: " + options);
} catch (Exception e) {
// ignore
}
}
final String transportAddresses = System.getProperty(Constants.FESS_ES_TRANSPORT_ADDRESSES);
if (StringUtil.isNotBlank(transportAddresses)) {
System.setProperty(EsClient.TRANSPORT_ADDRESSES, transportAddresses);

View file

@ -18,6 +18,7 @@ package org.codelibs.fess.exec;
import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.lang.management.ManagementFactory;
import java.time.LocalDateTime;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;
@ -60,6 +61,11 @@ public class SuggestCreator implements Serializable {
protected Options() {
// noghing
}
@Override
public String toString() {
return "Options [sessionId=" + sessionId + ", name=" + name + ", propertiesPath=" + propertiesPath + "]";
}
}
public static void main(final String[] args) {
@ -75,6 +81,17 @@ public class SuggestCreator implements Serializable {
return;
}
if (logger.isDebugEnabled()) {
try {
ManagementFactory.getRuntimeMXBean().getInputArguments().stream().forEach(s -> logger.debug("Parameter: " + s));
System.getProperties().entrySet().stream().forEach(e -> logger.debug("Property: " + e.getKey() + "=" + e.getValue()));
System.getenv().entrySet().forEach(e -> logger.debug("Env: " + e.getKey() + "=" + e.getValue()));
logger.debug("Option: " + options);
} catch (Exception e) {
// ignore
}
}
final String transportAddresses = System.getProperty(Constants.FESS_ES_TRANSPORT_ADDRESSES);
if (StringUtil.isNotBlank(transportAddresses)) {
System.setProperty(EsClient.TRANSPORT_ADDRESSES, transportAddresses);

View file

@ -142,7 +142,7 @@ public class IndexingHelper {
final CountResponse countResponse =
fessEsClient.prepareCount(fessConfig.getIndexDocumentSearchIndex()).setTypes(fessConfig.getIndexDocumentType())
.setQuery(queryBuilder).execute().actionGet();
.setQuery(queryBuilder).execute().actionGet(fessConfig.getIndexSearchTimeout());
final long numFound = countResponse.getCount();
// TODO max threshold

View file

@ -27,6 +27,7 @@ import javax.annotation.PostConstruct;
import org.codelibs.fess.Constants;
import org.codelibs.fess.es.config.exbhv.PathMappingBhv;
import org.codelibs.fess.es.config.exentity.PathMapping;
import org.codelibs.fess.util.ComponentUtil;
import org.lastaflute.di.core.SingletonLaContainer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -52,6 +53,7 @@ public class PathMappingHelper implements Serializable {
cachedPathMappingList = pathMappingBhv.selectList(cb -> {
cb.query().addOrderBy_SortOrder_Asc();
cb.query().setProcessType_InScope(ptList);
cb.fetchFirst(ComponentUtil.getFessConfig().getPagePathMappingMaxFetchSizeAsInteger());
});
} catch (final Exception e) {
logger.warn("Failed to load path mappings.", e);

View file

@ -54,7 +54,6 @@ import org.codelibs.fess.entity.QueryContext;
import org.codelibs.fess.exception.InvalidQueryException;
import org.codelibs.fess.mylasta.direction.FessConfig;
import org.codelibs.fess.util.StreamUtil;
import org.dbflute.optional.OptionalEntity;
import org.dbflute.optional.OptionalThing;
import org.elasticsearch.common.unit.Fuzziness;
import org.elasticsearch.index.query.BoolQueryBuilder;
@ -70,6 +69,8 @@ import org.lastaflute.web.util.LaRequestUtil;
public class QueryHelper implements Serializable {
protected static final String SCORE_SORT_VALUE = "score";
protected static final long serialVersionUID = 1L;
protected static final String SCORE_FIELD = "score";
@ -183,7 +184,7 @@ public class QueryHelper implements Serializable {
}
if (supportedSortFields == null) {
supportedSortFields =
new String[] { fessConfig.getIndexFieldCreated(), fessConfig.getIndexFieldContentLength(),
new String[] { SCORE_SORT_VALUE, fessConfig.getIndexFieldCreated(), fessConfig.getIndexFieldContentLength(),
fessConfig.getIndexFieldLastModified(), fessConfig.getIndexFieldTimestamp(),
fessConfig.getIndexFieldClickCount(), fessConfig.getIndexFieldFavoriteCount() };
}
@ -307,7 +308,8 @@ public class QueryHelper implements Serializable {
final String field = wildcardQuery.getField();
if (Constants.DEFAULT_FIELD.equals(field)) {
context.addFieldLog(field, wildcardQuery.getTerm().text());
return buildDefaultQueryBuilder((f, b) -> QueryBuilders.wildcardQuery(f, wildcardQuery.getTerm().text()).boost(b));
return buildDefaultQueryBuilder((f, b) -> QueryBuilders.wildcardQuery(f, wildcardQuery.getTerm().text()).boost(
b * wildcardQuery.getBoost()));
} else if (isSearchField(field)) {
context.addFieldLog(field, wildcardQuery.getTerm().text());
return QueryBuilders.wildcardQuery(field, wildcardQuery.getTerm().text()).boost(wildcardQuery.getBoost());
@ -315,7 +317,7 @@ public class QueryHelper implements Serializable {
final String origQuery = wildcardQuery.getTerm().toString();
context.addFieldLog(Constants.DEFAULT_FIELD, origQuery);
context.addHighlightedQuery(origQuery);
return buildDefaultQueryBuilder((f, b) -> QueryBuilders.wildcardQuery(f, origQuery).boost(b));
return buildDefaultQueryBuilder((f, b) -> QueryBuilders.wildcardQuery(f, origQuery).boost(b * wildcardQuery.getBoost()));
}
}
@ -323,7 +325,8 @@ public class QueryHelper implements Serializable {
final String field = prefixQuery.getField();
if (Constants.DEFAULT_FIELD.equals(field)) {
context.addFieldLog(field, prefixQuery.getPrefix().text());
return buildDefaultQueryBuilder((f, b) -> QueryBuilders.prefixQuery(f, prefixQuery.getPrefix().text()).boost(b));
return buildDefaultQueryBuilder((f, b) -> QueryBuilders.prefixQuery(f, prefixQuery.getPrefix().text()).boost(
b * prefixQuery.getBoost()));
} else if (isSearchField(field)) {
context.addFieldLog(field, prefixQuery.getPrefix().text());
return QueryBuilders.prefixQuery(field, prefixQuery.getPrefix().text()).boost(prefixQuery.getBoost());
@ -331,7 +334,7 @@ public class QueryHelper implements Serializable {
final String origQuery = prefixQuery.getPrefix().toString();
context.addFieldLog(Constants.DEFAULT_FIELD, origQuery);
context.addHighlightedQuery(origQuery);
return buildDefaultQueryBuilder((f, b) -> QueryBuilders.prefixQuery(f, origQuery).boost(b));
return buildDefaultQueryBuilder((f, b) -> QueryBuilders.prefixQuery(f, origQuery).boost(b * prefixQuery.getBoost()));
}
}
@ -342,7 +345,7 @@ public class QueryHelper implements Serializable {
if (Constants.DEFAULT_FIELD.equals(field)) {
context.addFieldLog(field, term.text());
return buildDefaultQueryBuilder((f, b) -> QueryBuilders.fuzzyQuery(f, term.text())
.fuzziness(Fuzziness.fromEdits(fuzzyQuery.getMaxEdits())).boost(b));
.fuzziness(Fuzziness.fromEdits(fuzzyQuery.getMaxEdits())).boost(b * fuzzyQuery.getBoost()));
} else if (isSearchField(field)) {
context.addFieldLog(field, term.text());
return QueryBuilders.fuzzyQuery(field, term.text()).boost(fuzzyQuery.getBoost())
@ -352,7 +355,7 @@ public class QueryHelper implements Serializable {
context.addFieldLog(Constants.DEFAULT_FIELD, origQuery);
context.addHighlightedQuery(origQuery);
return buildDefaultQueryBuilder((f, b) -> QueryBuilders.fuzzyQuery(f, origQuery)
.fuzziness(Fuzziness.fromEdits(fuzzyQuery.getMaxEdits())).boost(b));
.fuzziness(Fuzziness.fromEdits(fuzzyQuery.getMaxEdits())).boost(b * fuzzyQuery.getBoost()));
}
}
@ -395,7 +398,7 @@ public class QueryHelper implements Serializable {
} else if (Constants.DEFAULT_FIELD.equals(field)) {
context.addFieldLog(field, text);
context.addHighlightedQuery(text);
return buildDefaultQueryBuilder((f, b) -> QueryBuilders.matchPhraseQuery(f, text).boost(b));
return buildDefaultQueryBuilder((f, b) -> QueryBuilders.matchPhraseQuery(f, text).boost(b * termQuery.getBoost()));
} else if ("sort".equals(field)) {
final String[] values = text.split("\\.");
if (values.length > 2) {
@ -418,10 +421,10 @@ public class QueryHelper implements Serializable {
} else {
sortOrder = SortOrder.ASC;
}
context.addSorts(SortBuilders.fieldSort(sortField).order(sortOrder));
context.addSorts(SortBuilders.fieldSort(SCORE_SORT_VALUE.equals(sortField) ? "_score" : sortField).order(sortOrder));
return null;
} else if (INURL_FIELD.equals(field)) {
return QueryBuilders.wildcardQuery(field, text).boost(termQuery.getBoost());
return QueryBuilders.wildcardQuery(fessConfig.getIndexFieldUrl(), "*" + text + "*").boost(termQuery.getBoost());
} else if (isSearchField(field)) {
context.addFieldLog(field, text);
context.addHighlightedQuery(text);
@ -430,7 +433,7 @@ public class QueryHelper implements Serializable {
final String origQuery = termQuery.toString();
context.addFieldLog(Constants.DEFAULT_FIELD, origQuery);
context.addHighlightedQuery(origQuery);
return buildDefaultQueryBuilder((f, b) -> QueryBuilders.matchPhraseQuery(f, origQuery).boost(b));
return buildDefaultQueryBuilder((f, b) -> QueryBuilders.matchPhraseQuery(f, origQuery).boost(b * termQuery.getBoost()));
}
}
@ -445,7 +448,7 @@ public class QueryHelper implements Serializable {
final String text = String.join(" ", texts);
context.addFieldLog(field, text);
StreamUtil.of(texts).forEach(t -> context.addHighlightedQuery(t));
return buildDefaultQueryBuilder((f, b) -> QueryBuilders.matchPhraseQuery(f, text).boost(b));
return buildDefaultQueryBuilder((f, b) -> QueryBuilders.matchPhraseQuery(f, text).boost(b * query.getBoost()));
}
private boolean isSearchField(final String field) {
@ -465,16 +468,19 @@ public class QueryHelper implements Serializable {
final QueryBuilder contentQuery =
builder.apply(fessConfig.getIndexFieldContent(), fessConfig.getQueryBoostContentAsDecimal().floatValue());
boolQuery.should(contentQuery);
getQueryLanguage().ifPresent(
lang -> {
final QueryBuilder titleLangQuery =
builder.apply(fessConfig.getIndexFieldTitle() + "_" + lang, fessConfig.getQueryBoostTitleLangAsDecimal()
.floatValue());
boolQuery.should(titleLangQuery);
final QueryBuilder contentLangQuery =
builder.apply(fessConfig.getIndexFieldContent() + "_" + lang, fessConfig.getQueryBoostContentLangAsDecimal()
.floatValue());
boolQuery.should(contentLangQuery);
getQueryLanguages().ifPresent(
langs -> {
StreamUtil.of(langs).forEach(
lang -> {
final QueryBuilder titleLangQuery =
builder.apply(fessConfig.getIndexFieldTitle() + "_" + lang, fessConfig
.getQueryBoostTitleLangAsDecimal().floatValue());
boolQuery.should(titleLangQuery);
final QueryBuilder contentLangQuery =
builder.apply(fessConfig.getIndexFieldContent() + "_" + lang, fessConfig
.getQueryBoostContentLangAsDecimal().floatValue());
boolQuery.should(contentLangQuery);
});
});
return boolQuery;
}
@ -483,12 +489,10 @@ public class QueryHelper implements Serializable {
QueryBuilder apply(String field, float boost);
}
protected OptionalThing<String> getQueryLanguage() {
if (StringUtil.isNotBlank(fessConfig.getQueryDefaultLanguage())) {
return OptionalEntity.of(fessConfig.getQueryDefaultLanguage());
}
return LaRequestUtil.getOptionalRequest().map(request -> fessConfig.getQueryLanguage(request.getLocale()));
protected OptionalThing<String[]> getQueryLanguages() {
return LaRequestUtil.getOptionalRequest()
.map(request -> fessConfig.getQueryLanguages(request.getLocales(),
(String[]) request.getAttribute(Constants.REQUEST_LANGUAGES)));
}
private boolean isSortField(final String field) {

View file

@ -221,6 +221,7 @@ public class SearchLogHelper {
final UserInfoBhv userInfoBhv = SingletonLaContainer.getComponent(UserInfoBhv.class);
userInfoBhv.selectList(cb -> {
cb.query().setId_InScope(userInfoMap.keySet());
cb.fetchFirst(userInfoMap.size());
}).forEach(userInfo -> {
final String code = userInfo.getId();
final UserInfo entity = userInfoMap.get(code);

View file

@ -88,7 +88,7 @@ public class SuggestHelper {
roleFilterList.add(Pattern.compile(filter));
});
fessEsClient.admin().cluster().prepareHealth().setWaitForYellowStatus().execute().actionGet();
fessEsClient.admin().cluster().prepareHealth().setWaitForYellowStatus().execute().actionGet(fessConfig.getIndexHealthTimeout());
suggester = Suggester.builder().build(fessEsClient, fessConfig.getIndexDocumentSearchIndex());
suggester.settings().array().delete(SuggestSettings.DefaultKeys.SUPPORTED_FIELDS);
@ -188,6 +188,7 @@ public class SuggestHelper {
final List<ElevateWord> list = elevateWordBhv.selectList(cb -> {
cb.query().matchAll();
cb.fetchFirst(ComponentUtil.getFessConfig().getPageElevateWordMaxFetchSizeAsInteger());
});
for (final ElevateWord elevateWord : list) {
@ -200,6 +201,7 @@ public class SuggestHelper {
public void deleteAllElevateWord() {
final List<ElevateWord> list = elevateWordBhv.selectList(cb -> {
cb.query().matchAll();
cb.fetchFirst(ComponentUtil.getFessConfig().getPageElevateWordMaxFetchSizeAsInteger());
});
for (final ElevateWord elevateWord : list) {
@ -244,6 +246,7 @@ public class SuggestHelper {
deleteAllBadWords();
final List<BadWord> list = badWordBhv.selectList(cb -> {
cb.query().matchAll();
cb.fetchFirst(ComponentUtil.getFessConfig().getPageBadWordMaxFetchSizeAsInteger());
});
for (final BadWord badWord : list) {
final String word = badWord.getSuggestWord();

View file

@ -33,9 +33,9 @@ import org.codelibs.fess.app.service.WebConfigService;
import org.codelibs.fess.crawler.Crawler;
import org.codelibs.fess.crawler.CrawlerContext;
import org.codelibs.fess.crawler.interval.FessIntervalController;
import org.codelibs.fess.crawler.service.DataService;
import org.codelibs.fess.crawler.service.UrlFilterService;
import org.codelibs.fess.crawler.service.UrlQueueService;
import org.codelibs.fess.crawler.service.impl.EsDataService;
import org.codelibs.fess.crawler.service.impl.EsUrlFilterService;
import org.codelibs.fess.crawler.service.impl.EsUrlQueueService;
import org.codelibs.fess.es.config.exentity.FileConfig;
import org.codelibs.fess.es.config.exentity.WebConfig;
import org.codelibs.fess.indexer.IndexUpdater;
@ -469,23 +469,35 @@ public class WebFsIndexHelper implements Serializable {
crawlingInfoHelper.putToInfoMap(Constants.WEB_FS_INDEX_EXEC_TIME, Long.toString(indexUpdater.getExecuteTime()));
crawlingInfoHelper.putToInfoMap(Constants.WEB_FS_INDEX_SIZE, Long.toString(indexUpdater.getDocumentSize()));
final EsUrlFilterService urlFilterService = SingletonLaContainer.getComponent(EsUrlFilterService.class);
final EsUrlQueueService urlQueueService = SingletonLaContainer.getComponent(EsUrlQueueService.class);
final EsDataService dataService = SingletonLaContainer.getComponent(EsDataService.class);
for (final String sid : sessionIdList) {
// remove config
crawlingConfigHelper.remove(sid);
try {
// clear url filter
urlFilterService.delete(sid);
} catch (Exception e) {
logger.warn("Failed to delete UrlFilter for " + sid, e);
}
try {
// clear queue
urlQueueService.clearCache();
urlQueueService.delete(sid);
} catch (Exception e) {
logger.warn("Failed to delete UrlQueue for " + sid, e);
}
try {
// clear
dataService.delete(sid);
} catch (Exception e) {
logger.warn("Failed to delete AccessResult for " + sid, e);
}
}
// clear url filter
final UrlFilterService urlFilterService = SingletonLaContainer.getComponent(UrlFilterService.class);
urlFilterService.deleteAll();
// clear queue
final UrlQueueService urlQueueService = SingletonLaContainer.getComponent(UrlQueueService.class);
urlQueueService.deleteAll();
// clear
final DataService dataService = SingletonLaContainer.getComponent(DataService.class);
dataService.deleteAll();
}
}

View file

@ -93,8 +93,6 @@ public class IndexUpdater extends Thread {
protected int maxErrorCount = 2;
protected int unprocessedDocumentSize = 100;
protected List<String> finishedSessionIdList = new ArrayList<>();
private final List<DocBoostMatcher> docBoostMatcherList = new ArrayList<>();
@ -181,7 +179,7 @@ public class IndexUpdater extends Thread {
if (interval > 0) {
// sleep
try {
Thread.sleep(interval); // 1 min (default)
Thread.sleep(interval); // 10 sec (default)
} catch (final InterruptedException e) {
logger.warn("Interrupted index update.", e);
}
@ -206,15 +204,9 @@ public class IndexUpdater extends Thread {
}
while (!arList.isEmpty()) {
processAccessResults(docList, accessResultList, arList);
cleanupAccessResults(accessResultList);
if (logger.isDebugEnabled()) {
logger.debug("Getting documents in IndexUpdater queue.");
}
arList = getAccessResultList(cb);
}
if (!docList.isEmpty()) {
indexingHelper.sendDocuments(fessEsClient, docList);
}
@ -445,10 +437,13 @@ public class IndexUpdater extends Thread {
}
private List<EsAccessResult> getAccessResultList(final Consumer<SearchRequestBuilder> cb) {
if (logger.isDebugEnabled()) {
logger.debug("Getting documents in IndexUpdater queue.");
}
final long execTime = System.currentTimeMillis();
final List<EsAccessResult> arList = ((EsDataService) dataService).getAccessResultList(cb);
final FessConfig fessConfig = ComponentUtil.getFessConfig();
if (!arList.isEmpty()) {
final FessConfig fessConfig = ComponentUtil.getFessConfig();
final long commitMarginTime = fessConfig.getIndexerWebfsCommitMarginTimeAsInteger().longValue();
for (final AccessResult<?> ar : arList.toArray(new AccessResult[arList.size()])) {
if (ar.getCreateTime().longValue() > execTime - commitMarginTime) {
@ -460,6 +455,7 @@ public class IndexUpdater extends Thread {
if (logger.isInfoEnabled()) {
logger.info("Processing " + arList.size() + "/" + totalHits + " docs (" + (System.currentTimeMillis() - execTime) + "ms)");
}
final long unprocessedDocumentSize = fessConfig.getIndexerUnprocessedDocumentSizeAsInteger().longValue();
if (totalHits > unprocessedDocumentSize) {
if (logger.isInfoEnabled()) {
logger.info("Stopped all crawler threads. " + " You have " + totalHits + " (>" + unprocessedDocumentSize + ") "
@ -532,10 +528,6 @@ public class IndexUpdater extends Thread {
this.maxIndexerErrorCount = maxIndexerErrorCount;
}
public void setUnprocessedDocumentSize(final int unprocessedDocumentSize) {
this.unprocessedDocumentSize = unprocessedDocumentSize;
}
public void addDocBoostMatcher(final DocBoostMatcher rule) {
docBoostMatcherList.add(rule);
}

View file

@ -70,7 +70,7 @@ public class CrawlJob {
protected long retryIntervalToDeleteTempDir = 5000;
protected boolean useLocaleElasticsearch = true;
protected boolean useLocalElasticsearch = true;
public CrawlJob jobExecutor(final JobExecutor jobExecutor) {
this.jobExecutor = jobExecutor;
@ -129,7 +129,7 @@ public class CrawlJob {
}
public CrawlJob useLocaleElasticsearch(final boolean useLocaleElasticsearch) {
this.useLocaleElasticsearch = useLocaleElasticsearch;
this.useLocalElasticsearch = useLocaleElasticsearch;
return this;
}
@ -274,7 +274,7 @@ public class CrawlJob {
}
cmdList.add(buf.toString());
if (useLocaleElasticsearch) {
if (useLocalElasticsearch) {
final String transportAddresses = System.getProperty(Constants.FESS_ES_TRANSPORT_ADDRESSES);
if (StringUtil.isNotBlank(transportAddresses)) {
cmdList.add("-D" + Constants.FESS_ES_TRANSPORT_ADDRESSES + "=" + transportAddresses);

View file

@ -328,9 +328,36 @@ public class LdapManager {
}
final Supplier<Hashtable<String, String>> adminEnv = () -> createAdminEnv();
final String userDN = fessConfig.getLdapAdminUserSecurityPrincipal(user.getName());
StreamUtil.of(user.getGroupNames()).forEach(name -> {
search(fessConfig.getLdapAdminGroupBaseDn(), fessConfig.getLdapAdminGroupFilter(name), null, adminEnv, subResult -> {
if (!subResult.hasMore()) {
final Group group = new Group();
group.setName(name);
insert(group);
}
final List<ModificationItem> modifyList = new ArrayList<>();
modifyDeleteEntry(modifyList, "member", userDN);
modify(fessConfig.getLdapAdminGroupSecurityPrincipal(name), modifyList, adminEnv);
});
});
StreamUtil.of(user.getRoleNames()).forEach(name -> {
search(fessConfig.getLdapAdminRoleBaseDn(), fessConfig.getLdapAdminRoleFilter(name), null, adminEnv, subResult -> {
if (!subResult.hasMore()) {
final Role role = new Role();
role.setName(name);
insert(role);
}
final List<ModificationItem> modifyList = new ArrayList<>();
modifyDeleteEntry(modifyList, "member", userDN);
modify(fessConfig.getLdapAdminRoleSecurityPrincipal(name), modifyList, adminEnv);
});
});
search(fessConfig.getLdapAdminUserBaseDn(), fessConfig.getLdapAdminUserFilter(user.getName()), null, adminEnv, result -> {
if (result.hasMore()) {
delete(fessConfig.getLdapAdminUserSecurityPrincipal(user.getName()), adminEnv);
delete(userDN, adminEnv);
} else {
logger.info("{} does not exist in LDAP server.", user.getName());
}

View file

@ -257,6 +257,9 @@ public class FessLabels extends ActionMessages {
/** The key of the message: Start Pos */
public static final String LABELS_START = "{labels.start}";
/** The key of the message: Login Required */
public static final String LABELS_LOGIN_REQUIRED = "{labels.loginRequired}";
/** The key of the message: Thread Name */
public static final String LABELS_THREAD_NAME = "{labels.threadName}";
@ -380,6 +383,9 @@ public class FessLabels extends ActionMessages {
/** The key of the message: Geo */
public static final String LABELS_GEO = "{labels.geo}";
/** The key of the message: Groups */
public static final String LABELS_GROUPS = "{labels.groups}";
/** The key of the message: Hash */
public static final String LABELS_HASH = "{labels.hash}";
@ -398,6 +404,9 @@ public class FessLabels extends ActionMessages {
/** The key of the message: Query */
public static final String LABELS_Q = "{labels.q}";
/** The key of the message: Roles */
public static final String LABELS_ROLES = "{labels.roles}";
/** The key of the message: Suggest Search Log */
public static final String LABELS_SUGGEST_SEARCH_LOG = "{labels.suggestSearchLog}";
@ -434,9 +443,6 @@ public class FessLabels extends ActionMessages {
/** The key of the message: Account Filter */
public static final String LABELS_LDAP_ACCOUNT_FILTER = "{labels.ldapAccountFilter}";
/** The key of the message: Login Required */
public static final String LABELS_LOGIN_REQUIRED = "{labels.loginRequired}";
/** The key of the message: Current Password */
public static final String LABELS_OLD_PASSWORD = "{labels.oldPassword}";
@ -587,6 +593,9 @@ public class FessLabels extends ActionMessages {
/** The key of the message: -- Results per page -- */
public static final String LABELS_search_result_select_num = "{labels.search_result_select_num}";
/** The key of the message: Score */
public static final String LABELS_search_result_sort_score_desc = "{labels.search_result_sort_score_desc}";
/** The key of the message: Date (ascending) */
public static final String LABELS_search_result_sort_created_asc = "{labels.search_result_sort_created_asc}";
@ -617,6 +626,9 @@ public class FessLabels extends ActionMessages {
/** The key of the message: Favorite (descending) */
public static final String LABELS_search_result_sort_favorite_count_desc = "{labels.search_result_sort_favorite_count_desc}";
/** The key of the message: Multiple */
public static final String LABELS_search_result_sort_multiple = "{labels.search_result_sort_multiple}";
/** The key of the message: {0} bytes */
public static final String LABELS_search_result_size = "{labels.search_result_size}";
@ -743,6 +755,9 @@ public class FessLabels extends ActionMessages {
/** The key of the message: Check the url. */
public static final String LABELS_check_url = "{labels.check_url}";
/** The key of the message: Username */
public static final String LABELS_user_name = "{labels.user_name}";
/** The key of the message: Login */
public static final String LABELS_LOGIN = "{labels.login}";
@ -878,6 +893,12 @@ public class FessLabels extends ActionMessages {
/** The key of the message: ms */
public static final String LABELS_MILLISEC = "{labels.millisec}";
/** The key of the message: Role */
public static final String LABELS_role_type = "{labels.role_type}";
/** The key of the message: Label */
public static final String LABELS_label_type = "{labels.label_type}";
/** The key of the message: Create */
public static final String LABELS_file_crawling_button_create = "{labels.file_crawling_button_create}";
@ -956,6 +977,9 @@ public class FessLabels extends ActionMessages {
/** The key of the message: Default Label Value */
public static final String LABELS_default_label_value = "{labels.default_label_value}";
/** The key of the message: Default Sort Value */
public static final String LABELS_default_sort_value = "{labels.default_sort_value}";
/** The key of the message: Append Params to URL */
public static final String LABELS_append_query_param_enabled = "{labels.append_query_param_enabled}";
@ -1370,12 +1394,6 @@ public class FessLabels extends ActionMessages {
/** The key of the message: Script */
public static final String LABELS_handler_script = "{labels.handler_script}";
/** The key of the message: Role */
public static final String LABELS_role_type = "{labels.role_type}";
/** The key of the message: Label */
public static final String LABELS_label_type = "{labels.label_type}";
/** The key of the message: Create */
public static final String LABELS_data_crawling_button_create = "{labels.data_crawling_button_create}";
@ -1460,6 +1478,9 @@ public class FessLabels extends ActionMessages {
/** The key of the message: Type */
public static final String LABELS_failure_url_search_error_name = "{labels.failure_url_search_error_name}";
/** The key of the message: URL */
public static final String LABELS_failure_url_url = "{labels.failure_url_url}";
/** The key of the message: Last Access */
public static final String LABELS_failure_url_last_access_time = "{labels.failure_url_last_access_time}";
@ -1499,9 +1520,6 @@ public class FessLabels extends ActionMessages {
/** The key of the message: Log */
public static final String LABELS_failure_url_error_log = "{labels.failure_url_error_log}";
/** The key of the message: URL */
public static final String LABELS_failure_url_url = "{labels.failure_url_url}";
/** The key of the message: Web Crawling Configuration */
public static final String LABELS_failure_url_web_config_name = "{labels.failure_url_web_config_name}";
@ -1902,9 +1920,6 @@ public class FessLabels extends ActionMessages {
/** The key of the message: Name */
public static final String LABELS_user_list_name = "{labels.user_list_name}";
/** The key of the message: Name */
public static final String LABELS_user_name = "{labels.user_name}";
/** The key of the message: Password */
public static final String LABELS_user_password = "{labels.user_password}";
@ -1941,12 +1956,6 @@ public class FessLabels extends ActionMessages {
/** The key of the message: Group */
public static final String LABELS_group_title_details = "{labels.group_title_details}";
/** The key of the message: Roles */
public static final String LABELS_ROLES = "{labels.roles}";
/** The key of the message: Groups */
public static final String LABELS_GROUPS = "{labels.groups}";
/** The key of the message: Create */
public static final String LABELS_crud_button_create = "{labels.crud_button_create}";
@ -2028,6 +2037,9 @@ public class FessLabels extends ActionMessages {
/** The key of the message: LDAP */
public static final String LABELS_general_menu_ldap = "{labels.general_menu_ldap}";
/** The key of the message: Notification */
public static final String LABELS_general_menu_notification = "{labels.general_menu_notification}";
/** The key of the message: LDAP URL */
public static final String LABELS_ldap_provider_url = "{labels.ldap_provider_url}";
@ -2046,9 +2058,6 @@ public class FessLabels extends ActionMessages {
/** The key of the message: Search top page */
public static final String LABELS_notification_search_top = "{labels.notification_search_top}";
/** The key of the message: Notification */
public static final String LABELS_general_menu_notification = "{labels.general_menu_notification}";
/** The key of the message: Send TestMail */
public static final String LABELS_send_testmail = "{labels.send_testmail}";

View file

@ -63,7 +63,11 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
-XX:CMSInitiatingOccupancyFraction=75
-XX:+UseParNewGC
-XX:+UseTLAB
-XX:+DisableExplicitGC */
-XX:+DisableExplicitGC
-Djcifs.smb.client.connTimeout=60000
-Djcifs.smb.client.soTimeout=35000
-Djcifs.smb.client.responseTimeout=30000
*/
String JVM_SUGGEST_OPTIONS = "jvm.suggest.options";
/** The key of the configuration. e.g. default_crawler */
@ -200,19 +204,22 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
/** The key of the configuration. e.g. true */
String INDEXER_THREAD_DUMP_ENABLED = "indexer.thread.dump.enabled";
/** The key of the configuration. e.g. 1000 */
String INDEXER_UNPROCESSED_DOCUMENT_SIZE = "indexer.unprocessed.document.size";
/** The key of the configuration. e.g. true */
String INDEXER_CLICK_COUNT_ENABLED = "indexer.click.count.enabled";
/** The key of the configuration. e.g. true */
String INDEXER_FAVORITE_COUNT_ENABLED = "indexer.favorite.count.enabled";
/** The key of the configuration. e.g. 10000 */
/** The key of the configuration. e.g. 1000 */
String INDEXER_WEBFS_COMMIT_MARGIN_TIME = "indexer.webfs.commit.margin.time";
/** The key of the configuration. e.g. 60 */
String INDEXER_WEBFS_MAX_EMPTY_LIST_CONUNT = "indexer.webfs.max.empty.list.conunt";
/** The key of the configuration. e.g. 60000 */
/** The key of the configuration. e.g. 10000 */
String INDEXER_WEBFS_UPDATE_INTERVAL = "indexer.webfs.update.interval";
/** The key of the configuration. e.g. 5 */
@ -311,6 +318,27 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
/** The key of the configuration. e.g. doc */
String INDEX_DOCUMENT_TYPE = "index.document.type";
/** The key of the configuration. e.g. 3m */
String INDEX_SEARCH_TIMEOUT = "index.search.timeout";
/** The key of the configuration. e.g. 3m */
String INDEX_SCROLL_SEARCH_TIMEOUT_TIMEOUT = "index.scroll.search.timeout.timeout";
/** The key of the configuration. e.g. 3m */
String INDEX_INDEX_TIMEOUT = "index.index.timeout";
/** The key of the configuration. e.g. 3m */
String INDEX_BULK_TIMEOUT = "index.bulk.timeout";
/** The key of the configuration. e.g. 3m */
String INDEX_DELETE_TIMEOUT = "index.delete.timeout";
/** The key of the configuration. e.g. 10m */
String INDEX_HEALTH_TIMEOUT = "index.health.timeout";
/** The key of the configuration. e.g. 1m */
String INDEX_INDICES_TIMEOUT = "index.indices.timeout";
/** The key of the configuration. e.g. 1000 */
String QUERY_MAX_LENGTH = "query.max.length";
@ -318,7 +346,7 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
String QUERY_REPLACE_TERM_WITH_PREFIX_QUERY = "query.replace.term.with.prefix.query";
/** The key of the configuration. e.g. */
String QUERY_DEFAULT_LANGUAGE = "query.default.language";
String QUERY_DEFAULT_LANGUAGES = "query.default.languages";
/** The key of the configuration. e.g. ar=ar
bg=bg
@ -434,6 +462,9 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
/** The key of the configuration. e.g. 1000 */
String PAGE_ROLETYPE_MAX_FETCH_SIZE = "page.roletype.max.fetch.size";
/** The key of the configuration. e.g. 1000 */
String PAGE_USER_MAX_FETCH_SIZE = "page.user.max.fetch.size";
/** The key of the configuration. e.g. 1000 */
String PAGE_ROLE_MAX_FETCH_SIZE = "page.role.max.fetch.size";
@ -443,6 +474,51 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
/** The key of the configuration. e.g. 100 */
String PAGE_CRAWLING_INFO_PARAM_MAX_FETCH_SIZE = "page.crawling.info.param.max.fetch.size";
/** The key of the configuration. e.g. 1000 */
String PAGE_CRAWLING_INFO_MAX_FETCH_SIZE = "page.crawling.info.max.fetch.size";
/** The key of the configuration. e.g. 100 */
String PAGE_DATA_CONFIG_MAX_FETCH_SIZE = "page.data.config.max.fetch.size";
/** The key of the configuration. e.g. 100 */
String PAGE_WEB_CONFIG_MAX_FETCH_SIZE = "page.web.config.max.fetch.size";
/** The key of the configuration. e.g. 100 */
String PAGE_FILE_CONFIG_MAX_FETCH_SIZE = "page.file.config.max.fetch.size";
/** The key of the configuration. e.g. 1000 */
String PAGE_DUPLICATE_HOST_MAX_FETCH_SIZE = "page.duplicate.host.max.fetch.size";
/** The key of the configuration. e.g. 1000 */
String PAGE_FAILURE_URL_MAX_FETCH_SIZE = "page.failure.url.max.fetch.size";
/** The key of the configuration. e.g. 100 */
String PAGE_FAVORITE_LOG_MAX_FETCH_SIZE = "page.favorite.log.max.fetch.size";
/** The key of the configuration. e.g. 100 */
String PAGE_FILE_AUTH_MAX_FETCH_SIZE = "page.file.auth.max.fetch.size";
/** The key of the configuration. e.g. 100 */
String PAGE_WEB_AUTH_MAX_FETCH_SIZE = "page.web.auth.max.fetch.size";
/** The key of the configuration. e.g. 1000 */
String PAGE_PATH_MAPPING_MAX_FETCH_SIZE = "page.path.mapping.max.fetch.size";
/** The key of the configuration. e.g. 1000 */
String PAGE_REQUEST_HEADER_MAX_FETCH_SIZE = "page.request.header.max.fetch.size";
/** The key of the configuration. e.g. 100 */
String PAGE_SCHEDULED_JOB_MAX_FETCH_SIZE = "page.scheduled.job.max.fetch.size";
/** The key of the configuration. e.g. 100 */
String PAGE_SEARCH_FIELD_LOG_MAX_FETCH_SIZE = "page.search.field.log.max.fetch.size";
/** The key of the configuration. e.g. 1000 */
String PAGE_ELEVATE_WORD_MAX_FETCH_SIZE = "page.elevate.word.max.fetch.size";
/** The key of the configuration. e.g. 1000 */
String PAGE_BAD_WORD_MAX_FETCH_SIZE = "page.bad.word.max.fetch.size";
/** The key of the configuration. e.g. 0 */
String PAGING_SEARCH_PAGE_START = "paging.search.page.start";
@ -566,7 +642,7 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
/** The key of the configuration. e.g. backup */
String ONLINE_HELP_NAME_BACKUP = "online.help.name.backup";
/** The key of the configuration. e.g. */
/** The key of the configuration. e.g. ja */
String ONLINE_HELP_SUPPORTED_LANGS = "online.help.supported.langs";
/** The key of the configuration. e.g. 0 */
@ -777,7 +853,11 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
-XX:CMSInitiatingOccupancyFraction=75
-XX:+UseParNewGC
-XX:+UseTLAB
-XX:+DisableExplicitGC <br>
-XX:+DisableExplicitGC
-Djcifs.smb.client.connTimeout=60000
-Djcifs.smb.client.soTimeout=35000
-Djcifs.smb.client.responseTimeout=30000
<br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getJvmSuggestOptions();
@ -1231,6 +1311,21 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
*/
boolean isIndexerThreadDumpEnabled();
/**
* Get the value for the key 'indexer.unprocessed.document.size'. <br>
* The value is, e.g. 1000 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getIndexerUnprocessedDocumentSize();
/**
* Get the value for the key 'indexer.unprocessed.document.size' as {@link Integer}. <br>
* The value is, e.g. 1000 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
* @throws NumberFormatException When the property is not integer.
*/
Integer getIndexerUnprocessedDocumentSizeAsInteger();
/**
* Get the value for the key 'indexer.click.count.enabled'. <br>
* The value is, e.g. true <br>
@ -1261,14 +1356,14 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
/**
* Get the value for the key 'indexer.webfs.commit.margin.time'. <br>
* The value is, e.g. 10000 <br>
* The value is, e.g. 1000 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getIndexerWebfsCommitMarginTime();
/**
* Get the value for the key 'indexer.webfs.commit.margin.time' as {@link Integer}. <br>
* The value is, e.g. 10000 <br>
* The value is, e.g. 1000 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
* @throws NumberFormatException When the property is not integer.
*/
@ -1291,14 +1386,14 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
/**
* Get the value for the key 'indexer.webfs.update.interval'. <br>
* The value is, e.g. 60000 <br>
* The value is, e.g. 10000 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getIndexerWebfsUpdateInterval();
/**
* Get the value for the key 'indexer.webfs.update.interval' as {@link Integer}. <br>
* The value is, e.g. 60000 <br>
* The value is, e.g. 10000 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
* @throws NumberFormatException When the property is not integer.
*/
@ -1546,6 +1641,56 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
*/
String getIndexDocumentType();
/**
* Get the value for the key 'index.search.timeout'. <br>
* The value is, e.g. 3m <br>
* comment: timeout
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getIndexSearchTimeout();
/**
* Get the value for the key 'index.scroll.search.timeout.timeout'. <br>
* The value is, e.g. 3m <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getIndexScrollSearchTimeoutTimeout();
/**
* Get the value for the key 'index.index.timeout'. <br>
* The value is, e.g. 3m <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getIndexIndexTimeout();
/**
* Get the value for the key 'index.bulk.timeout'. <br>
* The value is, e.g. 3m <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getIndexBulkTimeout();
/**
* Get the value for the key 'index.delete.timeout'. <br>
* The value is, e.g. 3m <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getIndexDeleteTimeout();
/**
* Get the value for the key 'index.health.timeout'. <br>
* The value is, e.g. 10m <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getIndexHealthTimeout();
/**
* Get the value for the key 'index.indices.timeout'. <br>
* The value is, e.g. 1m <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getIndexIndicesTimeout();
/**
* Get the value for the key 'query.max.length'. <br>
* The value is, e.g. 1000 <br>
@ -1578,19 +1723,19 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
boolean isQueryReplaceTermWithPrefixQuery();
/**
* Get the value for the key 'query.default.language'. <br>
* Get the value for the key 'query.default.languages'. <br>
* The value is, e.g. <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getQueryDefaultLanguage();
String getQueryDefaultLanguages();
/**
* Get the value for the key 'query.default.language' as {@link Integer}. <br>
* Get the value for the key 'query.default.languages' as {@link Integer}. <br>
* The value is, e.g. <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
* @throws NumberFormatException When the property is not integer.
*/
Integer getQueryDefaultLanguageAsInteger();
Integer getQueryDefaultLanguagesAsInteger();
/**
* Get the value for the key 'query.language.mapping'. <br>
@ -1932,6 +2077,21 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
*/
Integer getPageRoletypeMaxFetchSizeAsInteger();
/**
* Get the value for the key 'page.user.max.fetch.size'. <br>
* The value is, e.g. 1000 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getPageUserMaxFetchSize();
/**
* Get the value for the key 'page.user.max.fetch.size' as {@link Integer}. <br>
* The value is, e.g. 1000 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
* @throws NumberFormatException When the property is not integer.
*/
Integer getPageUserMaxFetchSizeAsInteger();
/**
* Get the value for the key 'page.role.max.fetch.size'. <br>
* The value is, e.g. 1000 <br>
@ -1977,6 +2137,231 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
*/
Integer getPageCrawlingInfoParamMaxFetchSizeAsInteger();
/**
* Get the value for the key 'page.crawling.info.max.fetch.size'. <br>
* The value is, e.g. 1000 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getPageCrawlingInfoMaxFetchSize();
/**
* Get the value for the key 'page.crawling.info.max.fetch.size' as {@link Integer}. <br>
* The value is, e.g. 1000 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
* @throws NumberFormatException When the property is not integer.
*/
Integer getPageCrawlingInfoMaxFetchSizeAsInteger();
/**
* Get the value for the key 'page.data.config.max.fetch.size'. <br>
* The value is, e.g. 100 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getPageDataConfigMaxFetchSize();
/**
* Get the value for the key 'page.data.config.max.fetch.size' as {@link Integer}. <br>
* The value is, e.g. 100 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
* @throws NumberFormatException When the property is not integer.
*/
Integer getPageDataConfigMaxFetchSizeAsInteger();
/**
* Get the value for the key 'page.web.config.max.fetch.size'. <br>
* The value is, e.g. 100 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getPageWebConfigMaxFetchSize();
/**
* Get the value for the key 'page.web.config.max.fetch.size' as {@link Integer}. <br>
* The value is, e.g. 100 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
* @throws NumberFormatException When the property is not integer.
*/
Integer getPageWebConfigMaxFetchSizeAsInteger();
/**
* Get the value for the key 'page.file.config.max.fetch.size'. <br>
* The value is, e.g. 100 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getPageFileConfigMaxFetchSize();
/**
* Get the value for the key 'page.file.config.max.fetch.size' as {@link Integer}. <br>
* The value is, e.g. 100 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
* @throws NumberFormatException When the property is not integer.
*/
Integer getPageFileConfigMaxFetchSizeAsInteger();
/**
* Get the value for the key 'page.duplicate.host.max.fetch.size'. <br>
* The value is, e.g. 1000 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getPageDuplicateHostMaxFetchSize();
/**
* Get the value for the key 'page.duplicate.host.max.fetch.size' as {@link Integer}. <br>
* The value is, e.g. 1000 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
* @throws NumberFormatException When the property is not integer.
*/
Integer getPageDuplicateHostMaxFetchSizeAsInteger();
/**
* Get the value for the key 'page.failure.url.max.fetch.size'. <br>
* The value is, e.g. 1000 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getPageFailureUrlMaxFetchSize();
/**
* Get the value for the key 'page.failure.url.max.fetch.size' as {@link Integer}. <br>
* The value is, e.g. 1000 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
* @throws NumberFormatException When the property is not integer.
*/
Integer getPageFailureUrlMaxFetchSizeAsInteger();
/**
* Get the value for the key 'page.favorite.log.max.fetch.size'. <br>
* The value is, e.g. 100 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getPageFavoriteLogMaxFetchSize();
/**
* Get the value for the key 'page.favorite.log.max.fetch.size' as {@link Integer}. <br>
* The value is, e.g. 100 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
* @throws NumberFormatException When the property is not integer.
*/
Integer getPageFavoriteLogMaxFetchSizeAsInteger();
/**
* Get the value for the key 'page.file.auth.max.fetch.size'. <br>
* The value is, e.g. 100 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getPageFileAuthMaxFetchSize();
/**
* Get the value for the key 'page.file.auth.max.fetch.size' as {@link Integer}. <br>
* The value is, e.g. 100 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
* @throws NumberFormatException When the property is not integer.
*/
Integer getPageFileAuthMaxFetchSizeAsInteger();
/**
* Get the value for the key 'page.web.auth.max.fetch.size'. <br>
* The value is, e.g. 100 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getPageWebAuthMaxFetchSize();
/**
* Get the value for the key 'page.web.auth.max.fetch.size' as {@link Integer}. <br>
* The value is, e.g. 100 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
* @throws NumberFormatException When the property is not integer.
*/
Integer getPageWebAuthMaxFetchSizeAsInteger();
/**
* Get the value for the key 'page.path.mapping.max.fetch.size'. <br>
* The value is, e.g. 1000 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getPagePathMappingMaxFetchSize();
/**
* Get the value for the key 'page.path.mapping.max.fetch.size' as {@link Integer}. <br>
* The value is, e.g. 1000 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
* @throws NumberFormatException When the property is not integer.
*/
Integer getPagePathMappingMaxFetchSizeAsInteger();
/**
* Get the value for the key 'page.request.header.max.fetch.size'. <br>
* The value is, e.g. 1000 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getPageRequestHeaderMaxFetchSize();
/**
* Get the value for the key 'page.request.header.max.fetch.size' as {@link Integer}. <br>
* The value is, e.g. 1000 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
* @throws NumberFormatException When the property is not integer.
*/
Integer getPageRequestHeaderMaxFetchSizeAsInteger();
/**
* Get the value for the key 'page.scheduled.job.max.fetch.size'. <br>
* The value is, e.g. 100 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getPageScheduledJobMaxFetchSize();
/**
* Get the value for the key 'page.scheduled.job.max.fetch.size' as {@link Integer}. <br>
* The value is, e.g. 100 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
* @throws NumberFormatException When the property is not integer.
*/
Integer getPageScheduledJobMaxFetchSizeAsInteger();
/**
* Get the value for the key 'page.search.field.log.max.fetch.size'. <br>
* The value is, e.g. 100 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getPageSearchFieldLogMaxFetchSize();
/**
* Get the value for the key 'page.search.field.log.max.fetch.size' as {@link Integer}. <br>
* The value is, e.g. 100 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
* @throws NumberFormatException When the property is not integer.
*/
Integer getPageSearchFieldLogMaxFetchSizeAsInteger();
/**
* Get the value for the key 'page.elevate.word.max.fetch.size'. <br>
* The value is, e.g. 1000 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getPageElevateWordMaxFetchSize();
/**
* Get the value for the key 'page.elevate.word.max.fetch.size' as {@link Integer}. <br>
* The value is, e.g. 1000 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
* @throws NumberFormatException When the property is not integer.
*/
Integer getPageElevateWordMaxFetchSizeAsInteger();
/**
* Get the value for the key 'page.bad.word.max.fetch.size'. <br>
* The value is, e.g. 1000 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getPageBadWordMaxFetchSize();
/**
* Get the value for the key 'page.bad.word.max.fetch.size' as {@link Integer}. <br>
* The value is, e.g. 1000 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
* @throws NumberFormatException When the property is not integer.
*/
Integer getPageBadWordMaxFetchSizeAsInteger();
/**
* Get the value for the key 'paging.search.page.start'. <br>
* The value is, e.g. 0 <br>
@ -2304,19 +2689,11 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
/**
* Get the value for the key 'online.help.supported.langs'. <br>
* The value is, e.g. <br>
* The value is, e.g. ja <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getOnlineHelpSupportedLangs();
/**
* Get the value for the key 'online.help.supported.langs' as {@link Integer}. <br>
* The value is, e.g. <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
* @throws NumberFormatException When the property is not integer.
*/
Integer getOnlineHelpSupportedLangsAsInteger();
/**
* Get the value for the key 'suggest.popular.word.seed'. <br>
* The value is, e.g. 0 <br>
@ -3018,6 +3395,14 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
return is(FessConfig.INDEXER_THREAD_DUMP_ENABLED);
}
public String getIndexerUnprocessedDocumentSize() {
return get(FessConfig.INDEXER_UNPROCESSED_DOCUMENT_SIZE);
}
public Integer getIndexerUnprocessedDocumentSizeAsInteger() {
return getAsInteger(FessConfig.INDEXER_UNPROCESSED_DOCUMENT_SIZE);
}
public String getIndexerClickCountEnabled() {
return get(FessConfig.INDEXER_CLICK_COUNT_ENABLED);
}
@ -3194,6 +3579,34 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
return get(FessConfig.INDEX_DOCUMENT_TYPE);
}
public String getIndexSearchTimeout() {
return get(FessConfig.INDEX_SEARCH_TIMEOUT);
}
public String getIndexScrollSearchTimeoutTimeout() {
return get(FessConfig.INDEX_SCROLL_SEARCH_TIMEOUT_TIMEOUT);
}
public String getIndexIndexTimeout() {
return get(FessConfig.INDEX_INDEX_TIMEOUT);
}
public String getIndexBulkTimeout() {
return get(FessConfig.INDEX_BULK_TIMEOUT);
}
public String getIndexDeleteTimeout() {
return get(FessConfig.INDEX_DELETE_TIMEOUT);
}
public String getIndexHealthTimeout() {
return get(FessConfig.INDEX_HEALTH_TIMEOUT);
}
public String getIndexIndicesTimeout() {
return get(FessConfig.INDEX_INDICES_TIMEOUT);
}
public String getQueryMaxLength() {
return get(FessConfig.QUERY_MAX_LENGTH);
}
@ -3210,12 +3623,12 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
return is(FessConfig.QUERY_REPLACE_TERM_WITH_PREFIX_QUERY);
}
public String getQueryDefaultLanguage() {
return get(FessConfig.QUERY_DEFAULT_LANGUAGE);
public String getQueryDefaultLanguages() {
return get(FessConfig.QUERY_DEFAULT_LANGUAGES);
}
public Integer getQueryDefaultLanguageAsInteger() {
return getAsInteger(FessConfig.QUERY_DEFAULT_LANGUAGE);
public Integer getQueryDefaultLanguagesAsInteger() {
return getAsInteger(FessConfig.QUERY_DEFAULT_LANGUAGES);
}
public String getQueryLanguageMapping() {
@ -3366,6 +3779,14 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
return getAsInteger(FessConfig.PAGE_ROLETYPE_MAX_FETCH_SIZE);
}
public String getPageUserMaxFetchSize() {
return get(FessConfig.PAGE_USER_MAX_FETCH_SIZE);
}
public Integer getPageUserMaxFetchSizeAsInteger() {
return getAsInteger(FessConfig.PAGE_USER_MAX_FETCH_SIZE);
}
public String getPageRoleMaxFetchSize() {
return get(FessConfig.PAGE_ROLE_MAX_FETCH_SIZE);
}
@ -3390,6 +3811,126 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
return getAsInteger(FessConfig.PAGE_CRAWLING_INFO_PARAM_MAX_FETCH_SIZE);
}
public String getPageCrawlingInfoMaxFetchSize() {
return get(FessConfig.PAGE_CRAWLING_INFO_MAX_FETCH_SIZE);
}
public Integer getPageCrawlingInfoMaxFetchSizeAsInteger() {
return getAsInteger(FessConfig.PAGE_CRAWLING_INFO_MAX_FETCH_SIZE);
}
public String getPageDataConfigMaxFetchSize() {
return get(FessConfig.PAGE_DATA_CONFIG_MAX_FETCH_SIZE);
}
public Integer getPageDataConfigMaxFetchSizeAsInteger() {
return getAsInteger(FessConfig.PAGE_DATA_CONFIG_MAX_FETCH_SIZE);
}
public String getPageWebConfigMaxFetchSize() {
return get(FessConfig.PAGE_WEB_CONFIG_MAX_FETCH_SIZE);
}
public Integer getPageWebConfigMaxFetchSizeAsInteger() {
return getAsInteger(FessConfig.PAGE_WEB_CONFIG_MAX_FETCH_SIZE);
}
public String getPageFileConfigMaxFetchSize() {
return get(FessConfig.PAGE_FILE_CONFIG_MAX_FETCH_SIZE);
}
public Integer getPageFileConfigMaxFetchSizeAsInteger() {
return getAsInteger(FessConfig.PAGE_FILE_CONFIG_MAX_FETCH_SIZE);
}
public String getPageDuplicateHostMaxFetchSize() {
return get(FessConfig.PAGE_DUPLICATE_HOST_MAX_FETCH_SIZE);
}
public Integer getPageDuplicateHostMaxFetchSizeAsInteger() {
return getAsInteger(FessConfig.PAGE_DUPLICATE_HOST_MAX_FETCH_SIZE);
}
public String getPageFailureUrlMaxFetchSize() {
return get(FessConfig.PAGE_FAILURE_URL_MAX_FETCH_SIZE);
}
public Integer getPageFailureUrlMaxFetchSizeAsInteger() {
return getAsInteger(FessConfig.PAGE_FAILURE_URL_MAX_FETCH_SIZE);
}
public String getPageFavoriteLogMaxFetchSize() {
return get(FessConfig.PAGE_FAVORITE_LOG_MAX_FETCH_SIZE);
}
public Integer getPageFavoriteLogMaxFetchSizeAsInteger() {
return getAsInteger(FessConfig.PAGE_FAVORITE_LOG_MAX_FETCH_SIZE);
}
public String getPageFileAuthMaxFetchSize() {
return get(FessConfig.PAGE_FILE_AUTH_MAX_FETCH_SIZE);
}
public Integer getPageFileAuthMaxFetchSizeAsInteger() {
return getAsInteger(FessConfig.PAGE_FILE_AUTH_MAX_FETCH_SIZE);
}
public String getPageWebAuthMaxFetchSize() {
return get(FessConfig.PAGE_WEB_AUTH_MAX_FETCH_SIZE);
}
public Integer getPageWebAuthMaxFetchSizeAsInteger() {
return getAsInteger(FessConfig.PAGE_WEB_AUTH_MAX_FETCH_SIZE);
}
public String getPagePathMappingMaxFetchSize() {
return get(FessConfig.PAGE_PATH_MAPPING_MAX_FETCH_SIZE);
}
public Integer getPagePathMappingMaxFetchSizeAsInteger() {
return getAsInteger(FessConfig.PAGE_PATH_MAPPING_MAX_FETCH_SIZE);
}
public String getPageRequestHeaderMaxFetchSize() {
return get(FessConfig.PAGE_REQUEST_HEADER_MAX_FETCH_SIZE);
}
public Integer getPageRequestHeaderMaxFetchSizeAsInteger() {
return getAsInteger(FessConfig.PAGE_REQUEST_HEADER_MAX_FETCH_SIZE);
}
public String getPageScheduledJobMaxFetchSize() {
return get(FessConfig.PAGE_SCHEDULED_JOB_MAX_FETCH_SIZE);
}
public Integer getPageScheduledJobMaxFetchSizeAsInteger() {
return getAsInteger(FessConfig.PAGE_SCHEDULED_JOB_MAX_FETCH_SIZE);
}
public String getPageSearchFieldLogMaxFetchSize() {
return get(FessConfig.PAGE_SEARCH_FIELD_LOG_MAX_FETCH_SIZE);
}
public Integer getPageSearchFieldLogMaxFetchSizeAsInteger() {
return getAsInteger(FessConfig.PAGE_SEARCH_FIELD_LOG_MAX_FETCH_SIZE);
}
public String getPageElevateWordMaxFetchSize() {
return get(FessConfig.PAGE_ELEVATE_WORD_MAX_FETCH_SIZE);
}
public Integer getPageElevateWordMaxFetchSizeAsInteger() {
return getAsInteger(FessConfig.PAGE_ELEVATE_WORD_MAX_FETCH_SIZE);
}
public String getPageBadWordMaxFetchSize() {
return get(FessConfig.PAGE_BAD_WORD_MAX_FETCH_SIZE);
}
public Integer getPageBadWordMaxFetchSizeAsInteger() {
return getAsInteger(FessConfig.PAGE_BAD_WORD_MAX_FETCH_SIZE);
}
public String getPagingSearchPageStart() {
return get(FessConfig.PAGING_SEARCH_PAGE_START);
}
@ -3574,10 +4115,6 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
return get(FessConfig.ONLINE_HELP_SUPPORTED_LANGS);
}
public Integer getOnlineHelpSupportedLangsAsInteger() {
return getAsInteger(FessConfig.ONLINE_HELP_SUPPORTED_LANGS);
}
public String getSuggestPopularWordSeed() {
return get(FessConfig.SUGGEST_POPULAR_WORD_SEED);
}

View file

@ -15,8 +15,12 @@
*/
package org.codelibs.fess.mylasta.direction;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@ -29,13 +33,23 @@ import org.codelibs.core.lang.StringUtil;
import org.codelibs.core.misc.Pair;
import org.codelibs.core.misc.Tuple3;
import org.codelibs.fess.Constants;
import org.codelibs.fess.mylasta.action.FessUserBean;
import org.codelibs.fess.util.ComponentUtil;
import org.codelibs.fess.util.StreamUtil;
import org.dbflute.optional.OptionalThing;
import org.lastaflute.job.LaJob;
import org.lastaflute.job.subsidiary.ConcurrentExec;
public interface FessProp {
public static final String GROUP_VALUE_PREFIX = "group:";
public static final String ROLE_VALUE_PREFIX = "role:";
public static final String DEFAULT_SORT_VALUES = "defaultSortValues";
public static final String DEFAULT_LABEL_VALUES = "defaultLabelValues";
public static final String QUERY_LANGUAGE_MAPPING = "queryLanguageMapping";
public static final String CRAWLER_METADATA_NAME_MAPPING = "crawlerMetadataNameMapping";
@ -61,7 +75,11 @@ public interface FessProp {
}
public default void setSystemProperty(final String key, final String value) {
ComponentUtil.getSystemProperties().setProperty(key, value);
if (value != null) {
ComponentUtil.getSystemProperties().setProperty(key, value);
} else {
ComponentUtil.getSystemProperties().remove(key);
}
}
public default boolean getSystemPropertyAsBoolean(final String key, final boolean defaultValue) {
@ -88,6 +106,104 @@ public interface FessProp {
setSystemProperty(key, Integer.toString(value));
}
public default String[] getDefaultSortValues(final OptionalThing<FessUserBean> userBean) {
@SuppressWarnings("unchecked")
Map<String, String> map = (Map<String, String>) propMap.get(DEFAULT_SORT_VALUES);
if (map == null) {
String value = getSystemProperty(Constants.DEFAULT_SORT_VALUE_PROPERTY);
if (StringUtil.isBlank(value)) {
map = Collections.emptyMap();
} else {
final Set<String> keySet = new HashSet<>();
map = StreamUtil.of(value.split("\n")).filter(s -> StringUtil.isNotBlank(s)).map(s -> {
final String[] pair = s.split("=");
if (pair.length == 1) {
return new Pair<>(StringUtil.EMPTY, pair[0].trim());
} else if (pair.length == 2) {
String sortValue = pair[1].trim();
if (StringUtil.isBlank(sortValue) || "score".equals(sortValue)) {
sortValue = "score.desc";
}
return new Pair<>(pair[0].trim(), sortValue);
}
return null;
}).filter(o -> o != null && keySet.add(o.getFirst())).collect(Collectors.toMap(Pair::getFirst, d -> d.getSecond()));
}
propMap.put(DEFAULT_SORT_VALUES, map);
}
return map
.entrySet()
.stream()
.map(e -> {
final String key = e.getKey();
if (StringUtil.isEmpty(key)) {
return e.getValue();
}
if (userBean.map(
user -> StreamUtil.of(user.getRoles()).anyMatch(s -> key.equals(ROLE_VALUE_PREFIX + s))
|| StreamUtil.of(user.getGroups()).anyMatch(s -> key.equals(GROUP_VALUE_PREFIX + s))).orElse(false)) {
return e.getValue();
}
return null;
}).filter(s -> StringUtil.isNotBlank(s)).toArray(n -> new String[n]);
}
public default void setDefaultSortValue(final String value) {
setSystemProperty(Constants.DEFAULT_SORT_VALUE_PROPERTY, value);
propMap.remove(DEFAULT_SORT_VALUES);
}
public default String getDefaultSortValue() {
return getSystemProperty(Constants.DEFAULT_SORT_VALUE_PROPERTY, StringUtil.EMPTY);
}
public default String[] getDefaultLabelValues(final OptionalThing<FessUserBean> userBean) {
@SuppressWarnings("unchecked")
Map<String, String> map = (Map<String, String>) propMap.get(DEFAULT_LABEL_VALUES);
if (map == null) {
String value = getSystemProperty(Constants.DEFAULT_LABEL_VALUE_PROPERTY);
if (StringUtil.isBlank(value)) {
map = Collections.emptyMap();
} else {
final Set<String> keySet = new HashSet<>();
map = StreamUtil.of(value.split("\n")).filter(s -> StringUtil.isNotBlank(s)).map(s -> {
final String[] pair = s.split("=");
if (pair.length == 1) {
return new Pair<>(StringUtil.EMPTY, pair[0].trim());
} else if (pair.length == 2) {
return new Pair<>(pair[0].trim(), pair[1].trim());
}
return null;
}).filter(o -> o != null && keySet.add(o.getFirst())).collect(Collectors.toMap(Pair::getFirst, d -> d.getSecond()));
}
propMap.put(DEFAULT_LABEL_VALUES, map);
}
return map
.entrySet()
.stream()
.map(e -> {
final String key = e.getKey();
if (StringUtil.isEmpty(key)) {
return e.getValue();
}
if (userBean.map(
user -> StreamUtil.of(user.getRoles()).anyMatch(s -> key.equals(ROLE_VALUE_PREFIX + s))
|| StreamUtil.of(user.getGroups()).anyMatch(s -> key.equals(GROUP_VALUE_PREFIX + s))).orElse(false)) {
return e.getValue();
}
return null;
}).filter(s -> StringUtil.isNotBlank(s)).toArray(n -> new String[n]);
}
public default void setDefaultLabelValue(final String value) {
setSystemProperty(Constants.DEFAULT_LABEL_VALUE_PROPERTY, value);
propMap.remove(DEFAULT_LABEL_VALUES);
}
public default String getDefaultLabelValue() {
return getSystemProperty(Constants.DEFAULT_LABEL_VALUE_PROPERTY, StringUtil.EMPTY);
}
public default void setLoginRequired(final boolean value) {
setSystemPropertyAsBoolean(Constants.LOGIN_REQUIRED_PROPERTY, value);
}
@ -96,6 +212,86 @@ public interface FessProp {
return getSystemPropertyAsBoolean(Constants.LOGIN_REQUIRED_PROPERTY, false);
}
public default void setIncrementalCrawling(final boolean value) {
setSystemPropertyAsBoolean(Constants.INCREMENTAL_CRAWLING_PROPERTY, value);
}
public default boolean isIncrementalCrawling() {
return getSystemPropertyAsBoolean(Constants.INCREMENTAL_CRAWLING_PROPERTY, true);
}
public default void setDayForCleanup(final int value) {
setSystemPropertyAsInt(Constants.DAY_FOR_CLEANUP_PROPERTY, value);
}
public default int getDayForCleanup() {
return getSystemPropertyAsInt(Constants.DAY_FOR_CLEANUP_PROPERTY, Constants.DEFAULT_DAY_FOR_CLEANUP);
}
public default void setCrawlingThreadCount(final int value) {
setSystemPropertyAsInt(Constants.CRAWLING_THREAD_COUNT_PROPERTY, value);
}
public default int getCrawlingThreadCount() {
return getSystemPropertyAsInt(Constants.CRAWLING_THREAD_COUNT_PROPERTY, 5);
}
public default void setSearchLog(final boolean value) {
setSystemPropertyAsBoolean(Constants.SEARCH_LOG_PROPERTY, value);
}
public default boolean isSearchLog() {
return getSystemPropertyAsBoolean(Constants.SEARCH_LOG_PROPERTY, false);
}
public default void setUserInfo(final boolean value) {
setSystemPropertyAsBoolean(Constants.USER_INFO_PROPERTY, value);
}
public default boolean isUserInfo() {
return getSystemPropertyAsBoolean(Constants.USER_INFO_PROPERTY, false);
}
public default void setUserFavorite(final boolean value) {
setSystemPropertyAsBoolean(Constants.USER_FAVORITE_PROPERTY, value);
}
public default boolean isUserFavorite() {
return getSystemPropertyAsBoolean(Constants.USER_FAVORITE_PROPERTY, false);
}
public default void setWebApiJson(final boolean value) {
setSystemPropertyAsBoolean(Constants.WEB_API_JSON_PROPERTY, value);
}
public default boolean isWebApiJson() {
return getSystemPropertyAsBoolean(Constants.WEB_API_JSON_PROPERTY, false);
}
public default void setAppendQueryParameter(final boolean value) {
setSystemPropertyAsBoolean(Constants.APPEND_QUERY_PARAMETER_PROPERTY, value);
}
public default boolean isAppendQueryParameter() {
return getSystemPropertyAsBoolean(Constants.APPEND_QUERY_PARAMETER_PROPERTY, false);
}
public default void setIgnoreFailureType(final String value) {
setSystemProperty(Constants.IGNORE_FAILURE_TYPE_PROPERTY, value);
}
public default String getIgnoreFailureType() {
return getSystemProperty(Constants.IGNORE_FAILURE_TYPE_PROPERTY, Constants.DEFAULT_IGNORE_FAILURE_TYPE);
}
public default void setFailureCountThreshold(final int value) {
setSystemPropertyAsInt(Constants.FAILURE_COUNT_THRESHOLD_PROPERTY, value);
}
public default int getFailureCountThreshold() {
return getSystemPropertyAsInt(Constants.FAILURE_COUNT_THRESHOLD_PROPERTY, Constants.DEFAULT_FAILURE_COUNT);
}
public default void setWebApiPopularWord(final boolean value) {
setSystemPropertyAsBoolean(Constants.WEB_API_POPULAR_WORD_PROPERTY, value);
}
@ -104,30 +300,107 @@ public interface FessProp {
return getSystemPropertyAsBoolean(Constants.WEB_API_POPULAR_WORD_PROPERTY, true);
}
public default String getLdapInitialContextFactory() {
return getSystemProperty(Constants.LDAP_INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
public default void setCsvFileEncoding(final String value) {
setSystemProperty(Constants.CSV_FILE_ENCODING_PROPERTY, value);
}
public default String getCsvFileEncoding() {
return getSystemProperty(Constants.CSV_FILE_ENCODING_PROPERTY, Constants.UTF_8);
}
public default void setPurgeSearchLogDay(final int value) {
setSystemPropertyAsInt(Constants.PURGE_SEARCH_LOG_DAY_PROPERTY, value);
}
public default int getPurgeSearchLogDay() {
return getSystemPropertyAsInt(Constants.PURGE_SEARCH_LOG_DAY_PROPERTY, Integer.parseInt(Constants.DEFAULT_PURGE_DAY));
}
public default void setPurgeJobLogDay(final int value) {
setSystemPropertyAsInt(Constants.PURGE_JOB_LOG_DAY_PROPERTY, value);
}
public default int getPurgeJobLogDay() {
return getSystemPropertyAsInt(Constants.PURGE_JOB_LOG_DAY_PROPERTY, Integer.parseInt(Constants.DEFAULT_PURGE_DAY));
}
public default void setPurgeUserInfoDay(final int value) {
setSystemPropertyAsInt(Constants.PURGE_USER_INFO_DAY_PROPERTY, value);
}
public default int getPurgeUserInfoDay() {
return getSystemPropertyAsInt(Constants.PURGE_USER_INFO_DAY_PROPERTY, Integer.parseInt(Constants.DEFAULT_PURGE_DAY));
}
public default void setPurgeByBots(final String value) {
setSystemProperty(Constants.PURGE_BY_BOTS_PROPERTY, value);
}
public default String getPurgeByBots() {
return getSystemProperty(Constants.PURGE_BY_BOTS_PROPERTY, Constants.DEFAULT_PURGE_BY_BOTS);
}
public default void setNotificationTo(final String value) {
setSystemProperty(Constants.NOTIFICATION_TO_PROPERTY, value);
}
public default String getNotificationTo() {
return getSystemProperty(Constants.NOTIFICATION_TO_PROPERTY, StringUtil.EMPTY);
}
public default void setSuggestSearchLog(final boolean value) {
setSystemPropertyAsBoolean(Constants.SUGGEST_SEARCH_LOG_PROPERTY, value);
}
public default boolean isSuggestSearchLog() {
return getSystemPropertyAsBoolean(Constants.SUGGEST_SEARCH_LOG_PROPERTY, true);
}
public default void setSuggestDocuments(final boolean value) {
setSystemPropertyAsBoolean(Constants.SUGGEST_DOCUMENTS_PROPERTY, value);
}
public default boolean isSuggestDocuments() {
return getSystemPropertyAsBoolean(Constants.SUGGEST_DOCUMENTS_PROPERTY, true);
}
public default void setPurgeSuggestSearchLogDay(final int value) {
setSystemPropertyAsInt(Constants.PURGE_SUGGEST_SEARCH_LOG_DAY_PROPERTY, value);
}
public default int getPurgeSuggestSearchLogDay() {
return getSystemPropertyAsInt(Constants.PURGE_SUGGEST_SEARCH_LOG_DAY_PROPERTY,
Integer.parseInt(Constants.DEFAULT_SUGGEST_PURGE_DAY));
}
public default void setLdapInitialContextFactory(final String value) {
setSystemProperty(Constants.LDAP_INITIAL_CONTEXT_FACTORY, value);
}
public default String getLdapSecurityAuthentication() {
return getSystemProperty(Constants.LDAP_SECURITY_AUTHENTICATION, "simple");
public default String getLdapInitialContextFactory() {
return getSystemProperty(Constants.LDAP_INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
}
public default void setLdapSecurityAuthentication(final String value) {
setSystemProperty(Constants.LDAP_SECURITY_AUTHENTICATION, value);
}
public default String getLdapProviderUrl() {
return getSystemProperty(Constants.LDAP_PROVIDER_URL);
public default String getLdapSecurityAuthentication() {
return getSystemProperty(Constants.LDAP_SECURITY_AUTHENTICATION, "simple");
}
public default void setLdapProviderUrl(final String value) {
setSystemProperty(Constants.LDAP_PROVIDER_URL, value);
}
public default String getLdapProviderUrl() {
return getSystemProperty(Constants.LDAP_PROVIDER_URL);
}
public default void setLdapSecurityPrincipal(final String value) {
setSystemProperty(Constants.LDAP_SECURITY_PRINCIPAL, value);
}
public default String getLdapSecurityPrincipal(final String username) {
return String.format(getSystemProperty(Constants.LDAP_SECURITY_PRINCIPAL, StringUtil.EMPTY), username);
}
@ -136,24 +409,36 @@ public interface FessProp {
return getSystemProperty(Constants.LDAP_SECURITY_PRINCIPAL);
}
public default void setLdapSecurityPrincipal(final String value) {
setSystemProperty(Constants.LDAP_SECURITY_PRINCIPAL, value);
public default void setLdapBaseDn(final String value) {
setSystemProperty(Constants.LDAP_BASE_DN, value);
}
public default String getLdapBaseDn() {
return getSystemProperty(Constants.LDAP_BASE_DN);
}
public default void setLdapBaseDn(final String value) {
setSystemProperty(Constants.LDAP_BASE_DN, value);
public default void setLdapAccountFilter(final String value) {
setSystemProperty(Constants.LDAP_ACCOUNT_FILTER, value);
}
public default String getLdapAccountFilter() {
return getSystemProperty(Constants.LDAP_ACCOUNT_FILTER);
}
public default void setLdapAccountFilter(final String value) {
setSystemProperty(Constants.LDAP_ACCOUNT_FILTER, value);
public default void setNotificationLogin(final String value) {
setSystemProperty(Constants.NOTIFICATION_LOGIN, value);
}
public default String getNotificationLogin() {
return getSystemProperty(Constants.NOTIFICATION_LOGIN, StringUtil.EMPTY);
}
public default void setNotificationSearchTop(final String value) {
setSystemProperty(Constants.NOTIFICATION_SEARCH_TOP, value);
}
public default String getNotificationSearchTop() {
return getSystemProperty(Constants.NOTIFICATION_SEARCH_TOP, StringUtil.EMPTY);
}
//
@ -380,12 +665,29 @@ public interface FessProp {
return Boolean.valueOf(getQueryReplaceTermWithPrefixQuery());
}
String getQueryDefaultLanguages();
String getQueryLanguageMapping();
public default String getQueryLanguage(final Locale locale) {
if (locale == null) {
return null;
public default String[] getQueryLanguages(final Enumeration<Locale> locales, final String[] requestLangs) {
if (StringUtil.isNotBlank(getQueryDefaultLanguages())) {
String[] langs = (String[]) propMap.get("queryDefaultLanguages");
if (langs == null) {
langs = StreamUtil.of(getQueryDefaultLanguages().split(",")).map(s -> s.trim()).toArray(n -> new String[n]);
propMap.put("queryDefaultLanguages", langs);
}
return langs;
}
if (requestLangs != null && requestLangs.length != 0) {
return requestLangs;
}
if (locales == null) {
return StringUtil.EMPTY_STRINGS;
}
@SuppressWarnings("unchecked")
Map<String, String> params = (Map<String, String>) propMap.get(QUERY_LANGUAGE_MAPPING);
if (params == null) {
@ -399,20 +701,23 @@ public interface FessProp {
propMap.put(QUERY_LANGUAGE_MAPPING, params);
}
final String language = locale.getLanguage();
final String country = locale.getCountry();
if (StringUtil.isNotBlank(language)) {
if (StringUtil.isNotBlank(country)) {
final String lang = language.toLowerCase(Locale.ROOT) + "-" + country.toLowerCase(Locale.ROOT);
if (params.containsKey(lang)) {
return params.get(lang);
final Map<String, String> mapping = params;
return Collections.list(locales).stream().map(locale -> {
final String language = locale.getLanguage();
final String country = locale.getCountry();
if (StringUtil.isNotBlank(language)) {
if (StringUtil.isNotBlank(country)) {
final String lang = language.toLowerCase(Locale.ROOT) + "-" + country.toLowerCase(Locale.ROOT);
if (mapping.containsKey(lang)) {
return mapping.get(lang);
}
}
if (mapping.containsKey(language)) {
return mapping.get(language);
}
}
if (params.containsKey(language)) {
return params.get(language);
}
}
return null;
return null;
}).filter(l -> l != null).distinct().toArray(n -> new String[n]);
}
String getSupportedUploadedFiles();
@ -524,4 +829,5 @@ public interface FessProp {
public default boolean isValidCrawlerFileProtocol(final String url) {
return StreamUtil.of(getCrawlerFileProtocolsAsArray()).anyMatch(s -> url.startsWith(s));
}
}

View file

@ -41,7 +41,11 @@ jvm.suggest.options=\
-XX:CMSInitiatingOccupancyFraction=75\n\
-XX:+UseParNewGC\n\
-XX:+UseTLAB\n\
-XX:+DisableExplicitGC
-XX:+DisableExplicitGC\n\
-Djcifs.smb.client.connTimeout=60000\n\
-Djcifs.smb.client.soTimeout=35000\n\
-Djcifs.smb.client.responseTimeout=30000\n\
#-Xdebug\n\
#-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=127.0.0.1:8000\n\
@ -109,11 +113,12 @@ crawler.document.cache.html.mimetypes=text/html
# indexer
indexer.thread.dump.enabled=true
indexer.unprocessed.document.size=1000
indexer.click.count.enabled=true
indexer.favorite.count.enabled=true
indexer.webfs.commit.margin.time=10000
indexer.webfs.commit.margin.time=1000
indexer.webfs.max.empty.list.conunt=60
indexer.webfs.update.interval=60000
indexer.webfs.update.interval=10000
indexer.webfs.max.document.cache.size=5
indexer.data.max.document.cache.size=5
@ -151,10 +156,19 @@ index.document.search.index=fess
index.document.update.index=fess
index.document.type=doc
# timeout
index.search.timeout=3m
index.scroll.search.timeout.timeout=3m
index.index.timeout=3m
index.bulk.timeout=3m
index.delete.timeout=3m
index.health.timeout=10m
index.indices.timeout=1m
# query
query.max.length=1000
query.replace.term.with.prefix.query=true
query.default.language=
query.default.languages=
query.language.mapping=\
ar=ar\n\
bg=bg\n\
@ -262,9 +276,25 @@ page.docboost.max.fetch.size=1000
page.keymatch.max.fetch.size=1000
page.labeltype.max.fetch.size=1000
page.roletype.max.fetch.size=1000
page.user.max.fetch.size=1000
page.role.max.fetch.size=1000
page.group.max.fetch.size=1000
page.crawling.info.param.max.fetch.size=100
page.crawling.info.max.fetch.size=1000
page.data.config.max.fetch.size=100
page.web.config.max.fetch.size=100
page.file.config.max.fetch.size=100
page.duplicate.host.max.fetch.size=1000
page.failure.url.max.fetch.size=1000
page.favorite.log.max.fetch.size=100
page.file.auth.max.fetch.size=100
page.web.auth.max.fetch.size=100
page.path.mapping.max.fetch.size=1000
page.request.header.max.fetch.size=1000
page.scheduled.job.max.fetch.size=100
page.search.field.log.max.fetch.size=100
page.elevate.word.max.fetch.size=1000
page.bad.word.max.fetch.size=1000
# search page
paging.search.page.start=0
@ -322,7 +352,7 @@ online.help.name.scheduler=scheduler
online.help.name.crawlinginfo=crawlinginfo
online.help.name.backup=backup
online.help.supported.langs=
online.help.supported.langs=ja
# ----------------------------------------------------------
# Suggest

View file

@ -505,6 +505,10 @@
"type": "string",
"index": "not_analyzed"
},
"label": {
"type": "string",
"index": "not_analyzed"
},
"segment": {
"type": "string",
"index": "not_analyzed"

View file

@ -137,7 +137,6 @@ labels.ldapProviderUrl=LDAP URL
labels.ldapSecurityPrincipal=Bind DN
labels.ldapBaseDn=Base DN
labels.ldapAccountFilter=Account Filter
labels.loginRequired=Login Required
labels.oldPassword=Current Password
labels.newPassword=New Password
labels.confirmNewPassword=New Password(Confirm)
@ -189,6 +188,7 @@ labels.search_title=Fess
labels.search_popular_word_word=Popular Words:
labels.search_result_select_sort=-- Sort --
labels.search_result_select_num=-- Results per page --
labels.search_result_sort_score_desc=Score
labels.search_result_sort_created_asc=Date (ascending)
labels.search_result_sort_created_desc=Date (descending)
labels.search_result_sort_content_length_asc=Size (ascending)
@ -199,6 +199,7 @@ labels.search_result_sort_click_count_asc=Click (ascending)
labels.search_result_sort_click_count_desc=Click (descending)
labels.search_result_sort_favorite_count_asc=Favorite (ascending)
labels.search_result_sort_favorite_count_desc=Favorite (descending)
labels.search_result_sort_multiple=Multiple
labels.search_result_size={0} bytes
labels.search_result_created=Registered:
labels.search_result_last_modified=Last Modified:
@ -315,6 +316,7 @@ labels.user_info_enabled=User Logging
labels.user_favorite_enabled=Favorite Logging
labels.web_api_json_enabled=JSON Response
labels.default_label_value=Default Label Value
labels.default_sort_value=Default Sort Value
labels.append_query_param_enabled=Append Params to URL
labels.login_required=Login Required
labels.ignore_failure_type=Excluded Failure Type
@ -453,8 +455,6 @@ labels.data_crawling_title_details=Data\u3000Store Crawling Configuration
labels.handler_name=Handler Name
labels.handler_parameter=Parameter
labels.handler_script=Script
labels.role_type=Role
labels.label_type=Label
labels.data_crawling_button_create=Create
labels.data_crawling_button_create_job=Create new job
labels.wizard_title_configuration=Configuration Wizard
@ -497,7 +497,6 @@ labels.failure_url_id=ID
labels.failure_url_thread_name=Thread Name
labels.failure_url_error_name=Type
labels.failure_url_error_log=Log
labels.failure_url_url=URL
labels.failure_url_web_config_name=Web Crawling Configuration
labels.failure_url_file_config_name=File Crawling Configuration
labels.system_info_configuration=System Info
@ -631,7 +630,6 @@ labels.bad_word_suggest_word=Bad Word
labels.bad_word_file=Bad Word File
labels.user_configuration=User
labels.user_list_name=Name
labels.user_name=Name
labels.user_password=Password
labels.user_confirm_password=Confirm
labels.user_title_details=User
@ -644,8 +642,6 @@ labels.group_configuration=group
labels.group_list_name=Name
labels.group_name=Name
labels.group_title_details=Group
labels.roles=Roles
labels.groups=Groups
labels.crud_button_create=Create
labels.crud_button_update=Update
labels.crud_button_delete=Delete
@ -678,10 +674,8 @@ labels.ldap_provider_url=LDAP URL
labels.ldap_security_principal=Bind DN
labels.ldap_base_dn=Base DN
labels.ldap_account_filter=Account Filter
labels.ldap_account_filter=Account Filter
labels.notification_login=Login page
labels.notification_search_top=Search top page
labels.general_menu_notification=Notification
labels.send_testmail=Send TestMail
labels.backup_configuration=Back Up
labels.backup_name=Name

View file

@ -137,7 +137,6 @@ labels.ldapProviderUrl=LDAP URL
labels.ldapSecurityPrincipal=Bind DN
labels.ldapBaseDn=Base DN
labels.ldapAccountFilter=Account Filter
labels.loginRequired=Login Required
labels.oldPassword=Current Password
labels.newPassword=New Password
labels.confirmNewPassword=New Password(Confirm)
@ -189,6 +188,7 @@ labels.search_title=Fess
labels.search_popular_word_word=Popular Words:
labels.search_result_select_sort=-- Sort --
labels.search_result_select_num=-- Results per page --
labels.search_result_sort_score_desc=Score
labels.search_result_sort_created_asc=Date (ascending)
labels.search_result_sort_created_desc=Date (descending)
labels.search_result_sort_content_length_asc=Size (ascending)
@ -199,6 +199,7 @@ labels.search_result_sort_click_count_asc=Click (ascending)
labels.search_result_sort_click_count_desc=Click (descending)
labels.search_result_sort_favorite_count_asc=Favorite (ascending)
labels.search_result_sort_favorite_count_desc=Favorite (descending)
labels.search_result_sort_multiple=Multiple
labels.search_result_size={0} bytes
labels.search_result_created=Registered:
labels.search_result_last_modified=Last Modified:
@ -315,6 +316,7 @@ labels.user_info_enabled=User Logging
labels.user_favorite_enabled=Favorite Logging
labels.web_api_json_enabled=JSON Response
labels.default_label_value=Default Label Value
labels.default_sort_value=Default Sort Value
labels.append_query_param_enabled=Append Params to URL
labels.login_required=Login Required
labels.ignore_failure_type=Excluded Failure Type
@ -453,8 +455,6 @@ labels.data_crawling_title_details=Data\u3000Store Crawling Configuration
labels.handler_name=Handler Name
labels.handler_parameter=Parameter
labels.handler_script=Script
labels.role_type=Role
labels.label_type=Label
labels.data_crawling_button_create=Create
labels.data_crawling_button_create_job=Create new job
labels.wizard_title_configuration=Configuration Wizard
@ -497,7 +497,6 @@ labels.failure_url_id=ID
labels.failure_url_thread_name=Thread Name
labels.failure_url_error_name=Type
labels.failure_url_error_log=Log
labels.failure_url_url=URL
labels.failure_url_web_config_name=Web Crawling Configuration
labels.failure_url_file_config_name=File Crawling Configuration
labels.system_info_configuration=System Info
@ -631,7 +630,6 @@ labels.bad_word_suggest_word=Bad Word
labels.bad_word_file=Bad Word File
labels.user_configuration=User
labels.user_list_name=Name
labels.user_name=Name
labels.user_password=Password
labels.user_confirm_password=Confirm
labels.user_title_details=User
@ -644,8 +642,6 @@ labels.group_configuration=group
labels.group_list_name=Name
labels.group_name=Name
labels.group_title_details=Group
labels.roles=Roles
labels.groups=Groups
labels.crud_button_create=Create
labels.crud_button_update=Update
labels.crud_button_delete=Delete

File diff suppressed because it is too large Load diff

View file

@ -105,7 +105,7 @@ errors.failed_to_upload_badword_file = \u9664\u5916\u30ef\u30fc\u30c9\u30d5\u30a
errors.invalid_str_is_included = {0}\u3067\u306f{1}\u306f\u7121\u52b9\u3067\u3059\u3002
errors.blank_password = \u30d1\u30b9\u30ef\u30fc\u30c9\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002
errors.invalid_confirm_password = \u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u78ba\u8a8d\u3068\u4e00\u81f4\u3057\u307e\u305b\u3093\u3002
errors.cannot_delete_doc_because_of_running = \u30af\u30ed\u30fc\u30e9\u304c\u5b9f\u884c\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u6587\u66f8\u304c\u524a\u9664\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002
errors.cannot_delete_doc_because_of_running = \u30af\u30ed\u30fc\u30e9\u304c\u5b9f\u884c\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u6587\u66f8\u3092\u524a\u9664\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002
errors.failed_to_delete_doc_in_admin = \u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306e\u524a\u9664\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002
errors.failed_to_send_testmail=\u30c6\u30b9\u30c8\u30e1\u30fc\u30eb\u306e\u9001\u4fe1\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002
errors.invalid_query_unknown = \u6307\u5b9a\u3055\u308c\u305f\u30af\u30a8\u30ea\u30fc\u306b\u306f\u672a\u77e5\u306e\u6761\u4ef6\u304c\u3042\u308a\u307e\u3059\u3002

View file

@ -28,6 +28,8 @@
href="#searchOptions" class="label label-primary"
data-toggle="control-options"> <c:if test="${empty sort}">
<la:message key="labels.searchoptions_score" />
</c:if> <c:if test="${sort=='score.desc'}">
<la:message key="labels.searchoptions_score" />
</c:if> <c:if test="${sort=='created.asc'}">
<la:message key="labels.search_result_sort_created_asc" />
</c:if> <c:if test="${sort=='created.desc'}">
@ -48,6 +50,8 @@
<la:message key="labels.search_result_sort_favorite_count_asc" />
</c:if> <c:if test="${sort=='favorite_count.desc'}">
<la:message key="labels.search_result_sort_favorite_count_desc" />
</c:if> <c:if test="${sort.indexOf(',') >= 0}">
<la:message key="labels.search_result_sort_multiple" />
</c:if>
</a></li>
<li><la:message key="labels.searchoptions_menu_num" /> <a

View file

@ -102,7 +102,44 @@
</div>
</div>
<c:set var="pager" value="${kuromojiPager}" scope="request" />
<c:import url="/WEB-INF/view/common/admin/crud/pagination.jsp" />
<div class="row">
<div class="col-sm-2">
<la:message key="labels.pagination_page_guide_msg"
arg0="${f:h(pager.currentPageNumber)}"
arg1="${f:h(pager.allPageCount)}"
arg2="${f:h(pager.allRecordCount)}" />
</div>
<div class="col-sm-10">
<ul class="pagination pagination-sm no-margin pull-right">
<c:if test="${pager.existPrePage}">
<li class="prev"><la:link
href="list/${pager.currentPageNumber - 1}?dictId=${f:u(dictId)}">
<la:message key="labels.prev_page" />
</la:link></li>
</c:if>
<c:if test="${!pager.existPrePage}">
<li class="prev disabled"><a href="#"><la:message
key="labels.prev_page" /></a></li>
</c:if>
<c:forEach var="p" varStatus="s"
items="${pager.pageNumberList}">
<li
<c:if test="${p == pager.currentPageNumber}">class="active"</c:if>><la:link
href="list/${p}?dictId=${f:u(dictId)}">${p}</la:link></li>
</c:forEach>
<c:if test="${pager.existNextPage}">
<li class="next"><la:link
href="list/${pager.currentPageNumber + 1}?dictId=${f:u(dictId)}">
<la:message key="labels.next_page" />
</la:link></li>
</c:if>
<c:if test="${!pager.existNextPage}">
<li class="next disabled"><a href="#"><la:message
key="labels.next_page" /></a></li>
</c:if>
</ul>
</div>
</div>
</c:if>
</div>
<!-- /.box-body -->

View file

@ -102,7 +102,44 @@
</div>
</div>
<c:set var="pager" value="${synonymPager}" scope="request" />
<c:import url="/WEB-INF/view/common/admin/crud/pagination.jsp" />
<div class="row">
<div class="col-sm-2">
<la:message key="labels.pagination_page_guide_msg"
arg0="${f:h(pager.currentPageNumber)}"
arg1="${f:h(pager.allPageCount)}"
arg2="${f:h(pager.allRecordCount)}" />
</div>
<div class="col-sm-10">
<ul class="pagination pagination-sm no-margin pull-right">
<c:if test="${pager.existPrePage}">
<li class="prev"><la:link
href="list/${pager.currentPageNumber - 1}?dictId=${f:u(dictId)}">
<la:message key="labels.prev_page" />
</la:link></li>
</c:if>
<c:if test="${!pager.existPrePage}">
<li class="prev disabled"><a href="#"><la:message
key="labels.prev_page" /></a></li>
</c:if>
<c:forEach var="p" varStatus="s"
items="${pager.pageNumberList}">
<li
<c:if test="${p == pager.currentPageNumber}">class="active"</c:if>><la:link
href="list/${p}?dictId=${f:u(dictId)}">${p}</la:link></li>
</c:forEach>
<c:if test="${pager.existNextPage}">
<li class="next"><la:link
href="list/${pager.currentPageNumber + 1}?dictId=${f:u(dictId)}">
<la:message key="labels.next_page" />
</la:link></li>
</c:if>
<c:if test="${!pager.existNextPage}">
<li class="next disabled"><a href="#"><la:message
key="labels.next_page" /></a></li>
</c:if>
</ul>
</div>
</div>
</c:if>
</div>
<!-- /.box-body -->

View file

@ -66,6 +66,15 @@
styleClass="form-control" />
</div>
</div>
<div class="form-group">
<label for="defaultSortValue" class="col-sm-3 control-label"><la:message
key="labels.default_sort_value" /></label>
<div class="col-sm-9">
<la:errors property="defaultSortValue" />
<la:textarea property="defaultSortValue"
styleClass="form-control" />
</div>
</div>
<div class="form-group">
<label for="popularWord" class="col-sm-3 control-label"><la:message
key="labels.popular_word_word_enabled" /></label>

View file

@ -76,6 +76,9 @@ ${fe:facetForm()}${fe:geoForm()}
<option value="">
<la:message key="labels.search_result_select_sort" />
</option>
<la:option value="score.desc">
<la:message key="labels.search_result_sort_score_desc" />
</la:option>
<la:option value="created.asc">
<la:message key="labels.search_result_sort_created_asc" />
</la:option>

View file

@ -137,6 +137,9 @@
<option value="">
<la:message key="labels.search_result_select_sort" />
</option>
<la:option value="score.desc">
<la:message key="labels.search_result_sort_score_desc" />
</la:option>
<la:option value="created.asc">
<la:message key="labels.search_result_sort_created_asc" />
</la:option>

View file

@ -28,6 +28,8 @@
href="#searchOptions" class="label label-primary"
data-toggle="control-options"> <c:if test="${empty sort}">
<la:message key="labels.searchoptions_score" />
</c:if> <c:if test="${sort=='score.desc'}">
<la:message key="labels.searchoptions_score" />
</c:if> <c:if test="${sort=='created.asc'}">
<la:message key="labels.search_result_sort_created_asc" />
</c:if> <c:if test="${sort=='created.desc'}">
@ -48,6 +50,8 @@
<la:message key="labels.search_result_sort_favorite_count_asc" />
</c:if> <c:if test="${sort=='favorite_count.desc'}">
<la:message key="labels.search_result_sort_favorite_count_desc" />
</c:if> <c:if test="${sort.indexOf(',') >= 0}">
<la:message key="labels.search_result_sort_multiple" />
</c:if>
</a></li>
<li><la:message key="labels.searchoptions_menu_num" /> <a

View file

@ -28,8 +28,8 @@ $(function(){
$('#query').suggestor( {
ajaxinfo: {
url: contextPath + '/json',
fn: 'content',
url: contextPath + '/suggest',
fn: '_default,content,title',
num: 10
},
boxCssInfo: {

View file

@ -16,7 +16,6 @@
package org.codelibs.fess.validation;
import org.codelibs.fess.unit.UnitFessTestCase;
import org.codelibs.fess.validation.UriTypeValidator;
public class UriTypeValidatorTest extends UnitFessTestCase {
public void test_check_ok() {