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 ea82910af..3bdb1df3f 100644
--- a/src/main/java/org/codelibs/fess/app/service/SearchService.java
+++ b/src/main/java/org/codelibs/fess/app/service/SearchService.java
@@ -61,6 +61,8 @@ import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.lastaflute.taglib.function.LaFunctions;
import org.lastaflute.web.util.LaRequestUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class SearchService {
@@ -68,6 +70,8 @@ public class SearchService {
// Constant
//
+ private static final Logger logger = LoggerFactory.getLogger(SearchService.class);
+
// ===================================================================================
// Attribute
//
@@ -117,6 +121,16 @@ public class SearchService {
.similarDocHash(params.getSimilarDocHash()).responseFields(queryHelper.getResponseFields())
.searchRequestType(params.getType()).build();
}, (searchRequestBuilder, execTime, searchResponse) -> {
+ searchResponse.ifPresent(r -> {
+ if (r.getTotalShards() != r.getSuccessfulShards() && fessConfig.isQueryTimeoutLogging()) {
+ // partial results
+ StringBuilder buf = new StringBuilder(1000);
+ buf.append("[SEARCH TIMEOUT] {\"exec_time\":").append(execTime)//
+ .append(",\"request\":").append(searchRequestBuilder.toString())//
+ .append(",\"response\":").append(r.toString()).append('}');
+ logger.warn(buf.toString());
+ }
+ });
final QueryResponseList queryResponseList = ComponentUtil.getQueryResponseList();
queryResponseList.init(searchResponse, pageStart, pageSize);
return queryResponseList;
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 018407fa5..4ca01bd24 100644
--- a/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java
+++ b/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java
@@ -564,6 +564,9 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
/** The key of the configuration. e.g. 10000 */
String QUERY_TIMEOUT = "query.timeout";
+ /** The key of the configuration. e.g. true */
+ String QUERY_TIMEOUT_LOGGING = "query.timeout.logging";
+
/** The key of the configuration. e.g. location */
String QUERY_GEO_FIELDS = "query.geo.fields";
@@ -2994,6 +2997,20 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
*/
Integer getQueryTimeoutAsInteger();
+ /**
+ * Get the value for the key 'query.timeout.logging'.
+ * The value is, e.g. true
+ * @return The value of found property. (NotNull: if not found, exception but basically no way)
+ */
+ String getQueryTimeoutLogging();
+
+ /**
+ * Is the property for the key 'query.timeout.logging' true?
+ * The value is, e.g. true
+ * @return The determination, true or false. (if not found, exception but basically no way)
+ */
+ boolean isQueryTimeoutLogging();
+
/**
* Get the value for the key 'query.geo.fields'.
* The value is, e.g. location
@@ -6625,6 +6642,14 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
return getAsInteger(FessConfig.QUERY_TIMEOUT);
}
+ public String getQueryTimeoutLogging() {
+ return get(FessConfig.QUERY_TIMEOUT_LOGGING);
+ }
+
+ public boolean isQueryTimeoutLogging() {
+ return is(FessConfig.QUERY_TIMEOUT_LOGGING);
+ }
+
public String getQueryGeoFields() {
return get(FessConfig.QUERY_GEO_FIELDS);
}
@@ -8282,6 +8307,7 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
defaultMap.put(FessConfig.INDEX_INDICES_TIMEOUT, "1m");
defaultMap.put(FessConfig.QUERY_MAX_LENGTH, "1000");
defaultMap.put(FessConfig.QUERY_TIMEOUT, "10000");
+ defaultMap.put(FessConfig.QUERY_TIMEOUT_LOGGING, "true");
defaultMap.put(FessConfig.QUERY_GEO_FIELDS, "location");
defaultMap.put(FessConfig.QUERY_BROWSER_LANG_PARAMETER_NAME, "browser_lang");
defaultMap.put(FessConfig.QUERY_REPLACE_TERM_WITH_PREFIX_QUERY, "true");
diff --git a/src/main/resources/fess_config.properties b/src/main/resources/fess_config.properties
index e6ff91ade..55dc0ec17 100644
--- a/src/main/resources/fess_config.properties
+++ b/src/main/resources/fess_config.properties
@@ -287,6 +287,7 @@ index.indices.timeout=1m
# query
query.max.length=1000
query.timeout=10000
+query.timeout.logging=true
query.geo.fields=location
query.browser.lang.parameter.name=browser_lang
query.replace.term.with.prefix.query=true