Merge branch '10.3.x'
This commit is contained in:
commit
c1bbcaa26f
15 changed files with 127 additions and 96 deletions
2
pom.xml
2
pom.xml
|
@ -63,7 +63,7 @@
|
|||
<suggest.version>2.3.1</suggest.version>
|
||||
|
||||
<!-- Elasticsearch -->
|
||||
<elasticsearch.version>2.4.1</elasticsearch.version>
|
||||
<elasticsearch.version>2.4.2</elasticsearch.version>
|
||||
<cluster.runner.version>2.4.0.0</cluster.runner.version>
|
||||
|
||||
<!-- Tomcat -->
|
||||
|
|
|
@ -39,7 +39,6 @@ import org.lastaflute.web.Execute;
|
|||
import org.lastaflute.web.response.HtmlResponse;
|
||||
import org.lastaflute.web.response.render.RenderData;
|
||||
import org.lastaflute.web.ruts.process.ActionRuntime;
|
||||
import org.lastaflute.web.util.LaRequestUtil;
|
||||
|
||||
/**
|
||||
* @author shinsuke
|
||||
|
@ -274,7 +273,7 @@ public class AdminFileauthAction extends FessAdminAction {
|
|||
|
||||
protected void registerProtocolSchemeItems(final RenderData data) {
|
||||
final List<Map<String, String>> itemList = new ArrayList<>();
|
||||
final Locale locale = LaRequestUtil.getRequest().getLocale();
|
||||
final Locale locale = ComponentUtil.getRequestManager().getUserLocale();
|
||||
itemList.add(createItem(ComponentUtil.getMessageManager().getMessage(locale, "labels.file_auth_scheme_samba"), Constants.SAMBA));
|
||||
itemList.add(createItem(ComponentUtil.getMessageManager().getMessage(locale, "labels.file_auth_scheme_ftp"), Constants.FTP));
|
||||
RenderDataUtil.register(data, "protocolSchemeItems", itemList);
|
||||
|
|
|
@ -132,7 +132,7 @@ public class ListForm implements SearchRequestParams {
|
|||
|
||||
@Override
|
||||
public Locale getLocale() {
|
||||
return LaRequestUtil.getRequest().getLocale();
|
||||
return ComponentUtil.getRequestManager().getUserLocale();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -39,7 +39,6 @@ import org.lastaflute.web.Execute;
|
|||
import org.lastaflute.web.response.HtmlResponse;
|
||||
import org.lastaflute.web.response.render.RenderData;
|
||||
import org.lastaflute.web.ruts.process.ActionRuntime;
|
||||
import org.lastaflute.web.util.LaRequestUtil;
|
||||
|
||||
/**
|
||||
* @author shinsuke
|
||||
|
@ -275,7 +274,7 @@ public class AdminWebauthAction extends FessAdminAction {
|
|||
|
||||
protected void registerProtocolSchemeItems(final RenderData data) {
|
||||
final List<Map<String, String>> itemList = new ArrayList<>();
|
||||
final Locale locale = LaRequestUtil.getRequest().getLocale();
|
||||
final Locale locale = ComponentUtil.getRequestManager().getUserLocale();
|
||||
itemList.add(createItem(ComponentUtil.getMessageManager().getMessage(locale, "labels.webauth_scheme_basic"), Constants.BASIC));
|
||||
itemList.add(createItem(ComponentUtil.getMessageManager().getMessage(locale, "labels.webauth_scheme_digest"), Constants.DIGEST));
|
||||
itemList.add(createItem(ComponentUtil.getMessageManager().getMessage(locale, "labels.webauth_scheme_ntlm"), Constants.NTLM));
|
||||
|
|
|
@ -41,6 +41,7 @@ import org.codelibs.fess.helper.SystemHelper;
|
|||
import org.codelibs.fess.helper.UserInfoHelper;
|
||||
import org.codelibs.fess.helper.ViewHelper;
|
||||
import org.codelibs.fess.thumbnail.ThumbnailManager;
|
||||
import org.codelibs.fess.util.ComponentUtil;
|
||||
import org.dbflute.optional.OptionalThing;
|
||||
import org.lastaflute.web.login.LoginManager;
|
||||
import org.lastaflute.web.response.ActionResponse;
|
||||
|
@ -118,7 +119,7 @@ public abstract class FessSearchAction extends FessBaseAction {
|
|||
runtime.registerData("labelTypeItems", labelTypeItems);
|
||||
runtime.registerData("displayLabelTypeItems", labelTypeItems != null && !labelTypeItems.isEmpty());
|
||||
|
||||
Locale locale = request.getLocale();
|
||||
Locale locale = ComponentUtil.getRequestManager().getUserLocale();
|
||||
if (locale == null) {
|
||||
locale = Locale.ENGLISH;
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ public class SearchForm implements SearchRequestParams {
|
|||
|
||||
@Override
|
||||
public Locale getLocale() {
|
||||
return LaRequestUtil.getRequest().getLocale();
|
||||
return ComponentUtil.getRequestManager().getUserLocale();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -942,8 +942,9 @@ public class FessEsClient implements Client {
|
|||
}
|
||||
|
||||
final QueryHelper queryHelper = ComponentUtil.getQueryHelper();
|
||||
final FessConfig fessConfig = ComponentUtil.getFessConfig();
|
||||
|
||||
if (offset > queryHelper.getMaxSearchResultOffset()) {
|
||||
if (offset > fessConfig.getQueryMaxSearchResultOffsetAsInteger()) {
|
||||
throw new ResultOffsetExceededException("The number of result size is exceeded.");
|
||||
}
|
||||
|
||||
|
@ -970,7 +971,7 @@ public class FessEsClient implements Client {
|
|||
|
||||
// highlighting
|
||||
queryHelper.highlightedFields(stream -> stream.forEach(hf -> searchRequestBuilder.addHighlightedField(hf,
|
||||
queryHelper.getHighlightFragmentSize())));
|
||||
fessConfig.getQueryHighlightFragmentSizeAsInteger())));
|
||||
|
||||
// facets
|
||||
if (facetInfo != null) {
|
||||
|
|
|
@ -21,7 +21,6 @@ import org.codelibs.fess.es.config.bsentity.BsCrawlingInfoParam;
|
|||
import org.codelibs.fess.es.config.exbhv.CrawlingInfoBhv;
|
||||
import org.codelibs.fess.util.ComponentUtil;
|
||||
import org.dbflute.optional.OptionalEntity;
|
||||
import org.lastaflute.web.util.LaRequestUtil;
|
||||
|
||||
/**
|
||||
* @author ESFlute (using FreeGen)
|
||||
|
@ -59,7 +58,7 @@ public class CrawlingInfoParam extends BsCrawlingInfoParam {
|
|||
}
|
||||
|
||||
public String getKeyMsg() {
|
||||
final Locale locale = LaRequestUtil.getRequest().getLocale();
|
||||
final Locale locale = ComponentUtil.getRequestManager().getUserLocale();
|
||||
final String message = ComponentUtil.getMessageManager().getMessage(locale, "labels.crawling_info_" + getKey());
|
||||
if (message == null || message.startsWith("???")) {
|
||||
return getKey();
|
||||
|
|
|
@ -110,7 +110,8 @@ public class QueryHelper {
|
|||
|
||||
protected String[] sortFields;
|
||||
|
||||
protected int highlightFragmentSize = 100;
|
||||
@Deprecated
|
||||
public int highlightFragmentSize = 100;
|
||||
|
||||
protected String additionalQuery;
|
||||
|
||||
|
@ -120,7 +121,8 @@ public class QueryHelper {
|
|||
|
||||
protected Map<String, String[]> requestParameterMap = new HashMap<>();
|
||||
|
||||
protected int maxSearchResultOffset = 100000;
|
||||
@Deprecated
|
||||
public int maxSearchResultOffset = 100000;
|
||||
|
||||
protected SortBuilder[] defaultSortBuilders;
|
||||
|
||||
|
@ -682,7 +684,6 @@ public class QueryHelper {
|
|||
|
||||
public void highlightedFields(final Consumer<Stream<String>> stream) {
|
||||
stream(highlightedFields).of(stream);
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -745,20 +746,6 @@ public class QueryHelper {
|
|||
highlightFieldSet.add(field);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the highlightFragmentSize
|
||||
*/
|
||||
public int getHighlightFragmentSize() {
|
||||
return highlightFragmentSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param highlightFragmentSize the highlightFragmentSize to set
|
||||
*/
|
||||
public void setHighlightFragmentSize(final int highlightFragmentSize) {
|
||||
this.highlightFragmentSize = highlightFragmentSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the additionalQuery
|
||||
*/
|
||||
|
@ -801,14 +788,6 @@ public class QueryHelper {
|
|||
return requestParameterMap.entrySet();
|
||||
}
|
||||
|
||||
public int getMaxSearchResultOffset() {
|
||||
return maxSearchResultOffset;
|
||||
}
|
||||
|
||||
public void setMaxSearchResultOffset(final int maxSearchResultOffset) {
|
||||
this.maxSearchResultOffset = maxSearchResultOffset;
|
||||
}
|
||||
|
||||
public void addDefaultSort(final String fieldName, final String order) {
|
||||
final List<SortBuilder> list = new ArrayList<>();
|
||||
if (defaultSortBuilders != null) {
|
||||
|
|
|
@ -50,7 +50,6 @@ import org.codelibs.fess.util.ComponentUtil;
|
|||
import org.lastaflute.web.TypicalAction;
|
||||
import org.lastaflute.web.ruts.process.ActionRuntime;
|
||||
import org.lastaflute.web.servlet.request.RequestManager;
|
||||
import org.lastaflute.web.util.LaRequestUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -176,19 +175,15 @@ public class SystemHelper {
|
|||
|
||||
public String getHelpLink(final String name) {
|
||||
final String url = ComponentUtil.getFessConfig().getOnlineHelpBaseLink() + name + "-guide.html";
|
||||
return LaRequestUtil
|
||||
.getOptionalRequest()
|
||||
.map(request -> {
|
||||
final Locale locale = request.getLocale();
|
||||
if (locale != null) {
|
||||
final String lang = locale.getLanguage();
|
||||
if (ComponentUtil.getFessConfig().isOnlineHelpSupportedLang(lang)) {
|
||||
return url.replaceFirst("\\{lang\\}", lang).replaceFirst("\\{version\\}",
|
||||
Constants.MAJOR_VERSION + "." + Constants.MINOR_VERSION);
|
||||
}
|
||||
}
|
||||
return getDefaultHelpLink(url);
|
||||
}).orElse(getDefaultHelpLink(url));
|
||||
final Locale locale = ComponentUtil.getRequestManager().getUserLocale();
|
||||
if (locale != null) {
|
||||
final String lang = locale.getLanguage();
|
||||
if (ComponentUtil.getFessConfig().isOnlineHelpSupportedLang(lang)) {
|
||||
return url.replaceFirst("\\{lang\\}", lang).replaceFirst("\\{version\\}",
|
||||
Constants.MAJOR_VERSION + "." + Constants.MINOR_VERSION);
|
||||
}
|
||||
}
|
||||
return getDefaultHelpLink(url);
|
||||
}
|
||||
|
||||
protected String getDefaultHelpLink(final String url) {
|
||||
|
|
|
@ -25,11 +25,9 @@ import java.net.URLEncoder;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
@ -99,6 +97,7 @@ public class ViewHelper {
|
|||
@Resource
|
||||
protected UserAgentHelper userAgentHelper;
|
||||
|
||||
@Deprecated
|
||||
public int descriptionLength = 200;
|
||||
|
||||
public int titleLength = 50;
|
||||
|
@ -111,6 +110,7 @@ public class ViewHelper {
|
|||
|
||||
public String[] highlightedFields = new String[] { "hl_content", "digest" };
|
||||
|
||||
@Deprecated
|
||||
public boolean useHighlight = false;
|
||||
|
||||
public String originalHighlightTagPre = "<em>";
|
||||
|
@ -139,10 +139,8 @@ public class ViewHelper {
|
|||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
if (useHighlight) {
|
||||
escapedHighlightPre = LaFunctions.h(originalHighlightTagPre);
|
||||
escapedHighlightPost = LaFunctions.h(originalHighlightTagPost);
|
||||
}
|
||||
escapedHighlightPre = LaFunctions.h(originalHighlightTagPre);
|
||||
escapedHighlightPost = LaFunctions.h(originalHighlightTagPost);
|
||||
}
|
||||
|
||||
public String getContentTitle(final Map<String, Object> document) {
|
||||
|
@ -159,24 +157,10 @@ public class ViewHelper {
|
|||
}
|
||||
|
||||
public String getContentDescription(final Map<String, Object> document) {
|
||||
final Set<String> queries = new HashSet<>();
|
||||
LaRequestUtil.getOptionalRequest().ifPresent(request -> {
|
||||
@SuppressWarnings("unchecked")
|
||||
final Set<String> set = (Set<String>) request.getAttribute(Constants.HIGHLIGHT_QUERIES);
|
||||
if (set != null) {
|
||||
queries.addAll(set);
|
||||
}
|
||||
});
|
||||
final int size = descriptionLength;
|
||||
|
||||
for (final String field : highlightedFields) {
|
||||
final String text = DocumentUtil.getValue(document, field, String.class);
|
||||
if (StringUtil.isNotBlank(text)) {
|
||||
if (useHighlight) {
|
||||
return escapeHighlight(text);
|
||||
} else {
|
||||
return highlight(LaFunctions.h(StringUtils.abbreviate(removeHighlightTag(text), size)), queries);
|
||||
}
|
||||
return escapeHighlight(text);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -184,28 +168,13 @@ public class ViewHelper {
|
|||
}
|
||||
|
||||
protected String escapeHighlight(final String text) {
|
||||
return LaFunctions.h(text).replaceAll(escapedHighlightPre, originalHighlightTagPre)
|
||||
.replaceAll(escapedHighlightPost, originalHighlightTagPost);
|
||||
return LaFunctions.h(text).replaceAll(escapedHighlightPre, highlightTagPre).replaceAll(escapedHighlightPost, highlightTagPost);
|
||||
}
|
||||
|
||||
protected String removeHighlightTag(final String str) {
|
||||
return str.replaceAll(originalHighlightTagPre, StringUtil.EMPTY).replaceAll(originalHighlightTagPost, StringUtil.EMPTY);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
protected String highlight(final String content, final Set<String> queries) {
|
||||
if (StringUtil.isBlank(content) || queries.isEmpty()) {
|
||||
return content;
|
||||
}
|
||||
String newContent = content;
|
||||
for (final String query : queries) {
|
||||
newContent =
|
||||
Pattern.compile(Pattern.quote(query), Pattern.CASE_INSENSITIVE).matcher(newContent)
|
||||
.replaceAll(highlightTagPre + query + highlightTagPost);
|
||||
}
|
||||
return newContent;
|
||||
}
|
||||
|
||||
public String getUrlLink(final Map<String, Object> document) {
|
||||
// file protocol
|
||||
String url = DocumentUtil.getValue(document, "url", String.class);
|
||||
|
@ -348,7 +317,7 @@ public class ViewHelper {
|
|||
}
|
||||
|
||||
public String getPagePath(final String page) {
|
||||
final Locale locale = LaRequestUtil.getRequest().getLocale();
|
||||
final Locale locale = ComponentUtil.getRequestManager().getUserLocale();
|
||||
final String lang = locale.getLanguage();
|
||||
final String country = locale.getCountry();
|
||||
|
||||
|
@ -409,7 +378,7 @@ public class ViewHelper {
|
|||
final FileTemplateLoader loader = new FileTemplateLoader(ResourceUtil.getViewTemplatePath().toFile());
|
||||
final Handlebars handlebars = new Handlebars(loader);
|
||||
|
||||
Locale locale = LaRequestUtil.getRequest().getLocale();
|
||||
Locale locale = ComponentUtil.getRequestManager().getUserLocale();
|
||||
if (locale == null) {
|
||||
locale = Locale.ENGLISH;
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
|
|||
-XX:+UseParNewGC
|
||||
-XX:+UseTLAB
|
||||
-XX:+DisableExplicitGC
|
||||
-XX:+HeapDumpOnOutOfMemoryError
|
||||
-XX:-OmitStackTraceInFastThrow
|
||||
-Djcifs.smb.client.connTimeout=60000
|
||||
-Djcifs.smb.client.soTimeout=35000
|
||||
|
@ -70,6 +71,7 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
|
|||
-XX:+UseParNewGC
|
||||
-XX:+UseTLAB
|
||||
-XX:+DisableExplicitGC
|
||||
-XX:+HeapDumpOnOutOfMemoryError
|
||||
-Dgroovy.use.classvalue=true
|
||||
*/
|
||||
String JVM_SUGGEST_OPTIONS = "jvm.suggest.options";
|
||||
|
@ -424,9 +426,18 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
|
|||
/** The key of the configuration. e.g. location */
|
||||
String QUERY_GEO_FIELDS = "query.geo.fields";
|
||||
|
||||
/** The key of the configuration. e.g. browser_lang */
|
||||
String QUERY_BROWSER_LANG_PARAMETER_NAME = "query.browser.lang.parameter.name";
|
||||
|
||||
/** The key of the configuration. e.g. true */
|
||||
String QUERY_REPLACE_TERM_WITH_PREFIX_QUERY = "query.replace.term.with.prefix.query";
|
||||
|
||||
/** The key of the configuration. e.g. 100 */
|
||||
String QUERY_HIGHLIGHT_FRAGMENT_SIZE = "query.highlight.fragment.size";
|
||||
|
||||
/** The key of the configuration. e.g. 100000 */
|
||||
String QUERY_MAX_SEARCH_RESULT_OFFSET = "query.max.search.result.offset";
|
||||
|
||||
/** The key of the configuration. e.g. */
|
||||
String QUERY_ADDITIONAL_RESPONSE_FIELDS = "query.additional.response.fields";
|
||||
|
||||
|
@ -1137,6 +1148,7 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
|
|||
-XX:+UseParNewGC
|
||||
-XX:+UseTLAB
|
||||
-XX:+DisableExplicitGC
|
||||
-XX:+HeapDumpOnOutOfMemoryError
|
||||
-XX:-OmitStackTraceInFastThrow
|
||||
-Djcifs.smb.client.connTimeout=60000
|
||||
-Djcifs.smb.client.soTimeout=35000
|
||||
|
@ -1161,6 +1173,7 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
|
|||
-XX:+UseParNewGC
|
||||
-XX:+UseTLAB
|
||||
-XX:+DisableExplicitGC
|
||||
-XX:+HeapDumpOnOutOfMemoryError
|
||||
-Dgroovy.use.classvalue=true
|
||||
<br>
|
||||
* @return The value of found property. (NotNull: if not found, exception but basically no way)
|
||||
|
@ -2272,6 +2285,13 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
|
|||
*/
|
||||
String getQueryGeoFields();
|
||||
|
||||
/**
|
||||
* Get the value for the key 'query.browser.lang.parameter.name'. <br>
|
||||
* The value is, e.g. browser_lang <br>
|
||||
* @return The value of found property. (NotNull: if not found, exception but basically no way)
|
||||
*/
|
||||
String getQueryBrowserLangParameterName();
|
||||
|
||||
/**
|
||||
* Get the value for the key 'query.replace.term.with.prefix.query'. <br>
|
||||
* The value is, e.g. true <br>
|
||||
|
@ -2286,6 +2306,36 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
|
|||
*/
|
||||
boolean isQueryReplaceTermWithPrefixQuery();
|
||||
|
||||
/**
|
||||
* Get the value for the key 'query.highlight.fragment.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 getQueryHighlightFragmentSize();
|
||||
|
||||
/**
|
||||
* Get the value for the key 'query.highlight.fragment.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 getQueryHighlightFragmentSizeAsInteger();
|
||||
|
||||
/**
|
||||
* Get the value for the key 'query.max.search.result.offset'. <br>
|
||||
* The value is, e.g. 100000 <br>
|
||||
* @return The value of found property. (NotNull: if not found, exception but basically no way)
|
||||
*/
|
||||
String getQueryMaxSearchResultOffset();
|
||||
|
||||
/**
|
||||
* Get the value for the key 'query.max.search.result.offset' as {@link Integer}. <br>
|
||||
* The value is, e.g. 100000 <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 getQueryMaxSearchResultOffsetAsInteger();
|
||||
|
||||
/**
|
||||
* Get the value for the key 'query.additional.response.fields'. <br>
|
||||
* The value is, e.g. <br>
|
||||
|
@ -5004,6 +5054,10 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
|
|||
return get(FessConfig.QUERY_GEO_FIELDS);
|
||||
}
|
||||
|
||||
public String getQueryBrowserLangParameterName() {
|
||||
return get(FessConfig.QUERY_BROWSER_LANG_PARAMETER_NAME);
|
||||
}
|
||||
|
||||
public String getQueryReplaceTermWithPrefixQuery() {
|
||||
return get(FessConfig.QUERY_REPLACE_TERM_WITH_PREFIX_QUERY);
|
||||
}
|
||||
|
@ -5012,6 +5066,22 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
|
|||
return is(FessConfig.QUERY_REPLACE_TERM_WITH_PREFIX_QUERY);
|
||||
}
|
||||
|
||||
public String getQueryHighlightFragmentSize() {
|
||||
return get(FessConfig.QUERY_HIGHLIGHT_FRAGMENT_SIZE);
|
||||
}
|
||||
|
||||
public Integer getQueryHighlightFragmentSizeAsInteger() {
|
||||
return getAsInteger(FessConfig.QUERY_HIGHLIGHT_FRAGMENT_SIZE);
|
||||
}
|
||||
|
||||
public String getQueryMaxSearchResultOffset() {
|
||||
return get(FessConfig.QUERY_MAX_SEARCH_RESULT_OFFSET);
|
||||
}
|
||||
|
||||
public Integer getQueryMaxSearchResultOffsetAsInteger() {
|
||||
return getAsInteger(FessConfig.QUERY_MAX_SEARCH_RESULT_OFFSET);
|
||||
}
|
||||
|
||||
public String getQueryAdditionalResponseFields() {
|
||||
return get(FessConfig.QUERY_ADDITIONAL_RESPONSE_FIELDS);
|
||||
}
|
||||
|
|
|
@ -17,17 +17,24 @@ package org.codelibs.fess.mylasta.direction.sponsor;
|
|||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.commons.lang3.LocaleUtils;
|
||||
import org.codelibs.core.lang.StringUtil;
|
||||
import org.codelibs.fess.mylasta.direction.FessConfig;
|
||||
import org.codelibs.fess.util.ComponentUtil;
|
||||
import org.dbflute.optional.OptionalObject;
|
||||
import org.dbflute.optional.OptionalThing;
|
||||
import org.dbflute.util.DfTypeUtil;
|
||||
import org.lastaflute.web.ruts.process.ActionRuntime;
|
||||
import org.lastaflute.web.servlet.request.RequestManager;
|
||||
import org.lastaflute.web.servlet.request.UserLocaleProcessProvider;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author jflute
|
||||
*/
|
||||
public class FessUserLocaleProcessProvider implements UserLocaleProcessProvider {
|
||||
private static final Logger logger = LoggerFactory.getLogger(FessUserLocaleProcessProvider.class);
|
||||
|
||||
@Override
|
||||
public boolean isAcceptCookieLocale() {
|
||||
|
@ -36,7 +43,16 @@ public class FessUserLocaleProcessProvider implements UserLocaleProcessProvider
|
|||
|
||||
@Override
|
||||
public OptionalThing<Locale> findBusinessLocale(final ActionRuntime runtimeMeta, final RequestManager requestManager) {
|
||||
return OptionalObject.empty(); // to next determination
|
||||
final FessConfig fessConfig = ComponentUtil.getFessConfig();
|
||||
final String name = fessConfig.getQueryBrowserLangParameterName();
|
||||
if (StringUtil.isNotBlank(name)) {
|
||||
try {
|
||||
return requestManager.getParameter(name).filter(StringUtil::isNotBlank).map(LocaleUtils::toLocale);
|
||||
} catch (Exception e) {
|
||||
logger.debug("Failed to parse a value of " + name + ".", e);
|
||||
}
|
||||
}
|
||||
return OptionalObject.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -202,7 +202,10 @@ index.indices.timeout=1m
|
|||
# query
|
||||
query.max.length=1000
|
||||
query.geo.fields=location
|
||||
query.browser.lang.parameter.name=browser_lang
|
||||
query.replace.term.with.prefix.query=true
|
||||
query.highlight.fragment.size=100
|
||||
query.max.search.result.offset=100000
|
||||
query.additional.response.fields=
|
||||
query.additional.api.response.fields=
|
||||
query.additional.cache.response.fields=
|
||||
|
|
|
@ -83,7 +83,6 @@ public class ViewHelperTest extends UnitFessTestCase {
|
|||
|
||||
public void test_escapeHighlight() {
|
||||
viewHelper = new ViewHelper();
|
||||
viewHelper.useHighlight = true;
|
||||
viewHelper.init();
|
||||
|
||||
String text = "";
|
||||
|
@ -92,11 +91,12 @@ public class ViewHelperTest extends UnitFessTestCase {
|
|||
text = "aaa";
|
||||
assertEquals("aaa", viewHelper.escapeHighlight(text));
|
||||
|
||||
text = "<em>aaa</em>";
|
||||
assertEquals("<em>aaa</em>", viewHelper.escapeHighlight(text));
|
||||
text = viewHelper.originalHighlightTagPre + "aaa" + viewHelper.originalHighlightTagPost;
|
||||
assertEquals(viewHelper.highlightTagPre + "aaa" + viewHelper.highlightTagPost, viewHelper.escapeHighlight(text));
|
||||
|
||||
text = "<em>aaa</em><b>bbb</b>";
|
||||
assertEquals("<em>aaa</em><b>bbb</b>", viewHelper.escapeHighlight(text));
|
||||
text = viewHelper.originalHighlightTagPre + "aaa" + viewHelper.originalHighlightTagPost + "<b>bbb</b>";
|
||||
assertEquals(viewHelper.highlightTagPre + "aaa" + viewHelper.highlightTagPost + "<b>bbb</b>",
|
||||
viewHelper.escapeHighlight(text));
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue