diff --git a/src/main/java/org/codelibs/fess/helper/SuggestHelper.java b/src/main/java/org/codelibs/fess/helper/SuggestHelper.java index 08ae8876b..b2a52587c 100644 --- a/src/main/java/org/codelibs/fess/helper/SuggestHelper.java +++ b/src/main/java/org/codelibs/fess/helper/SuggestHelper.java @@ -204,7 +204,8 @@ public class SuggestHelper { public void indexFromDocuments(final Consumer success, final Consumer error) { final FessConfig fessConfig = ComponentUtil.getFessConfig(); - final long interval =fessConfig.getSuggestUpdateRequestIntervalAsInteger().longValue(); + final long interval = fessConfig.getSuggestUpdateRequestIntervalAsInteger().longValue(); + final int docPerReq = fessConfig.getSuggestUpdateDocPerRequestAsInteger(); final SystemHelper systemHelper = ComponentUtil.getSystemHelper(); suggester .indexer() @@ -227,7 +228,7 @@ public class SuggestHelper { reader.addSort(SortBuilders.fieldSort(fessConfig.getIndexFieldClickCount())); reader.addSort(SortBuilders.scoreSort()); return reader; - }, 2, ()->{ + }, docPerReq, () -> { systemHelper.calibrateCpuLoad(); ThreadUtil.sleep(interval); }).then(response -> { diff --git a/src/main/java/org/codelibs/fess/helper/SystemHelper.java b/src/main/java/org/codelibs/fess/helper/SystemHelper.java index 5e58143e1..99b00efab 100644 --- a/src/main/java/org/codelibs/fess/helper/SystemHelper.java +++ b/src/main/java/org/codelibs/fess/helper/SystemHelper.java @@ -568,7 +568,7 @@ public class SystemHelper { try { final OsProbe osProbe = OsProbe.getInstance(); systemCpuPercent = osProbe.getSystemCpuPercent(); - if(logger.isDebugEnabled()) { + if (logger.isDebugEnabled()) { logger.debug("Updated System Cpu {}%", systemCpuPercent); } } catch (Exception e) { 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 7d52db0a3..dcdbe54e1 100644 --- a/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java +++ b/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java @@ -1388,9 +1388,12 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction /** The key of the configuration. e.g. content,title */ String SUGGEST_FIELD_INDEX_CONTENTS = "suggest.field.index.contents"; - /** The key of the configuration. e.g. 1 */ + /** The key of the configuration. e.g. 0 */ String SUGGEST_UPDATE_REQUEST_INTERVAL = "suggest.update.request.interval"; + /** The key of the configuration. e.g. 2 */ + String SUGGEST_UPDATE_DOC_PER_REQUEST = "suggest.update.doc.per.request"; + /** The key of the configuration. e.g. 50% */ String SUGGEST_UPDATE_CONTENTS_LIMIT_NUM_PERCENTAGE = "suggest.update.contents.limit.num.percentage"; @@ -5913,19 +5916,34 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction /** * Get the value for the key 'suggest.update.request.interval'.
- * The value is, e.g. 1
+ * The value is, e.g. 0
* @return The value of found property. (NotNull: if not found, exception but basically no way) */ String getSuggestUpdateRequestInterval(); /** * Get the value for the key 'suggest.update.request.interval' as {@link Integer}.
- * The value is, e.g. 1
+ * The value is, e.g. 0
* @return The value of found property. (NotNull: if not found, exception but basically no way) * @throws NumberFormatException When the property is not integer. */ Integer getSuggestUpdateRequestIntervalAsInteger(); + /** + * Get the value for the key 'suggest.update.doc.per.request'.
+ * The value is, e.g. 2
+ * @return The value of found property. (NotNull: if not found, exception but basically no way) + */ + String getSuggestUpdateDocPerRequest(); + + /** + * Get the value for the key 'suggest.update.doc.per.request' as {@link Integer}.
+ * The value is, e.g. 2
+ * @return The value of found property. (NotNull: if not found, exception but basically no way) + * @throws NumberFormatException When the property is not integer. + */ + Integer getSuggestUpdateDocPerRequestAsInteger(); + /** * Get the value for the key 'suggest.update.contents.limit.num.percentage'.
* The value is, e.g. 50%
@@ -8754,6 +8772,14 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction return getAsInteger(FessConfig.SUGGEST_UPDATE_REQUEST_INTERVAL); } + public String getSuggestUpdateDocPerRequest() { + return get(FessConfig.SUGGEST_UPDATE_DOC_PER_REQUEST); + } + + public Integer getSuggestUpdateDocPerRequestAsInteger() { + return getAsInteger(FessConfig.SUGGEST_UPDATE_DOC_PER_REQUEST); + } + public String getSuggestUpdateContentsLimitNumPercentage() { return get(FessConfig.SUGGEST_UPDATE_CONTENTS_LIMIT_NUM_PERCENTAGE); } @@ -9490,7 +9516,8 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction defaultMap.put(FessConfig.SUGGEST_FIELD_TAGS, "label"); defaultMap.put(FessConfig.SUGGEST_FIELD_ROLES, "role"); defaultMap.put(FessConfig.SUGGEST_FIELD_INDEX_CONTENTS, "content,title"); - defaultMap.put(FessConfig.SUGGEST_UPDATE_REQUEST_INTERVAL, "1"); + defaultMap.put(FessConfig.SUGGEST_UPDATE_REQUEST_INTERVAL, "0"); + defaultMap.put(FessConfig.SUGGEST_UPDATE_DOC_PER_REQUEST, "2"); defaultMap.put(FessConfig.SUGGEST_UPDATE_CONTENTS_LIMIT_NUM_PERCENTAGE, "50%"); defaultMap.put(FessConfig.SUGGEST_UPDATE_CONTENTS_LIMIT_NUM, "10000"); defaultMap.put(FessConfig.SUGGEST_UPDATE_CONTENTS_LIMIT_DOC_SIZE, "50000"); diff --git a/src/main/resources/fess_config.properties b/src/main/resources/fess_config.properties index 34b5ed4f0..027ad876d 100644 --- a/src/main/resources/fess_config.properties +++ b/src/main/resources/fess_config.properties @@ -748,6 +748,7 @@ suggest.field.tags=label suggest.field.roles=role suggest.field.index.contents=content,title suggest.update.request.interval=0 +suggest.update.doc.per.request=2 suggest.update.contents.limit.num.percentage=50% suggest.update.contents.limit.num=10000 suggest.update.contents.limit.doc.size=50000