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 d15cef824..ef7809f1b 100644 --- a/src/main/java/org/codelibs/fess/es/client/FessEsClient.java +++ b/src/main/java/org/codelibs/fess/es/client/FessEsClient.java @@ -871,7 +871,7 @@ public class FessEsClient implements Client { // highlighting HighlightBuilder highlightBuilder = new HighlightBuilder(); queryHelper.highlightedFields(stream -> stream.forEach(hf -> highlightBuilder.field(hf, - fessConfig.getQueryHighlightFragmentSizeAsInteger()))); + fessConfig.getQueryHighlightFragmentSizeAsInteger(), fessConfig.getQueryHighlightNumberOfFragmentsAsInteger()))); searchRequestBuilder.highlighter(highlightBuilder); // facets 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 a416b0b52..2bd7499aa 100644 --- a/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java +++ b/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java @@ -432,9 +432,12 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction /** 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 */ + /** The key of the configuration. e.g. 50 */ String QUERY_HIGHLIGHT_FRAGMENT_SIZE = "query.highlight.fragment.size"; + /** The key of the configuration. e.g. 5 */ + String QUERY_HIGHLIGHT_NUMBER_OF_FRAGMENTS = "query.highlight.number.of.fragments"; + /** The key of the configuration. e.g. 100000 */ String QUERY_MAX_SEARCH_RESULT_OFFSET = "query.max.search.result.offset"; @@ -2314,19 +2317,34 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction /** * Get the value for the key 'query.highlight.fragment.size'.
- * The value is, e.g. 100
+ * The value is, e.g. 50
* @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}.
- * The value is, e.g. 100
+ * The value is, e.g. 50
* @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.highlight.number.of.fragments'.
+ * The value is, e.g. 5
+ * @return The value of found property. (NotNull: if not found, exception but basically no way) + */ + String getQueryHighlightNumberOfFragments(); + + /** + * Get the value for the key 'query.highlight.number.of.fragments' 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 getQueryHighlightNumberOfFragmentsAsInteger(); + /** * Get the value for the key 'query.max.search.result.offset'.
* The value is, e.g. 100000
@@ -5102,6 +5120,14 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction return getAsInteger(FessConfig.QUERY_HIGHLIGHT_FRAGMENT_SIZE); } + public String getQueryHighlightNumberOfFragments() { + return get(FessConfig.QUERY_HIGHLIGHT_NUMBER_OF_FRAGMENTS); + } + + public Integer getQueryHighlightNumberOfFragmentsAsInteger() { + return getAsInteger(FessConfig.QUERY_HIGHLIGHT_NUMBER_OF_FRAGMENTS); + } + public String getQueryMaxSearchResultOffset() { return get(FessConfig.QUERY_MAX_SEARCH_RESULT_OFFSET); } diff --git a/src/main/resources/fess_config.properties b/src/main/resources/fess_config.properties index 85b2cc5cc..e2cdf5967 100644 --- a/src/main/resources/fess_config.properties +++ b/src/main/resources/fess_config.properties @@ -204,7 +204,8 @@ 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.highlight.fragment.size=50 +query.highlight.number.of.fragments=5 query.max.search.result.offset=100000 query.additional.response.fields= query.additional.api.response.fields=