diff --git a/plugin.xml b/plugin.xml index 01d989ad1a..7e05a5df42 100644 --- a/plugin.xml +++ b/plugin.xml @@ -44,8 +44,8 @@ - - + + diff --git a/pom.xml b/pom.xml index 070f6a1f47..76a415cf0e 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 org.codelibs.fess fess - 12.1.2-SNAPSHOT + 12.1.3-SNAPSHOT war Fess Fess is Full tExt Search System. @@ -60,13 +60,13 @@ 0.8.5 - 2.1.1 + 2.1.2 - 6.2.1 + 6.2.2 - 6.2.3 + 6.2.4 6.0.0 ${elasticsearch.version}.0 diff --git a/src/main/assemblies/files/fess.in.bat b/src/main/assemblies/files/fess.in.bat index b2b80f5733..dba2469197 100644 --- a/src/main/assemblies/files/fess.in.bat +++ b/src/main/assemblies/files/fess.in.bat @@ -65,6 +65,10 @@ set JAVA_OPTS=%JAVA_OPTS% -Dlog4j.shutdownHookEnabled=false set JAVA_OPTS=%JAVA_OPTS% -Dlog4j2.disable.jmx=true set JAVA_OPTS=%JAVA_OPTS% -Dlog4j.skipJansi=true +REM SSL truststore for certificate validation over https +REM JAVA_OPTS=%JAVA_OPTS% -Djavax.net.ssl.trustStore=/tech/elastic/config/truststore.jks +REM JAVA_OPTS=%JAVA_OPTS% -Djavax.net.ssl.trustStorePassword=changeit + if NOT "%FESS_USE_GC_LOGGING%" == "" set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCDetails if NOT "%FESS_USE_GC_LOGGING%" == "" set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCTimeStamps if NOT "%FESS_USE_GC_LOGGING%" == "" set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCDateStamps diff --git a/src/main/assemblies/files/fess.in.sh b/src/main/assemblies/files/fess.in.sh index dfba45fdf0..b206bd7b9d 100755 --- a/src/main/assemblies/files/fess.in.sh +++ b/src/main/assemblies/files/fess.in.sh @@ -18,6 +18,10 @@ fi #ES_TRANSPORT_URL=localhost:9300 #FESS_DICTIONARY_PATH=/var/lib/elasticsearch/config/ +# SSL truststore for certificate validation over https +#JAVA_OPTS="$JAVA_OPTS -Djavax.net.ssl.trustStore=/tech/elastic/config/truststore.jks" +#JAVA_OPTS="$JAVA_OPTS -Djavax.net.ssl.trustStorePassword=changeit" + # min and max heap sizes should be set to the same value to avoid # stop-the-world GC pauses during resize, and so that we can lock the # heap in memory on startup to prevent any of it from being swapped diff --git a/src/main/java/org/codelibs/fess/Constants.java b/src/main/java/org/codelibs/fess/Constants.java index ddb91b8726..a0b7b33b14 100644 --- a/src/main/java/org/codelibs/fess/Constants.java +++ b/src/main/java/org/codelibs/fess/Constants.java @@ -35,6 +35,8 @@ public class Constants extends CoreLibConstants { public static final Boolean F = false; + public static final String SCORE = "score"; + public static final String ON = "on"; public static final String READY = "ready"; diff --git a/src/main/java/org/codelibs/fess/api/json/JsonApiManager.java b/src/main/java/org/codelibs/fess/api/json/JsonApiManager.java index 064d8e264c..3ee007b860 100644 --- a/src/main/java/org/codelibs/fess/api/json/JsonApiManager.java +++ b/src/main/java/org/codelibs/fess/api/json/JsonApiManager.java @@ -138,34 +138,32 @@ protected void processScrollSearchRequest(final HttpServletRequest request, fina final JsonRequestParams params = new JsonRequestParams(request, fessConfig); try { response.setContentType("application/x-ndjson; charset=UTF-8"); - final long count = - searchService.scrollSearch(params, doc -> { - buf.setLength(0); - buf.append('{'); - boolean first2 = true; - for (final Map.Entry entry : doc.entrySet()) { - final String name = entry.getKey(); - if (StringUtil.isNotBlank(name) && entry.getValue() != null - && ComponentUtil.getQueryHelper().isApiResponseField(name)) { - if (!first2) { - buf.append(','); - } else { - first2 = false; - } - buf.append(escapeJson(name)); - buf.append(':'); - buf.append(escapeJson(entry.getValue())); - } - } - buf.append('}'); - buf.append('\n'); - try { - response.getWriter().print(buf.toString()); - } catch (final IOException e) { - throw new IORuntimeException(e); + final long count = searchService.scrollSearch(params, doc -> { + buf.setLength(0); + buf.append('{'); + boolean first2 = true; + for (final Map.Entry entry : doc.entrySet()) { + final String name = entry.getKey(); + if (StringUtil.isNotBlank(name) && entry.getValue() != null) { + if (!first2) { + buf.append(','); + } else { + first2 = false; } - return true; - }, OptionalThing.empty()); + buf.append(escapeJson(name)); + buf.append(':'); + buf.append(escapeJson(entry.getValue())); + } + } + buf.append('}'); + buf.append('\n'); + try { + response.getWriter().print(buf.toString()); + } catch (final IOException e) { + throw new IORuntimeException(e); + } + return true; + }, OptionalThing.empty()); response.flushBuffer(); if (logger.isDebugEnabled()) { logger.debug("Loaded " + count + " docs"); diff --git a/src/main/java/org/codelibs/fess/app/service/SearchService.java b/src/main/java/org/codelibs/fess/app/service/SearchService.java index ceba1a16ee..87c7e1b079 100644 --- a/src/main/java/org/codelibs/fess/app/service/SearchService.java +++ b/src/main/java/org/codelibs/fess/app/service/SearchService.java @@ -16,7 +16,6 @@ package org.codelibs.fess.app.service; import java.text.NumberFormat; -import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; @@ -43,6 +42,7 @@ import org.codelibs.fess.es.client.FessEsClientException; import org.codelibs.fess.helper.QueryHelper; import org.codelibs.fess.helper.SystemHelper; +import org.codelibs.fess.helper.ViewHelper; import org.codelibs.fess.mylasta.action.FessUserBean; import org.codelibs.fess.mylasta.direction.FessConfig; import org.codelibs.fess.util.ComponentUtil; @@ -107,7 +107,7 @@ public void search(final SearchRequestParams params, final SearchRenderData data fessConfig.getIndexDocumentSearchIndex(), fessConfig.getIndexDocumentType(), searchRequestBuilder -> { - fessConfig.processSearchPreference(searchRequestBuilder, userBean); + queryHelper.processSearchPreference(searchRequestBuilder, userBean); return SearchConditionBuilder.builder(searchRequestBuilder) .query(StringUtil.isBlank(sortField) ? query : query + " sort:" + sortField).offset(pageStart) .size(pageSize).facetInfo(params.getFacetInfo()).geoInfo(params.getGeoInfo()) @@ -192,29 +192,38 @@ public long scrollSearch(final SearchRequestParams params, final Function { - fessConfig.processSearchPreference(searchRequestBuilder, userBean); - return SearchConditionBuilder.builder(searchRequestBuilder) + queryHelper.processSearchPreference(searchRequestBuilder, userBean); + return SearchConditionBuilder.builder(searchRequestBuilder).scroll() .query(StringUtil.isBlank(sortField) ? query : query + " sort:" + sortField).size(pageSize) - .responseFields(queryHelper.getResponseFields()).searchRequestType(params.getType()).build(); + .responseFields(queryHelper.getScrollResponseFields()).searchRequestType(params.getType()).build(); }, (searchResponse, hit) -> { + final Map docMap = new HashMap<>(); final Map source = hit.getSourceAsMap(); if (source != null) { - final Map docMap = new HashMap<>(source); - docMap.put(fessConfig.getIndexFieldId(), hit.getId()); - docMap.put(fessConfig.getIndexFieldVersion(), hit.getVersion()); - return docMap; + docMap.putAll(source); } final Map fields = hit.getFields(); if (fields != null) { - final Map docMap = - fields.entrySet().stream() - .collect(Collectors.toMap(e -> e.getKey(), e -> (Object) e.getValue().getValues())); - docMap.put(fessConfig.getIndexFieldId(), hit.getId()); - docMap.put(fessConfig.getIndexFieldVersion(), hit.getVersion()); - return docMap; + docMap.putAll(fields.entrySet().stream() + .collect(Collectors.toMap(e -> e.getKey(), e -> (Object) e.getValue().getValues()))); } - return Collections.emptyMap(); + + final ViewHelper viewHelper = ComponentUtil.getViewHelper(); + if (viewHelper != null && !docMap.isEmpty()) { + docMap.put(fessConfig.getResponseFieldContentTitle(), viewHelper.getContentTitle(docMap)); + docMap.put(fessConfig.getResponseFieldContentDescription(), viewHelper.getContentDescription(docMap)); + docMap.put(fessConfig.getResponseFieldUrlLink(), viewHelper.getUrlLink(docMap)); + docMap.put(fessConfig.getResponseFieldSitePath(), viewHelper.getSitePath(docMap)); + } + + if (!docMap.containsKey(Constants.SCORE)) { + docMap.put(Constants.SCORE, hit.getScore()); + } + + docMap.put(fessConfig.getIndexFieldId(), hit.getId()); + docMap.put(fessConfig.getIndexFieldVersion(), hit.getVersion()); + return docMap; }, cursor); } @@ -287,7 +296,7 @@ public OptionalEntity> getDocumentByDocId(final String docId } builder.setQuery(boolQuery); builder.setFetchSource(fields, null); - fessConfig.processSearchPreference(builder, userBean); + queryHelper.processSearchPreference(builder, userBean); return true; }); @@ -314,7 +323,7 @@ public List> getDocumentListByDocIds(final String[] docIds, builder.setQuery(boolQuery); builder.setSize(fessConfig.getPagingSearchPageMaxSizeAsInteger().intValue()); builder.setFetchSource(fields, null); - fessConfig.processSearchPreference(builder, userBean); + queryHelper.processSearchPreference(builder, userBean); return true; }); } diff --git a/src/main/java/org/codelibs/fess/app/web/base/FessSearchAction.java b/src/main/java/org/codelibs/fess/app/web/base/FessSearchAction.java index d73fff57c4..213669cc5a 100644 --- a/src/main/java/org/codelibs/fess/app/web/base/FessSearchAction.java +++ b/src/main/java/org/codelibs/fess/app/web/base/FessSearchAction.java @@ -226,8 +226,7 @@ protected HtmlResponse redirectToLogin() { } protected HtmlResponse redirectToRoot() { - final String contextPath = request.getServletContext().getContextPath(); - return systemHelper.getRedirectResponseToRoot(newHtmlResponseAsRedirect(StringUtil.isBlank(contextPath) ? "/" : contextPath)); + return systemHelper.getRedirectResponseToRoot(newHtmlResponseAsRedirect("/")); } protected HtmlNext virtualHost(final HtmlNext path) { diff --git a/src/main/java/org/codelibs/fess/app/web/go/GoAction.java b/src/main/java/org/codelibs/fess/app/web/go/GoAction.java index 61fb460b4a..808beeff7d 100644 --- a/src/main/java/org/codelibs/fess/app/web/go/GoAction.java +++ b/src/main/java/org/codelibs/fess/app/web/go/GoAction.java @@ -21,7 +21,6 @@ import java.util.Map; import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; import org.codelibs.core.lang.StringUtil; import org.codelibs.core.net.URLUtil; @@ -40,7 +39,6 @@ import org.lastaflute.web.response.ActionResponse; import org.lastaflute.web.response.HtmlResponse; import org.lastaflute.web.response.StreamResponse; -import org.lastaflute.web.util.LaRequestUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -146,31 +144,13 @@ public ActionResponse index(final GoForm form) throws IOException { return redirect(ErrorAction.class); } } else { - return redirect(targetUrl + hash); + return HtmlResponse.fromRedirectPathAsIs(targetUrl + hash); } } else { - return redirect(targetUrl + hash); + return HtmlResponse.fromRedirectPathAsIs(DocumentUtil.encodeUrl(targetUrl + hash)); } } - protected ActionResponse redirect(final String url) { - final HttpServletRequest request2 = LaRequestUtil.getRequest(); - final String enc = request2.getCharacterEncoding() == null ? Constants.UTF_8 : request2.getCharacterEncoding(); - final StringBuilder buf = new StringBuilder(url.length() + 100); - for (final char c : url.toCharArray()) { - if (CharUtil.isUrlChar(c)) { - buf.append(c); - } else { - try { - buf.append(URLEncoder.encode(String.valueOf(c), enc)); - } catch (final UnsupportedEncodingException e) { - buf.append(c); - } - } - } - return HtmlResponse.fromRedirectPathAsIs(buf.toString()); - } - protected boolean isFileSystemPath(final String url) { return url.startsWith("file:") || url.startsWith("smb:") || url.startsWith("ftp:"); } diff --git a/src/main/java/org/codelibs/fess/app/web/thumbnail/ThumbnailAction.java b/src/main/java/org/codelibs/fess/app/web/thumbnail/ThumbnailAction.java index cf5622ef17..bc267e7a99 100644 --- a/src/main/java/org/codelibs/fess/app/web/thumbnail/ThumbnailAction.java +++ b/src/main/java/org/codelibs/fess/app/web/thumbnail/ThumbnailAction.java @@ -61,8 +61,10 @@ public ActionResponse index(final ThumbnailForm form) { final File thumbnailFile = thumbnailManager.getThumbnailFile(doc); if (thumbnailFile == null) { + if (fessConfig.isThumbnailEnabled()) { + thumbnailManager.offer(doc); + } // 404 - thumbnailManager.offer(doc); throw responseManager.new404("Thumbnail for " + form.docId + " is under generating."); } diff --git a/src/main/java/org/codelibs/fess/es/client/FessEsClient.java b/src/main/java/org/codelibs/fess/es/client/FessEsClient.java index d4a3f4a472..364ea857ea 100644 --- a/src/main/java/org/codelibs/fess/es/client/FessEsClient.java +++ b/src/main/java/org/codelibs/fess/es/client/FessEsClient.java @@ -184,6 +184,10 @@ public class FessEsClient implements Client { protected String scrollForDelete = "1m"; + protected int maxConfigSyncStatusRetry = 10; + + protected int maxEsStatusRetry = 10; + public void addIndexConfig(final String path) { indexConfigList.add(path); } @@ -400,6 +404,8 @@ public boolean createIndex(final String index, final String docType, final Strin } source = source.replaceAll(Pattern.quote("${fess.dictionary.path}"), dictionaryPath); source = source.replaceAll(Pattern.quote("${fess.index.codec}"), fessConfig.getIndexCodec()); + source = source.replaceAll(Pattern.quote("${fess.index.number_of_shards}"), fessConfig.getIndexNumberOfShards()); + source = source.replaceAll(Pattern.quote("${fess.index.auto_expand_replicas}"), fessConfig.getIndexAutoExpandReplicas()); final CreateIndexResponse indexResponse = client.admin().indices().prepareCreate(indexName).setSource(source, XContentType.JSON).execute() .actionGet(fessConfig.getIndexIndicesTimeout()); @@ -587,37 +593,65 @@ protected void insertBulkData(final FessConfig fessConfig, final String configIn } } - private void waitForYellowStatus(final FessConfig fessConfig) { - try { - final ClusterHealthResponse response = - client.admin().cluster().prepareHealth().setWaitForYellowStatus().execute() - .actionGet(fessConfig.getIndexHealthTimeout()); + protected void waitForYellowStatus(final FessConfig fessConfig) { + Exception cause = null; + for (int i = 0; i < maxEsStatusRetry; i++) { + try { + final ClusterHealthResponse response = + client.admin().cluster().prepareHealth().setWaitForYellowStatus().execute() + .actionGet(fessConfig.getIndexHealthTimeout()); + if (logger.isDebugEnabled()) { + logger.debug("Elasticsearch Cluster Status: " + response.getStatus()); + } + return; + } catch (final Exception e) { + cause = e; + } if (logger.isDebugEnabled()) { - logger.debug("Elasticsearch Cluster Status: " + response.getStatus()); + logger.debug("Failed to access to Elasticsearch:" + i, cause); + } + try { + Thread.sleep(1000L); + } catch (InterruptedException e) { + // ignore } - } catch (final Exception e) { - final String message = - "Elasticsearch (" + System.getProperty(Constants.FESS_ES_TRANSPORT_ADDRESSES) - + ") is not available. Check the state of your Elasticsearch cluster (" - + fessConfig.getElasticsearchClusterName() + ")."; - throw new ContainerInitFailureException(message, e); } - } - - private void waitForConfigSyncStatus() { - try (CurlResponse response = ComponentUtil.getCurlHelper().get("/_configsync/wait").param("status", "green").execute()) { - if (response.getHttpStatusCode() == 200) { - logger.info("ConfigSync is ready."); - } else { - if (response.getContentException() != null) { - throw new FessSystemException("Configsync is not available.", response.getContentException()); + final String message = + "Elasticsearch (" + System.getProperty(Constants.FESS_ES_TRANSPORT_ADDRESSES) + + ") is not available. Check the state of your Elasticsearch cluster (" + fessConfig.getElasticsearchClusterName() + + ")."; + throw new ContainerInitFailureException(message, cause); + } + + protected void waitForConfigSyncStatus() { + FessSystemException cause = null; + for (int i = 0; i < maxConfigSyncStatusRetry; i++) { + try (CurlResponse response = ComponentUtil.getCurlHelper().get("/_configsync/wait").param("status", "green").execute()) { + final int httpStatusCode = response.getHttpStatusCode(); + if (httpStatusCode == 200) { + logger.info("ConfigSync is ready."); + return; } else { - throw new FessSystemException("Configsync is not available.", response.getContentException()); + final String message = "Configsync is not available. HTTP Status is " + httpStatusCode; + if (response.getContentException() != null) { + throw new FessSystemException(message, response.getContentException()); + } else { + throw new FessSystemException(message); + } } + } catch (final Exception e) { + cause = new FessSystemException("Configsync is not available.", e); + } + if (logger.isDebugEnabled()) { + logger.debug("Failed to access to configsync:" + i, cause); + } + try { + Thread.sleep(1000L); + } catch (InterruptedException e) { + // ignore } - } catch (final IOException e) { - throw new FessSystemException("Configsync is not available.", e); } + throw cause; } @Override @@ -644,8 +678,7 @@ public long deleteByQuery(final String index, final String type, final QueryBuil SearchResponse response = client.prepareSearch(index).setTypes(type).setScroll(scrollForDelete).setSize(sizeForDelete) .setFetchSource(new String[] { fessConfig.getIndexFieldId() }, null).setQuery(queryBuilder) - .setPreference(Constants.SEARCH_PREFERENCE_LOCAL).execute() - .actionGet(fessConfig.getIndexScrollSearchTimeoutTimeout()); + .setPreference(Constants.SEARCH_PREFERENCE_LOCAL).execute().actionGet(fessConfig.getIndexScrollSearchTimeout()); int count = 0; String scrollId = response.getScrollId(); @@ -939,6 +972,7 @@ public static class SearchConditionBuilder { private FacetInfo facetInfo; private String similarDocHash; private SearchRequestType searchRequestType = SearchRequestType.SEARCH; + private boolean isScroll = false; public static SearchConditionBuilder builder(final SearchRequestBuilder searchRequestBuilder) { return new SearchConditionBuilder(searchRequestBuilder); @@ -990,6 +1024,11 @@ public SearchConditionBuilder facetInfo(final FacetInfo facetInfo) { return this; } + public SearchConditionBuilder scroll() { + this.isScroll = true; + return this; + } + public boolean build() { if (StringUtil.isBlank(query)) { return false; @@ -1076,7 +1115,8 @@ public boolean build() { })); } - if (!SearchRequestType.ADMIN_SEARCH.equals(searchRequestType) && fessConfig.isResultCollapsed() && similarDocHash == null) { + if (!SearchRequestType.ADMIN_SEARCH.equals(searchRequestType) && !isScroll && fessConfig.isResultCollapsed() + && similarDocHash == null) { searchRequestBuilder.setCollapse(getCollapseBuilder(fessConfig)); } @@ -1435,6 +1475,14 @@ public void setScrollForSearch(final String scrollForSearch) { this.scrollForSearch = scrollForSearch; } + public void setMaxConfigSyncStatusRetry(int maxConfigSyncStatusRetry) { + this.maxConfigSyncStatusRetry = maxConfigSyncStatusRetry; + } + + public void setMaxEsStatusRetry(int maxEsStatusRetry) { + this.maxEsStatusRetry = maxEsStatusRetry; + } + @Override public Client filterWithHeader(final Map headers) { return client.filterWithHeader(headers); diff --git a/src/main/java/org/codelibs/fess/es/config/exentity/PathMapping.java b/src/main/java/org/codelibs/fess/es/config/exentity/PathMapping.java index 502213516f..8d544563ac 100644 --- a/src/main/java/org/codelibs/fess/es/config/exentity/PathMapping.java +++ b/src/main/java/org/codelibs/fess/es/config/exentity/PathMapping.java @@ -15,22 +15,30 @@ */ package org.codelibs.fess.es.config.exentity; +import java.util.function.BiFunction; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.codelibs.core.lang.StringUtil; import org.codelibs.fess.es.config.bsentity.BsPathMapping; +import org.codelibs.fess.util.ComponentUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @author FreeGen */ public class PathMapping extends BsPathMapping { + private static final Logger logger = LoggerFactory.getLogger(PathMapping.class); + private static final long serialVersionUID = 1L; - private Pattern regexPattern; + protected Pattern userAgentPattern; + + protected Pattern regexPattern; - private Pattern userAgentPattern; + protected BiFunction pathMapper; public String getId() { return asDocMeta().id(); @@ -48,11 +56,23 @@ public void setVersionNo(final Long version) { asDocMeta().version(version); } - public Matcher getMatcher(final CharSequence input) { + public String process(final String input) { if (regexPattern == null) { regexPattern = Pattern.compile(getRegex()); } - return regexPattern.matcher(input); + final Matcher matcher = regexPattern.matcher(input); + if (matcher.find()) { + if (pathMapper == null) { + final String replacement = StringUtil.isNotBlank(getReplacement()) ? getReplacement() : StringUtil.EMPTY; + pathMapper = ComponentUtil.getPathMappingHelper().createPathMatcher(matcher, replacement); + } + try { + return pathMapper.apply(input, matcher); + } catch (Exception e) { + logger.warn("Failed to apply " + pathMapper, e); + } + } + return input; } public boolean hasUAMathcer() { diff --git a/src/main/java/org/codelibs/fess/helper/PathMappingHelper.java b/src/main/java/org/codelibs/fess/helper/PathMappingHelper.java index 3f751b0301..8726a2166d 100644 --- a/src/main/java/org/codelibs/fess/helper/PathMappingHelper.java +++ b/src/main/java/org/codelibs/fess/helper/PathMappingHelper.java @@ -19,6 +19,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.function.BiFunction; import java.util.regex.Matcher; import javax.annotation.PostConstruct; @@ -28,6 +29,8 @@ import org.codelibs.fess.es.config.exbhv.PathMappingBhv; import org.codelibs.fess.es.config.exentity.PathMapping; import org.codelibs.fess.util.ComponentUtil; +import org.codelibs.fess.util.DocumentUtil; +import org.codelibs.fess.util.GroovyUtil; import org.lastaflute.di.core.factory.SingletonLaContainerFactory; import org.lastaflute.web.util.LaRequestUtil; import org.slf4j.Logger; @@ -37,6 +40,10 @@ public class PathMappingHelper { private static final Logger logger = LoggerFactory.getLogger(PathMappingHelper.class); + private static final String FUNCTION_ENCODEURL_MATCHER = "function:encodeUrl"; + + private static final String GROOVY_MATCHER = "groovy:"; + private final Map> pathMappingMap = new HashMap<>(); volatile List cachedPathMappingList = null; @@ -126,18 +133,31 @@ public String replaceUrl(final String url) { return replaceUrl(cachedPathMappingList, url); } + public BiFunction createPathMatcher(final Matcher matcher, final String replacement) { + if (replacement.equals(FUNCTION_ENCODEURL_MATCHER)) { + return (u, m) -> DocumentUtil.encodeUrl(u); + } else if (replacement.startsWith(GROOVY_MATCHER)) { + final String template = replacement.substring(GROOVY_MATCHER.length()); + return (u, m) -> { + final Map paramMap = new HashMap<>(); + paramMap.put("url", u); + paramMap.put("matcher", m); + final Object value = GroovyUtil.evaluate(template, paramMap); + if (value == null) { + return u; + } + return value.toString(); + }; + } else { + return (u, m) -> m.replaceAll(replacement); + } + } + private String replaceUrl(final List pathMappingList, final String url) { String newUrl = url; for (final PathMapping pathMapping : pathMappingList) { if (matchUserAgent(pathMapping)) { - final Matcher matcher = pathMapping.getMatcher(newUrl); - if (matcher.find()) { - String replacement = pathMapping.getReplacement(); - if (replacement == null) { - replacement = StringUtil.EMPTY; - } - newUrl = matcher.replaceAll(replacement); - } + newUrl = pathMapping.process(newUrl); } } return newUrl; diff --git a/src/main/java/org/codelibs/fess/helper/QueryHelper.java b/src/main/java/org/codelibs/fess/helper/QueryHelper.java index 21885c47d7..ae2f5b4337 100644 --- a/src/main/java/org/codelibs/fess/helper/QueryHelper.java +++ b/src/main/java/org/codelibs/fess/helper/QueryHelper.java @@ -32,6 +32,7 @@ import javax.annotation.PostConstruct; import javax.annotation.Resource; +import javax.servlet.http.HttpSession; import org.apache.lucene.index.Term; import org.apache.lucene.queryparser.classic.ParseException; @@ -55,9 +56,11 @@ import org.codelibs.fess.entity.QueryContext; import org.codelibs.fess.entity.SearchRequestParams.SearchRequestType; import org.codelibs.fess.exception.InvalidQueryException; +import org.codelibs.fess.mylasta.action.FessUserBean; import org.codelibs.fess.mylasta.direction.FessConfig; import org.codelibs.fess.util.ComponentUtil; import org.dbflute.optional.OptionalThing; +import org.elasticsearch.action.search.SearchRequestBuilder; import org.elasticsearch.common.unit.Fuzziness; import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.QueryBuilder; @@ -107,6 +110,8 @@ public class QueryHelper { protected String[] responseFields; + protected String[] scrollResponseFields; + protected String[] cacheResponseFields; protected String[] highlightedFields; @@ -162,6 +167,31 @@ public void init() { fessConfig.getIndexFieldLang(), // fessConfig.getIndexFieldHasCache()); } + if (scrollResponseFields == null) { + scrollResponseFields = fessConfig.getQueryAdditionalScrollResponseFields(// + SCORE_FIELD, // + fessConfig.getIndexFieldId(), // + fessConfig.getIndexFieldDocId(), // + fessConfig.getIndexFieldBoost(), // + fessConfig.getIndexFieldContentLength(), // + fessConfig.getIndexFieldHost(), // + fessConfig.getIndexFieldSite(), // + fessConfig.getIndexFieldLastModified(), // + fessConfig.getIndexFieldTimestamp(), // + fessConfig.getIndexFieldMimetype(), // + fessConfig.getIndexFieldFiletype(), // + fessConfig.getIndexFieldFilename(), // + fessConfig.getIndexFieldCreated(), // + fessConfig.getIndexFieldTitle(), // + fessConfig.getIndexFieldDigest(), // + fessConfig.getIndexFieldUrl(), // + fessConfig.getIndexFieldThumbnail(), // + fessConfig.getIndexFieldClickCount(), // + fessConfig.getIndexFieldFavoriteCount(), // + fessConfig.getIndexFieldConfigId(), // + fessConfig.getIndexFieldLang(), // + fessConfig.getIndexFieldHasCache()); + } if (cacheResponseFields == null) { cacheResponseFields = fessConfig.getQueryAdditionalCacheResponseFields(// SCORE_FIELD, // @@ -699,6 +729,37 @@ public boolean isApiResponseField(final String field) { return apiResponseFieldSet.contains(field); } + public void processSearchPreference(final SearchRequestBuilder searchRequestBuilder, final OptionalThing userBean) { + userBean.map(user -> { + if (user.hasRoles(fessConfig.getAuthenticationAdminRolesAsArray())) { + return Constants.SEARCH_PREFERENCE_LOCAL; + } + return user.getUserId(); + }).ifPresent(p -> searchRequestBuilder.setPreference(p)).orElse(() -> LaRequestUtil.getOptionalRequest().map(r -> { + final HttpSession session = r.getSession(false); + if (session != null) { + return session.getId(); + } + final String preference = r.getParameter("preference"); + if (preference != null) { + return Integer.toString(preference.hashCode()); + } + final Object accessType = r.getAttribute(Constants.SEARCH_LOG_ACCESS_TYPE); + if (Constants.SEARCH_LOG_ACCESS_TYPE_JSON.equals(accessType)) { + final String pref = fessConfig.getQueryJsonDefaultPreference(); + if (StringUtil.isNotBlank(pref)) { + return pref; + } + } else if (Constants.SEARCH_LOG_ACCESS_TYPE_XML.equals(accessType)) { + final String pref = fessConfig.getQueryGsaDefaultPreference(); + if (StringUtil.isNotBlank(pref)) { + return pref; + } + } + return null; + }).ifPresent(p -> searchRequestBuilder.setPreference(p))); + } + /** * @return the responseFields */ @@ -713,6 +774,14 @@ public void setResponseFields(final String[] responseFields) { this.responseFields = responseFields; } + public String[] getScrollResponseFields() { + return scrollResponseFields; + } + + public void setScrollResponseFields(String[] scrollResponseFields) { + this.scrollResponseFields = scrollResponseFields; + } + public String[] getCacheResponseFields() { return cacheResponseFields; } diff --git a/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java b/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java index b27d6f20fa..34dc557868 100644 --- a/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java +++ b/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java @@ -362,6 +362,12 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction /** The key of the configuration. e.g. default */ String INDEX_CODEC = "index.codec"; + /** The key of the configuration. e.g. 5 */ + String INDEX_number_of_shards = "index.number_of_shards"; + + /** The key of the configuration. e.g. 0-1 */ + String INDEX_auto_expand_replicas = "index.auto_expand_replicas"; + /** The key of the configuration. e.g. favorite_count */ String INDEX_FIELD_favorite_count = "index.field.favorite_count"; @@ -531,7 +537,7 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction 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"; + String INDEX_SCROLL_SEARCH_TIMEOUT = "index.scroll.search.timeout"; /** The key of the configuration. e.g. 3m */ String INDEX_INDEX_TIMEOUT = "index.index.timeout"; @@ -581,6 +587,9 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction /** The key of the configuration. e.g. */ String QUERY_ADDITIONAL_API_RESPONSE_FIELDS = "query.additional.api.response.fields"; + /** The key of the configuration. e.g. */ + String QUERY_ADDITIONAL_SCROLL_RESPONSE_FIELDS = "query.additional.scroll.response.fields"; + /** The key of the configuration. e.g. */ String QUERY_ADDITIONAL_CACHE_RESPONSE_FIELDS = "query.additional.cache.response.fields"; @@ -620,6 +629,12 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction /** The key of the configuration. e.g. */ String QUERY_DEFAULT_LANGUAGES = "query.default.languages"; + /** The key of the configuration. e.g. _local */ + String QUERY_JSON_DEFAULT_PREFERENCE = "query.json.default.preference"; + + /** The key of the configuration. e.g. _local */ + String QUERY_GSA_DEFAULT_PREFERENCE = "query.gsa.default.preference"; + /** The key of the configuration. e.g. ar=ar bg=bg bn=bn @@ -2432,6 +2447,28 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction */ String getIndexCodec(); + /** + * Get the value for the key 'index.number_of_shards'.
+ * The value is, e.g. 5
+ * @return The value of found property. (NotNull: if not found, exception but basically no way) + */ + String getIndexNumberOfShards(); + + /** + * Get the value for the key 'index.number_of_shards' as {@link Integer}.
+ * The value is, e.g. 5
+ * @return The value of found property. (NotNull: if not found, exception but basically no way) + * @throws NumberFormatException When the property is not integer. + */ + Integer getIndexNumberOfShardsAsInteger(); + + /** + * Get the value for the key 'index.auto_expand_replicas'.
+ * The value is, e.g. 0-1
+ * @return The value of found property. (NotNull: if not found, exception but basically no way) + */ + String getIndexAutoExpandReplicas(); + /** * Get the value for the key 'index.field.favorite_count'.
* The value is, e.g. favorite_count
@@ -2861,11 +2898,11 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction String getIndexSearchTimeout(); /** - * Get the value for the key 'index.scroll.search.timeout.timeout'.
+ * Get the value for the key 'index.scroll.search.timeout'.
* The value is, e.g. 3m
* @return The value of found property. (NotNull: if not found, exception but basically no way) */ - String getIndexScrollSearchTimeoutTimeout(); + String getIndexScrollSearchTimeout(); /** * Get the value for the key 'index.index.timeout'.
@@ -3044,6 +3081,21 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction */ Integer getQueryAdditionalApiResponseFieldsAsInteger(); + /** + * Get the value for the key 'query.additional.scroll.response.fields'.
+ * The value is, e.g.
+ * @return The value of found property. (NotNull: if not found, exception but basically no way) + */ + String getQueryAdditionalScrollResponseFields(); + + /** + * Get the value for the key 'query.additional.scroll.response.fields' as {@link Integer}.
+ * The value is, e.g.
+ * @return The value of found property. (NotNull: if not found, exception but basically no way) + * @throws NumberFormatException When the property is not integer. + */ + Integer getQueryAdditionalScrollResponseFieldsAsInteger(); + /** * Get the value for the key 'query.additional.cache.response.fields'.
* The value is, e.g.
@@ -3223,6 +3275,20 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction */ Integer getQueryDefaultLanguagesAsInteger(); + /** + * Get the value for the key 'query.json.default.preference'.
+ * The value is, e.g. _local
+ * @return The value of found property. (NotNull: if not found, exception but basically no way) + */ + String getQueryJsonDefaultPreference(); + + /** + * Get the value for the key 'query.gsa.default.preference'.
+ * The value is, e.g. _local
+ * @return The value of found property. (NotNull: if not found, exception but basically no way) + */ + String getQueryGsaDefaultPreference(); + /** * Get the value for the key 'query.language.mapping'.
* The value is, e.g. ar=ar @@ -6201,6 +6267,18 @@ public String getIndexCodec() { return get(FessConfig.INDEX_CODEC); } + public String getIndexNumberOfShards() { + return get(FessConfig.INDEX_number_of_shards); + } + + public Integer getIndexNumberOfShardsAsInteger() { + return getAsInteger(FessConfig.INDEX_number_of_shards); + } + + public String getIndexAutoExpandReplicas() { + return get(FessConfig.INDEX_auto_expand_replicas); + } + public String getIndexFieldFavoriteCount() { return get(FessConfig.INDEX_FIELD_favorite_count); } @@ -6441,8 +6519,8 @@ public String getIndexSearchTimeout() { return get(FessConfig.INDEX_SEARCH_TIMEOUT); } - public String getIndexScrollSearchTimeoutTimeout() { - return get(FessConfig.INDEX_SCROLL_SEARCH_TIMEOUT_TIMEOUT); + public String getIndexScrollSearchTimeout() { + return get(FessConfig.INDEX_SCROLL_SEARCH_TIMEOUT); } public String getIndexIndexTimeout() { @@ -6541,6 +6619,14 @@ public Integer getQueryAdditionalApiResponseFieldsAsInteger() { return getAsInteger(FessConfig.QUERY_ADDITIONAL_API_RESPONSE_FIELDS); } + public String getQueryAdditionalScrollResponseFields() { + return get(FessConfig.QUERY_ADDITIONAL_SCROLL_RESPONSE_FIELDS); + } + + public Integer getQueryAdditionalScrollResponseFieldsAsInteger() { + return getAsInteger(FessConfig.QUERY_ADDITIONAL_SCROLL_RESPONSE_FIELDS); + } + public String getQueryAdditionalCacheResponseFields() { return get(FessConfig.QUERY_ADDITIONAL_CACHE_RESPONSE_FIELDS); } @@ -6637,6 +6723,14 @@ public Integer getQueryDefaultLanguagesAsInteger() { return getAsInteger(FessConfig.QUERY_DEFAULT_LANGUAGES); } + public String getQueryJsonDefaultPreference() { + return get(FessConfig.QUERY_JSON_DEFAULT_PREFERENCE); + } + + public String getQueryGsaDefaultPreference() { + return get(FessConfig.QUERY_GSA_DEFAULT_PREFERENCE); + } + public String getQueryLanguageMapping() { return get(FessConfig.QUERY_LANGUAGE_MAPPING); } @@ -8032,6 +8126,8 @@ protected java.util.Map prepareGeneratedDefaultMap() { defaultMap.put(FessConfig.INDEXER_DATA_MAX_DOCUMENT_CACHE_SIZE, "5"); defaultMap.put(FessConfig.INDEXER_DATA_MAX_DOCUMENT_REQUEST_SIZE, "10485760"); defaultMap.put(FessConfig.INDEX_CODEC, "default"); + defaultMap.put(FessConfig.INDEX_number_of_shards, "5"); + defaultMap.put(FessConfig.INDEX_auto_expand_replicas, "0-1"); defaultMap.put(FessConfig.INDEX_FIELD_favorite_count, "favorite_count"); defaultMap.put(FessConfig.INDEX_FIELD_click_count, "click_count"); defaultMap.put(FessConfig.INDEX_FIELD_config_id, "config_id"); @@ -8088,7 +8184,7 @@ protected java.util.Map prepareGeneratedDefaultMap() { defaultMap.put(FessConfig.INDEX_ADMIN_DOUBLE_FIELDS, ""); defaultMap.put(FessConfig.INDEX_ADMIN_REQUIRED_FIELDS, "url,title,role,boost"); defaultMap.put(FessConfig.INDEX_SEARCH_TIMEOUT, "3m"); - defaultMap.put(FessConfig.INDEX_SCROLL_SEARCH_TIMEOUT_TIMEOUT, "3m"); + defaultMap.put(FessConfig.INDEX_SCROLL_SEARCH_TIMEOUT, "3m"); defaultMap.put(FessConfig.INDEX_INDEX_TIMEOUT, "3m"); defaultMap.put(FessConfig.INDEX_BULK_TIMEOUT, "3m"); defaultMap.put(FessConfig.INDEX_DELETE_TIMEOUT, "3m"); @@ -8105,6 +8201,7 @@ protected java.util.Map prepareGeneratedDefaultMap() { defaultMap.put(FessConfig.QUERY_MAX_SEARCH_RESULT_OFFSET, "100000"); defaultMap.put(FessConfig.QUERY_ADDITIONAL_RESPONSE_FIELDS, ""); defaultMap.put(FessConfig.QUERY_ADDITIONAL_API_RESPONSE_FIELDS, ""); + defaultMap.put(FessConfig.QUERY_ADDITIONAL_SCROLL_RESPONSE_FIELDS, ""); defaultMap.put(FessConfig.QUERY_ADDITIONAL_CACHE_RESPONSE_FIELDS, ""); defaultMap.put(FessConfig.QUERY_ADDITIONAL_HIGHLIGHTED_FIELDS, ""); defaultMap.put(FessConfig.QUERY_ADDITIONAL_SEARCH_FIELDS, ""); @@ -8118,6 +8215,8 @@ protected java.util.Map prepareGeneratedDefaultMap() { defaultMap.put(FessConfig.QUERY_COLLAPSE_INNER_HITS_SIZE, "0"); defaultMap.put(FessConfig.QUERY_COLLAPSE_INNER_HITS_SORTS, ""); defaultMap.put(FessConfig.QUERY_DEFAULT_LANGUAGES, ""); + defaultMap.put(FessConfig.QUERY_JSON_DEFAULT_PREFERENCE, "_local"); + defaultMap.put(FessConfig.QUERY_GSA_DEFAULT_PREFERENCE, "_local"); defaultMap .put(FessConfig.QUERY_LANGUAGE_MAPPING, "ar=ar\nbg=bg\nbn=bn\nca=ca\nckb-iq=ckb-iq\nckb_IQ=ckb-iq\ncs=cs\nda=da\nde=de\nel=el\nen=en\nen-ie=en-ie\nen_IE=en-ie\nes=es\net=et\neu=eu\nfa=fa\nfi=fi\nfr=fr\ngl=gl\ngu=gu\nhe=he\nhi=hi\nhr=hr\nhu=hu\nhy=hy\nid=id\nit=it\nja=ja\nko=ko\nlt=lt\nlv=lv\nmk=mk\nml=ml\nnl=nl\nno=no\npa=pa\npl=pl\npt=pt\npt-br=pt-br\npt_BR=pt-br\nro=ro\nru=ru\nsi=si\nsq=sq\nsv=sv\nta=ta\nte=te\nth=th\ntl=tl\ntr=tr\nuk=uk\nur=ur\nvi=vi\nzh-cn=zh-cn\nzh_CN=zh-cn\nzh-tw=zh-tw\nzh_TW=zh-tw\nzh=zh\n"); diff --git a/src/main/java/org/codelibs/fess/mylasta/direction/FessProp.java b/src/main/java/org/codelibs/fess/mylasta/direction/FessProp.java index 52a5ef006d..e2e03309c4 100644 --- a/src/main/java/org/codelibs/fess/mylasta/direction/FessProp.java +++ b/src/main/java/org/codelibs/fess/mylasta/direction/FessProp.java @@ -43,7 +43,6 @@ import javax.naming.directory.Attribute; import javax.naming.directory.BasicAttribute; -import javax.servlet.http.HttpSession; import org.codelibs.core.exception.ClassNotFoundRuntimeException; import org.codelibs.core.lang.StringUtil; @@ -57,13 +56,11 @@ import org.codelibs.fess.util.ComponentUtil; import org.codelibs.fess.util.PrunedTag; import org.dbflute.optional.OptionalThing; -import org.elasticsearch.action.search.SearchRequestBuilder; import org.elasticsearch.search.sort.SortBuilder; import org.elasticsearch.search.sort.SortBuilders; import org.elasticsearch.search.sort.SortOrder; import org.lastaflute.job.LaJob; import org.lastaflute.job.subsidiary.JobConcurrentExec; -import org.lastaflute.web.util.LaRequestUtil; import org.lastaflute.web.validation.RequiredValidator; import org.lastaflute.web.validation.theme.typed.DoubleTypeValidator; import org.lastaflute.web.validation.theme.typed.FloatTypeValidator; @@ -1078,25 +1075,6 @@ public default boolean isValidCrawlerFileProtocol(final String url) { return stream(getCrawlerFileProtocolsAsArray()).get(stream -> stream.anyMatch(s -> url.startsWith(s))); } - public default void processSearchPreference(final SearchRequestBuilder searchRequestBuilder, final OptionalThing userBean) { - userBean.map(user -> { - if (user.hasRoles(getAuthenticationAdminRolesAsArray())) { - return Constants.SEARCH_PREFERENCE_LOCAL; - } - return user.getUserId(); - }).ifPresent(p -> searchRequestBuilder.setPreference(p)).orElse(() -> LaRequestUtil.getOptionalRequest().map(r -> { - final HttpSession session = r.getSession(false); - if (session != null) { - return session.getId(); - } - final String preference = r.getParameter("preference"); - if (preference != null) { - return Integer.toString(preference.hashCode()); - } - return null; - }).ifPresent(p -> searchRequestBuilder.setPreference(p))); - } - String getRoleSearchDefaultPermissions(); public default String[] getSearchDefaultPermissionsAsArray() { @@ -1506,6 +1484,16 @@ public default String[] getQueryAdditionalResponseFields(final String... fields) return list.toArray(new String[list.size()]); } + String getQueryAdditionalScrollResponseFields(); + + public default String[] getQueryAdditionalScrollResponseFields(final String... fields) { + final List list = new ArrayList<>(fields.length + 10); + stream(fields).of(stream -> stream.forEach(list::add)); + split(getQueryAdditionalScrollResponseFields(), ",").of( + stream -> stream.filter(StringUtil::isNotBlank).map(s -> s.trim()).forEach(list::add)); + return list.toArray(new String[list.size()]); + } + String getQueryAdditionalCacheResponseFields(); public default String[] getQueryAdditionalCacheResponseFields(final String... fields) { diff --git a/src/main/java/org/codelibs/fess/util/DocumentUtil.java b/src/main/java/org/codelibs/fess/util/DocumentUtil.java index ec6640f8c5..666ef51794 100644 --- a/src/main/java/org/codelibs/fess/util/DocumentUtil.java +++ b/src/main/java/org/codelibs/fess/util/DocumentUtil.java @@ -15,11 +15,16 @@ */ package org.codelibs.fess.util; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; import java.util.Date; import java.util.List; import java.util.Map; +import org.codelibs.fess.Constants; +import org.codelibs.fess.crawler.util.CharUtil; import org.codelibs.fess.taglib.FessFunctions; +import org.lastaflute.web.util.LaRequestUtil; public final class DocumentUtil { @@ -107,4 +112,23 @@ private static T convertObj(final Object value, final Class clazz) { } return null; } + + public static String encodeUrl(final String url) { + final String enc = + LaRequestUtil.getOptionalRequest().filter(req -> req.getCharacterEncoding() != null).map(req -> req.getCharacterEncoding()) + .orElse(Constants.UTF_8); + final StringBuilder buf = new StringBuilder(url.length() + 100); + for (final char c : url.toCharArray()) { + if (CharUtil.isUrlChar(c)) { + buf.append(c); + } else { + try { + buf.append(URLEncoder.encode(String.valueOf(c), enc)); + } catch (final UnsupportedEncodingException e) { + buf.append(c); + } + } + } + return buf.toString(); + } } diff --git a/src/main/java/org/codelibs/fess/util/QueryResponseList.java b/src/main/java/org/codelibs/fess/util/QueryResponseList.java index f9d1085080..8ae9bb1ee8 100644 --- a/src/main/java/org/codelibs/fess/util/QueryResponseList.java +++ b/src/main/java/org/codelibs/fess/util/QueryResponseList.java @@ -26,6 +26,7 @@ import org.apache.commons.lang3.StringUtils; import org.codelibs.core.lang.StringUtil; import org.codelibs.core.stream.StreamUtil; +import org.codelibs.fess.Constants; import org.codelibs.fess.helper.QueryHelper; import org.codelibs.fess.helper.ViewHelper; import org.codelibs.fess.mylasta.direction.FessConfig; @@ -44,8 +45,6 @@ public class QueryResponseList implements List> { private static final String ELLIPSIS = "..."; - private static final String SCORE = "score"; - private static final Logger logger = LoggerFactory.getLogger(QueryResponseList.class); private final List> parent; @@ -186,8 +185,8 @@ private Map parseSearchHit(final FessConfig fessConfig, final St docMap.put(fessConfig.getResponseFieldSitePath(), viewHelper.getSitePath(docMap)); } - if (!docMap.containsKey(SCORE)) { - docMap.put(SCORE, searchHit.getScore()); + if (!docMap.containsKey(Constants.SCORE)) { + docMap.put(Constants.SCORE, searchHit.getScore()); } return docMap; } diff --git a/src/main/java/org/codelibs/fess/util/ResourceUtil.java b/src/main/java/org/codelibs/fess/util/ResourceUtil.java index 7c74317032..fff2a3c455 100644 --- a/src/main/java/org/codelibs/fess/util/ResourceUtil.java +++ b/src/main/java/org/codelibs/fess/util/ResourceUtil.java @@ -31,6 +31,10 @@ import org.lastaflute.web.util.LaServletContextUtil; public class ResourceUtil { + private static final String FESS_APP_TYPE = "FESS_APP_TYPE"; + + private static final String FESS_APP_DOCKER = "docker"; + protected ResourceUtil() { // nothing } @@ -45,6 +49,13 @@ public static String getElasticsearchHttpUrl() { } public static Path getConfPath(final String... names) { + final String fessAppType = System.getenv(FESS_APP_TYPE); + if (FESS_APP_DOCKER.equalsIgnoreCase(fessAppType)) { + final Path confPath = Paths.get("/opt/fess", names); + if (Files.exists(confPath)) { + return confPath; + } + } final String confPath = System.getProperty(Constants.FESS_CONF_PATH); if (StringUtil.isNotBlank(confPath)) { return Paths.get(confPath, names); diff --git a/src/main/resources/esclient.xml b/src/main/resources/esclient.xml index 5b24c6a8f8..f8fe6c919a 100644 --- a/src/main/resources/esclient.xml +++ b/src/main/resources/esclient.xml @@ -6,6 +6,14 @@ {"http.cors.enabled":"true", "http.cors.allow-origin":"*"} + diff --git a/src/main/resources/fess_config.properties b/src/main/resources/fess_config.properties index 9340a9e032..f2791674a3 100644 --- a/src/main/resources/fess_config.properties +++ b/src/main/resources/fess_config.properties @@ -207,6 +207,8 @@ indexer.data.max.document.request.size=10485760 # index setting index.codec=default +index.number_of_shards=5 +index.auto_expand_replicas=0-1 # field names index.field.favorite_count=favorite_count @@ -271,7 +273,7 @@ index.admin.required.fields=url,title,role,boost # timeout index.search.timeout=3m -index.scroll.search.timeout.timeout=3m +index.scroll.search.timeout=3m index.index.timeout=3m index.bulk.timeout=3m index.delete.timeout=3m @@ -290,6 +292,7 @@ query.highlight.type=fvh query.max.search.result.offset=100000 query.additional.response.fields= query.additional.api.response.fields= +query.additional.scroll.response.fields= query.additional.cache.response.fields= query.additional.highlighted.fields= query.additional.search.fields= @@ -303,6 +306,8 @@ query.collapse.inner.hits.name=similar_docs query.collapse.inner.hits.size=0 query.collapse.inner.hits.sorts= query.default.languages= +query.json.default.preference=_local +query.gsa.default.preference=_local query.language.mapping=\ ar=ar\n\ bg=bg\n\ diff --git a/src/main/resources/fess_indices/.fess_config.access_token.json b/src/main/resources/fess_indices/.fess_config.access_token.json index def7bad83a..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_config.access_token.json +++ b/src/main/resources/fess_indices/.fess_config.access_token.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 2, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/.fess_config.bad_word.json b/src/main/resources/fess_indices/.fess_config.bad_word.json index def7bad83a..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_config.bad_word.json +++ b/src/main/resources/fess_indices/.fess_config.bad_word.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 2, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/.fess_config.boost_document_rule.json b/src/main/resources/fess_indices/.fess_config.boost_document_rule.json index def7bad83a..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_config.boost_document_rule.json +++ b/src/main/resources/fess_indices/.fess_config.boost_document_rule.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 2, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/.fess_config.crawling_info.json b/src/main/resources/fess_indices/.fess_config.crawling_info.json index def7bad83a..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_config.crawling_info.json +++ b/src/main/resources/fess_indices/.fess_config.crawling_info.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 2, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/.fess_config.crawling_info_param.json b/src/main/resources/fess_indices/.fess_config.crawling_info_param.json index def7bad83a..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_config.crawling_info_param.json +++ b/src/main/resources/fess_indices/.fess_config.crawling_info_param.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 2, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/.fess_config.data_config.json b/src/main/resources/fess_indices/.fess_config.data_config.json index def7bad83a..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_config.data_config.json +++ b/src/main/resources/fess_indices/.fess_config.data_config.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 2, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/.fess_config.data_config_to_label.json b/src/main/resources/fess_indices/.fess_config.data_config_to_label.json index def7bad83a..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_config.data_config_to_label.json +++ b/src/main/resources/fess_indices/.fess_config.data_config_to_label.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 2, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/.fess_config.data_config_to_role.json b/src/main/resources/fess_indices/.fess_config.data_config_to_role.json index def7bad83a..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_config.data_config_to_role.json +++ b/src/main/resources/fess_indices/.fess_config.data_config_to_role.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 2, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/.fess_config.duplicate_host.json b/src/main/resources/fess_indices/.fess_config.duplicate_host.json index def7bad83a..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_config.duplicate_host.json +++ b/src/main/resources/fess_indices/.fess_config.duplicate_host.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 2, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/.fess_config.elevate_word.json b/src/main/resources/fess_indices/.fess_config.elevate_word.json index def7bad83a..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_config.elevate_word.json +++ b/src/main/resources/fess_indices/.fess_config.elevate_word.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 2, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/.fess_config.elevate_word_to_label.json b/src/main/resources/fess_indices/.fess_config.elevate_word_to_label.json index def7bad83a..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_config.elevate_word_to_label.json +++ b/src/main/resources/fess_indices/.fess_config.elevate_word_to_label.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 2, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/.fess_config.failure_url.json b/src/main/resources/fess_indices/.fess_config.failure_url.json index def7bad83a..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_config.failure_url.json +++ b/src/main/resources/fess_indices/.fess_config.failure_url.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 2, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/.fess_config.file_authentication.json b/src/main/resources/fess_indices/.fess_config.file_authentication.json index def7bad83a..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_config.file_authentication.json +++ b/src/main/resources/fess_indices/.fess_config.file_authentication.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 2, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/.fess_config.file_config.json b/src/main/resources/fess_indices/.fess_config.file_config.json index def7bad83a..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_config.file_config.json +++ b/src/main/resources/fess_indices/.fess_config.file_config.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 2, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/.fess_config.file_config_to_label.json b/src/main/resources/fess_indices/.fess_config.file_config_to_label.json index def7bad83a..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_config.file_config_to_label.json +++ b/src/main/resources/fess_indices/.fess_config.file_config_to_label.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 2, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/.fess_config.file_config_to_role.json b/src/main/resources/fess_indices/.fess_config.file_config_to_role.json index def7bad83a..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_config.file_config_to_role.json +++ b/src/main/resources/fess_indices/.fess_config.file_config_to_role.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 2, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/.fess_config.job_log.json b/src/main/resources/fess_indices/.fess_config.job_log.json index def7bad83a..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_config.job_log.json +++ b/src/main/resources/fess_indices/.fess_config.job_log.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 2, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/.fess_config.key_match.json b/src/main/resources/fess_indices/.fess_config.key_match.json index def7bad83a..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_config.key_match.json +++ b/src/main/resources/fess_indices/.fess_config.key_match.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 2, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/.fess_config.label_to_role.json b/src/main/resources/fess_indices/.fess_config.label_to_role.json index def7bad83a..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_config.label_to_role.json +++ b/src/main/resources/fess_indices/.fess_config.label_to_role.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 2, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/.fess_config.label_type.json b/src/main/resources/fess_indices/.fess_config.label_type.json index def7bad83a..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_config.label_type.json +++ b/src/main/resources/fess_indices/.fess_config.label_type.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 2, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/.fess_config.path_mapping.json b/src/main/resources/fess_indices/.fess_config.path_mapping.json index def7bad83a..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_config.path_mapping.json +++ b/src/main/resources/fess_indices/.fess_config.path_mapping.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 2, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/.fess_config.related_content.json b/src/main/resources/fess_indices/.fess_config.related_content.json index def7bad83a..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_config.related_content.json +++ b/src/main/resources/fess_indices/.fess_config.related_content.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 2, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/.fess_config.related_query.json b/src/main/resources/fess_indices/.fess_config.related_query.json index def7bad83a..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_config.related_query.json +++ b/src/main/resources/fess_indices/.fess_config.related_query.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 2, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/.fess_config.request_header.json b/src/main/resources/fess_indices/.fess_config.request_header.json index def7bad83a..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_config.request_header.json +++ b/src/main/resources/fess_indices/.fess_config.request_header.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 2, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/.fess_config.role_type.json b/src/main/resources/fess_indices/.fess_config.role_type.json index def7bad83a..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_config.role_type.json +++ b/src/main/resources/fess_indices/.fess_config.role_type.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 2, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/.fess_config.scheduled_job.json b/src/main/resources/fess_indices/.fess_config.scheduled_job.json index def7bad83a..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_config.scheduled_job.json +++ b/src/main/resources/fess_indices/.fess_config.scheduled_job.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 2, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/.fess_config.thumbnail_queue.json b/src/main/resources/fess_indices/.fess_config.thumbnail_queue.json index def7bad83a..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_config.thumbnail_queue.json +++ b/src/main/resources/fess_indices/.fess_config.thumbnail_queue.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 2, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/.fess_config.web_authentication.json b/src/main/resources/fess_indices/.fess_config.web_authentication.json index def7bad83a..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_config.web_authentication.json +++ b/src/main/resources/fess_indices/.fess_config.web_authentication.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 2, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/.fess_config.web_config.json b/src/main/resources/fess_indices/.fess_config.web_config.json index def7bad83a..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_config.web_config.json +++ b/src/main/resources/fess_indices/.fess_config.web_config.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 2, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/.fess_config.web_config_to_label.json b/src/main/resources/fess_indices/.fess_config.web_config_to_label.json index def7bad83a..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_config.web_config_to_label.json +++ b/src/main/resources/fess_indices/.fess_config.web_config_to_label.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 2, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/.fess_config.web_config_to_role.json b/src/main/resources/fess_indices/.fess_config.web_config_to_role.json index def7bad83a..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_config.web_config_to_role.json +++ b/src/main/resources/fess_indices/.fess_config.web_config_to_role.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 2, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/.fess_user.group.json b/src/main/resources/fess_indices/.fess_user.group.json index 095b0fe6a4..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_user.group.json +++ b/src/main/resources/fess_indices/.fess_user.group.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 5, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/.fess_user.role.json b/src/main/resources/fess_indices/.fess_user.role.json index 095b0fe6a4..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_user.role.json +++ b/src/main/resources/fess_indices/.fess_user.role.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 5, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/.fess_user.user.json b/src/main/resources/fess_indices/.fess_user.user.json index 095b0fe6a4..8f94f93c21 100644 --- a/src/main/resources/fess_indices/.fess_user.user.json +++ b/src/main/resources/fess_indices/.fess_user.user.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 5, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/fess.json b/src/main/resources/fess_indices/fess.json index 838f6fece8..e504cfa2a3 100644 --- a/src/main/resources/fess_indices/fess.json +++ b/src/main/resources/fess_indices/fess.json @@ -3,8 +3,9 @@ "index": { "codec": "${fess.index.codec}", "refresh_interval": "1s", - "number_of_shards": 5, - "number_of_replicas": 0 + "number_of_shards": "${fess.index.number_of_shards}", + "number_of_replicas": 0, + "auto_expand_replicas": "${fess.index.auto_expand_replicas}" }, "analysis": { "char_filter": { diff --git a/src/main/resources/fess_indices/fess_log.click_log.json b/src/main/resources/fess_indices/fess_log.click_log.json index e3657f0d6d..8e09856114 100644 --- a/src/main/resources/fess_indices/fess_log.click_log.json +++ b/src/main/resources/fess_indices/fess_log.click_log.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 10, - "number_of_replicas": 0 + "number_of_shards": 5, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/fess_log.favorite_log.json b/src/main/resources/fess_indices/fess_log.favorite_log.json index e3657f0d6d..8e09856114 100644 --- a/src/main/resources/fess_indices/fess_log.favorite_log.json +++ b/src/main/resources/fess_indices/fess_log.favorite_log.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 10, - "number_of_replicas": 0 + "number_of_shards": 5, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/fess_log.search_log.json b/src/main/resources/fess_indices/fess_log.search_log.json index e3657f0d6d..8e09856114 100644 --- a/src/main/resources/fess_indices/fess_log.search_log.json +++ b/src/main/resources/fess_indices/fess_log.search_log.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 10, - "number_of_replicas": 0 + "number_of_shards": 5, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/fess_indices/fess_log.user_info.json b/src/main/resources/fess_indices/fess_log.user_info.json index e3657f0d6d..8e09856114 100644 --- a/src/main/resources/fess_indices/fess_log.user_info.json +++ b/src/main/resources/fess_indices/fess_log.user_info.json @@ -2,8 +2,9 @@ "settings": { "index": { "refresh_interval": "1s", - "number_of_shards": 10, - "number_of_replicas": 0 + "number_of_shards": 5, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" } } } diff --git a/src/main/resources/suggest_indices/suggest_analyzer.json b/src/main/resources/suggest_indices/suggest_analyzer.json index 95f418d500..1062b39b49 100644 --- a/src/main/resources/suggest_indices/suggest_analyzer.json +++ b/src/main/resources/suggest_indices/suggest_analyzer.json @@ -1,8 +1,9 @@ { "index": { "refresh_interval": "1s", - "number_of_shards": 5, - "number_of_replicas": 0 + "number_of_shards": 1, + "number_of_replicas": 0, + "auto_expand_replicas": "0-1" }, "analysis" : { "tokenizer" : { diff --git a/src/main/webapp/WEB-INF/conf/.gitkeep b/src/main/webapp/WEB-INF/conf/.keep similarity index 100% rename from src/main/webapp/WEB-INF/conf/.gitkeep rename to src/main/webapp/WEB-INF/conf/.keep diff --git a/src/main/webapp/WEB-INF/orig/view/searchResults.jsp b/src/main/webapp/WEB-INF/orig/view/searchResults.jsp index f71bab0489..1b1a3c635e 100644 --- a/src/main/webapp/WEB-INF/orig/view/searchResults.jsp +++ b/src/main/webapp/WEB-INF/orig/view/searchResults.jsp @@ -189,7 +189,7 @@
    @@ -205,12 +205,12 @@ class="hidden-xs" class="active"> ${f:h(pageNumber)} + href="/search/move?q=${f:u(q)}&pn=${f:u(pageNumber)}&num=${f:u(pageSize)}&sdh=${f:u(fe:sdh(sdh))}${fe:pagingQuery(null)}${fe:facetQuery()}${fe:geoQuery()}">${f:h(pageNumber)} diff --git a/src/main/webapp/WEB-INF/thumbnails/.keep b/src/main/webapp/WEB-INF/thumbnails/.keep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/main/webapp/WEB-INF/view/searchResults.jsp b/src/main/webapp/WEB-INF/view/searchResults.jsp index f71bab0489..1b1a3c635e 100644 --- a/src/main/webapp/WEB-INF/view/searchResults.jsp +++ b/src/main/webapp/WEB-INF/view/searchResults.jsp @@ -189,7 +189,7 @@
      @@ -205,12 +205,12 @@ class="hidden-xs" class="active"> ${f:h(pageNumber)} + href="/search/move?q=${f:u(q)}&pn=${f:u(pageNumber)}&num=${f:u(pageSize)}&sdh=${f:u(fe:sdh(sdh))}${fe:pagingQuery(null)}${fe:facetQuery()}${fe:geoQuery()}">${f:h(pageNumber)}