fix #1570 add suggest.popular.word.query.freq

This commit is contained in:
Shinsuke Sugaya 2018-03-21 17:33:58 +09:00
parent 41720c755b
commit b2b037d066
3 changed files with 30 additions and 1 deletions

View file

@ -71,7 +71,8 @@ public class PopularWordHelper {
final PopularWordsRequestBuilder popularWordsRequestBuilder =
suggestHelper.suggester().popularWords()
.setSize(fessConfig.getSuggestPopularWordSizeAsInteger().intValue())
.setWindowSize(fessConfig.getSuggestPopularWordWindowSizeAsInteger().intValue());
.setWindowSize(fessConfig.getSuggestPopularWordWindowSizeAsInteger().intValue())
.setQueryFreqThreshold(fessConfig.getSuggestPopularWordQueryFreqAsInteger().intValue());
popularWordsRequestBuilder.setSeed(baseSeed);
stream(baseTags).of(stream -> stream.forEach(tag -> popularWordsRequestBuilder.addTag(tag)));
stream(baseRoles).of(stream -> stream.forEach(role -> popularWordsRequestBuilder.addRole(role)));

View file

@ -1096,6 +1096,9 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
/** The key of the configuration. e.g. 30 */
String SUGGEST_POPULAR_WORD_WINDOW_SIZE = "suggest.popular.word.window.size";
/** The key of the configuration. e.g. 10 */
String SUGGEST_POPULAR_WORD_QUERY_FREQ = "suggest.popular.word.query.freq";
/** The key of the configuration. e.g. 1 */
String SUGGEST_MIN_HIT_COUNT = "suggest.min.hit.count";
@ -4872,6 +4875,21 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
*/
Integer getSuggestPopularWordWindowSizeAsInteger();
/**
* Get the value for the key 'suggest.popular.word.query.freq'. <br>
* The value is, e.g. 10 <br>
* @return The value of found property. (NotNull: if not found, exception but basically no way)
*/
String getSuggestPopularWordQueryFreq();
/**
* Get the value for the key 'suggest.popular.word.query.freq' as {@link Integer}. <br>
* The value is, e.g. 10 <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 getSuggestPopularWordQueryFreqAsInteger();
/**
* Get the value for the key 'suggest.min.hit.count'. <br>
* The value is, e.g. 1 <br>
@ -7457,6 +7475,14 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
return getAsInteger(FessConfig.SUGGEST_POPULAR_WORD_WINDOW_SIZE);
}
public String getSuggestPopularWordQueryFreq() {
return get(FessConfig.SUGGEST_POPULAR_WORD_QUERY_FREQ);
}
public Integer getSuggestPopularWordQueryFreqAsInteger() {
return getAsInteger(FessConfig.SUGGEST_POPULAR_WORD_QUERY_FREQ);
}
public String getSuggestMinHitCount() {
return get(FessConfig.SUGGEST_MIN_HIT_COUNT);
}
@ -8207,6 +8233,7 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction
defaultMap.put(FessConfig.SUGGEST_POPULAR_WORD_EXCLUDES, "");
defaultMap.put(FessConfig.SUGGEST_POPULAR_WORD_SIZE, "10");
defaultMap.put(FessConfig.SUGGEST_POPULAR_WORD_WINDOW_SIZE, "30");
defaultMap.put(FessConfig.SUGGEST_POPULAR_WORD_QUERY_FREQ, "10");
defaultMap.put(FessConfig.SUGGEST_MIN_HIT_COUNT, "1");
defaultMap.put(FessConfig.SUGGEST_FIELD_CONTENTS, "_default");
defaultMap.put(FessConfig.SUGGEST_FIELD_TAGS, "label");

View file

@ -563,6 +563,7 @@ suggest.popular.word.fields=
suggest.popular.word.excludes=
suggest.popular.word.size=10
suggest.popular.word.window.size=30
suggest.popular.word.query.freq=10
suggest.min.hit.count=1
suggest.field.contents=_default
suggest.field.tags=label