fix #849 modify query.highlihgt parameters

This commit is contained in:
Shinsuke Sugaya 2017-01-24 06:32:59 +09:00
parent d5e8d60cfc
commit 3fd47007f8
3 changed files with 32 additions and 5 deletions

View file

@ -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

View file

@ -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'. <br>
* The value is, e.g. 100 <br>
* The value is, e.g. 50 <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>
* The value is, e.g. 50 <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.highlight.number.of.fragments'. <br>
* The value is, e.g. 5 <br>
* @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}. <br>
* The value is, e.g. 5 <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 getQueryHighlightNumberOfFragmentsAsInteger();
/**
* Get the value for the key 'query.max.search.result.offset'. <br>
* The value is, e.g. 100000 <br>
@ -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);
}

View file

@ -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=